![]() |
RUI3 (RAK Unified Interface 3) - RAK4631
|
Functions | |
bool | create (RAK_TIMER_ID id, RAK_TIMER_HANDLER handler, RAK_TIMER_MODE mode) |
bool | start (RAK_TIMER_ID id, uint32_t ms, void *data) |
bool | stop (RAK_TIMER_ID id) |
bool create | ( | RAK_TIMER_ID | id, |
RAK_TIMER_HANDLER | handler, | ||
RAK_TIMER_MODE | mode | ||
) |
id | the timer ID |
handler | the handler function for this timer |
mode | the mode of this timer |
TRUE | for creating timer successfully |
FALSE | for creating timer failure |
void handler(void *data) { Serial.printf("[%lu]This is the handler\r\n", millis()); } void setup() { Serial.begin(115200); if (api.system.timer.create(RAK_TIMER_0, (RAK_TIMER_HANDLER)handler, RAK_TIMER_PERIODIC) != true) { Serial.printf("Creating timer failed.\r\n"); } else if (api.system.timer.start(RAK_TIMER_0, 1000, NULL) != true) { Serial.printf("Starting timer failed.\r\n"); } } void loop() { }
bool start | ( | RAK_TIMER_ID | id, |
uint32_t | ms, | ||
void * | data | ||
) |
id | the timer ID |
ms | the period of timer |
data | the data passed to timer handler function |
TRUE | for starting timer successfully |
FALSE | for starting timer failure |
void handler(void *data) { Serial.printf("[%lu]This is the handler\r\n", millis()); } void setup() { Serial.begin(115200); if (api.system.timer.create(RAK_TIMER_0, (RAK_TIMER_HANDLER)handler, RAK_TIMER_PERIODIC) != true) { Serial.printf("Creating timer failed.\r\n"); } else if (api.system.timer.start(RAK_TIMER_0, 1000, NULL) != true) { Serial.printf("Starting timer failed.\r\n"); } } void loop() { }
bool stop | ( | RAK_TIMER_ID | id | ) |
id | the timer ID |
TRUE | for stoping timer successfully |
FALSE | for stoping timer failure |
void handler(void *data) { Serial.printf("[%lu]This is the handler\r\n", millis()); } void setup() { Serial.begin(115200); if (api.system.timer.create(RAK_TIMER_0, (RAK_TIMER_HANDLER)handler, RAK_TIMER_PERIODIC) != true) { Serial.printf("Creating timer failed.\r\n"); } else if (api.system.timer.start(RAK_TIMER_0, 1000, NULL) != true) { Serial.printf("Starting timer failed.\r\n"); } } void loop() { if (millis() > 60000) { if (api.system.timer.stop(RAK_TIMER_0) != true) { Serial.printf("Stoping timer failed.\r\n"); } } }