diff --git a/system/inc/system_sleep_configuration.h b/system/inc/system_sleep_configuration.h index 32a4e4c4ec..0e6f750c0e 100644 --- a/system/inc/system_sleep_configuration.h +++ b/system/inc/system_sleep_configuration.h @@ -270,7 +270,7 @@ class SystemSleepConfiguration: protected SystemSleepConfigurationHelper { return *this; } - SystemSleepConfiguration& gpios(const uint8_t* pins, size_t count, InterruptMode mode) { + SystemSleepConfiguration& gpios(const pin_t* pins, size_t count, InterruptMode mode) { for (size_t i = 0; i < count; i++) { gpio(pins[i], mode); } diff --git a/user/tests/wiring/api/system.cpp b/user/tests/wiring/api/system.cpp index e715047fb5..309c628a07 100644 --- a/user/tests/wiring/api/system.cpp +++ b/user/tests/wiring/api/system.cpp @@ -50,6 +50,8 @@ test(system_api) { test(system_sleep) { + const pin_t pins_array[] = {D0, D1}; + const InterruptMode mode_array[] = {RISING, FALLING}; // All sleep methods should return System.sleep() API_COMPILE({ SleepResult r = System.sleep(60); (void)r; }); @@ -103,9 +105,6 @@ test(system_sleep) */ API_COMPILE({ SleepResult r = System.sleep({D0, D1}, {RISING, FALLING}); (void)r; }); - const pin_t pins_array[] = {D0, D1}; - const InterruptMode mode_array[] = {RISING, FALLING}; - /* * wakeup pins: pin_t* + size_t * trigger mode: single InterruptMode @@ -169,6 +168,9 @@ test(system_sleep) API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpio(WKP, RISING)); (void)r; }); API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpio(WKP, FALLING)); (void)r; }); API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpio(WKP, CHANGE)); (void)r; }); + API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpios(Vector>())); (void)r; }); + API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpios(Vector(), RISING)); (void)r; }); + API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().gpios(pins_array, sizeof(pins_array)/sizeof(*pins_array), RISING)); (void)r; }); API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().duration(1000)); (void)r; }); API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().duration(1000ms)); (void)r; }); API_COMPILE({ SystemSleepResult r = System.sleep(SystemSleepConfiguration().duration(1s)); (void)r; });