Firmware SDK
|
Task scheduler. More...
Macros | |
#define | TWR_SCHEDULER_MAX_TASKS 32 |
Maximum number of tasks. | |
#define | TWR_SCHEDULER_INTERVAL_MS 10 |
Typedefs | |
typedef size_t | twr_scheduler_task_id_t |
Task ID assigned by scheduler. | |
Functions | |
void | twr_scheduler_init (void) |
Initialize task scheduler. | |
void | twr_scheduler_run (void) |
Run task scheduler (this call never ends) | |
twr_scheduler_task_id_t | twr_scheduler_register (void(*task)(void *), void *param, twr_tick_t tick) |
Register task in scheduler. More... | |
void | twr_scheduler_unregister (twr_scheduler_task_id_t task_id) |
Unregister specified task. More... | |
twr_scheduler_task_id_t | twr_scheduler_get_current_task_id (void) |
Get task ID of currently executing task. More... | |
twr_tick_t | twr_scheduler_get_spin_tick (void) |
Get current tick of spin in which task has been run. More... | |
void | twr_scheduler_disable_sleep (void) |
Disable sleep mode, implemented as semaphore. | |
void | twr_scheduler_enable_sleep (void) |
Enable sleep mode, implemented as semaphore. | |
void | twr_scheduler_plan_now (twr_scheduler_task_id_t task_id) |
Schedule specified task for immediate execution. More... | |
void | twr_scheduler_plan_absolute (twr_scheduler_task_id_t task_id, twr_tick_t tick) |
Schedule specified task to absolute tick. More... | |
void | twr_scheduler_plan_relative (twr_scheduler_task_id_t task_id, twr_tick_t tick) |
Schedule specified task to tick relative from current spin. More... | |
void | twr_scheduler_plan_from_now (twr_scheduler_task_id_t task_id, twr_tick_t tick) |
Schedule specified task to tick relative from now. More... | |
void | twr_scheduler_plan_current_now (void) |
Schedule current task for immediate execution. | |
void | twr_scheduler_plan_current_absolute (twr_tick_t tick) |
Schedule current task to absolute tick. More... | |
void | twr_scheduler_plan_current_relative (twr_tick_t tick) |
Schedule current task to tick relative from current spin. More... | |
void | twr_scheduler_plan_current_from_now (twr_tick_t tick) |
Schedule current task to tick relative from now. More... | |
Task scheduler.
twr_scheduler_task_id_t twr_scheduler_get_current_task_id | ( | void | ) |
Get task ID of currently executing task.
Definition at line 100 of file twr_scheduler.c.
twr_tick_t twr_scheduler_get_spin_tick | ( | void | ) |
Get current tick of spin in which task has been run.
Definition at line 105 of file twr_scheduler.c.
void twr_scheduler_plan_absolute | ( | twr_scheduler_task_id_t | task_id, |
twr_tick_t | tick | ||
) |
Schedule specified task to absolute tick.
[in] | task_id | Task ID to be scheduled |
[in] | tick | Tick at which the task will be run |
Definition at line 119 of file twr_scheduler.c.
Referenced by twr_analog_sensor_set_update_interval(), twr_button_set_event_handler(), twr_cy8cmbr3102_set_scan_interval(), twr_ds18b20_measure(), twr_ds18b20_rescan(), twr_ds18b20_set_update_interval(), twr_flood_detector_set_update_interval(), twr_hc_sr04_set_update_interval(), twr_hdc2080_measure(), twr_hdc2080_set_update_interval(), twr_hts221_measure(), twr_hts221_set_update_interval(), twr_lis2dh12_set_update_interval(), twr_lp8_set_update_interval(), twr_module_battery_set_update_interval(), twr_module_infra_grid_measure(), twr_module_infra_grid_set_update_interval(), twr_module_rs485_measure(), twr_module_rs485_set_update_interval(), twr_mpl3115a2_measure(), twr_mpl3115a2_set_update_interval(), twr_opt3001_measure(), twr_opt3001_set_update_interval(), twr_pulse_counter_set_update_interval(), twr_sgp30_set_update_interval(), twr_sgpc3_set_update_interval(), twr_sht20_measure(), twr_sht20_set_update_interval(), twr_sht30_measure(), twr_sht30_set_update_interval(), twr_soil_sensor_set_update_interval(), twr_spirit1_set_rx_timeout(), twr_sps30_set_update_interval(), twr_tmp112_measure(), twr_tmp112_set_update_interval(), twr_uart_async_write(), and twr_zssc3123_set_update_interval().
void twr_scheduler_plan_current_absolute | ( | twr_tick_t | tick | ) |
Schedule current task to absolute tick.
[in] | tick | Tick at which the task will be run |
Definition at line 151 of file twr_scheduler.c.
void twr_scheduler_plan_current_from_now | ( | twr_tick_t | tick | ) |
Schedule current task to tick relative from now.
[in] | tick | Tick at which the task will be run as a relative value from now |
Definition at line 161 of file twr_scheduler.c.
void twr_scheduler_plan_current_relative | ( | twr_tick_t | tick | ) |
Schedule current task to tick relative from current spin.
[in] | tick | Tick at which the task will be run as a relative value from current spin |
Definition at line 156 of file twr_scheduler.c.
void twr_scheduler_plan_from_now | ( | twr_scheduler_task_id_t | task_id, |
twr_tick_t | tick | ||
) |
Schedule specified task to tick relative from now.
[in] | task_id | Task ID to be scheduled |
[in] | tick | Tick at which the task will be run as a relative value from now |
Definition at line 137 of file twr_scheduler.c.
Referenced by twr_led_pulse().
void twr_scheduler_plan_now | ( | twr_scheduler_task_id_t | task_id | ) |
Schedule specified task for immediate execution.
[in] | task_id | Task ID to be scheduled |
Definition at line 110 of file twr_scheduler.c.
Referenced by twr_analog_sensor_measure(), twr_button_set_event_handler(), twr_cmwx1zzabz_custom_at(), twr_cmwx1zzabz_factory_reset(), twr_cmwx1zzabz_frame_counter(), twr_cmwx1zzabz_join(), twr_cmwx1zzabz_link_check(), twr_cmwx1zzabz_reboot(), twr_cmwx1zzabz_rfq(), twr_cmwx1zzabz_send_message(), twr_cmwx1zzabz_send_message_confirmed(), twr_flood_detector_measure(), twr_led_blink(), twr_led_set_mode(), twr_led_set_pattern(), twr_lis2dh12_measure(), twr_lis2dh12_set_resolution(), twr_lis2dh12_set_scale(), twr_lp8_measure(), twr_module_battery_measure(), twr_pyq1648_set_sensitivity(), twr_sam_m8q_start(), twr_sam_m8q_stop(), twr_soil_sensor_measure(), twr_spirit1_rx(), twr_spirit1_sleep(), twr_spirit1_tx(), twr_sps30_measure(), twr_td1207r_send_rf_frame(), twr_usb_cdc_write(), and twr_zssc3123_measure().
void twr_scheduler_plan_relative | ( | twr_scheduler_task_id_t | task_id, |
twr_tick_t | tick | ||
) |
Schedule specified task to tick relative from current spin.
[in] | task_id | Task ID to be scheduled |
[in] | tick | Tick at which the task will be run as a relative value from current spin |
Definition at line 128 of file twr_scheduler.c.
Referenced by twr_analog_sensor_set_update_interval(), twr_atsha204_read_serial_number(), twr_ds18b20_set_update_interval(), twr_flood_detector_set_update_interval(), twr_hc_sr04_set_update_interval(), twr_hdc2080_set_update_interval(), twr_hts221_set_update_interval(), twr_lis2dh12_set_update_interval(), twr_lp8_set_update_interval(), twr_module_infra_grid_set_update_interval(), twr_module_rs485_set_update_interval(), twr_mpl3115a2_set_update_interval(), twr_opt3001_set_update_interval(), twr_pulse_counter_set_update_interval(), twr_sgp30_set_update_interval(), twr_sgpc3_set_update_interval(), twr_sht20_set_update_interval(), twr_sht30_set_update_interval(), twr_soil_sensor_set_update_interval(), twr_sps30_set_update_interval(), and twr_tmp112_set_update_interval().
twr_scheduler_task_id_t twr_scheduler_register | ( | void(*)(void *) | task, |
void * | param, | ||
twr_tick_t | tick | ||
) |
Register task in scheduler.
[in] | task | Task function address |
[in] | param | Optional parameter which is passed to task function (can be NULL) |
[in] | tick | Absolute tick when task will be scheduled |
Definition at line 53 of file twr_scheduler.c.
Referenced by twr_adc_init(), twr_analog_sensor_init(), twr_atci_set_uart_active_callback(), twr_atsha204_init(), twr_button_init(), twr_button_init_virtual(), twr_cmwx1zzabz_init(), twr_cy8cmbr3102_init(), twr_dma_init(), twr_ds18b20_init(), twr_eeprom_async_write(), twr_flood_detector_init(), twr_hc_sr04_init(), twr_hc_sr04_measure(), twr_hdc2080_init(), twr_hts221_init(), twr_led_init(), twr_led_init_virtual(), twr_lis2dh12_init(), twr_lp8_init(), twr_module_battery_init(), twr_module_encoder_init(), twr_module_infra_grid_init(), twr_module_rs485_async_read_start(), twr_module_rs485_async_write(), twr_mpl3115a2_init(), twr_opt3001_init(), twr_pulse_counter_init(), twr_pyq1648_init(), twr_radio_init(), twr_sam_m8q_init(), twr_sgp30_init(), twr_sgpc3_init(), twr_sht20_init(), twr_sht30_init(), twr_soil_sensor_init_multiple(), twr_spi_init(), twr_spirit1_init(), twr_sps30_init(), twr_switch_init(), twr_td1207r_init(), twr_tmp112_init(), twr_uart_async_read_start(), twr_uart_async_write(), twr_usb_cdc_init(), twr_wssfm10r1at_init(), and twr_zssc3123_init().
void twr_scheduler_unregister | ( | twr_scheduler_task_id_t | task_id | ) |
Unregister specified task.
[in] | task_id | Task ID to be unregistered |
Definition at line 77 of file twr_scheduler.c.
Referenced by twr_atci_set_uart_active_callback(), twr_cmwx1zzabz_deinit(), twr_eeprom_async_cancel(), twr_hdc2080_deinit(), twr_hts221_deinit(), twr_module_encoder_deinit(), twr_module_rs485_async_read_stop(), twr_module_rs485_deinit(), twr_mpl3115a2_deinit(), twr_opt3001_deinit(), twr_sgp30_deinit(), twr_sgpc3_deinit(), twr_sht20_deinit(), twr_sht30_deinit(), twr_spirit1_deinit(), twr_tmp112_deinit(), twr_uart_async_read_cancel(), twr_uart_deinit(), and twr_zssc3123_deinit().