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 96 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 101 of file twr_scheduler.c.
Referenced by twr_button_set_hold_time(), twr_module_relay_init(), twr_sgp30_set_compensation(), twr_sgpc3_set_compensation(), and twr_switch_set_pull_advance_time().
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 111 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_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 131 of file twr_scheduler.c.
Referenced by twr_hdc2080_get_temperature_celsius(), twr_hts221_get_humidity_percentage(), twr_module_battery_is_present(), twr_module_relay_init(), twr_module_rs485_measure(), twr_mpl3115a2_get_pressure_pascal(), twr_opt3001_get_illuminance_lux(), twr_sgp30_set_compensation(), twr_sgpc3_set_compensation(), twr_sht20_get_temperature_kelvin(), twr_sht30_get_temperature_kelvin(), twr_spirit1_sleep(), twr_tmp112_get_temperature_kelvin(), and twr_zssc3123_unlock_eeprom().
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 141 of file twr_scheduler.c.
Referenced by twr_analog_sensor_measure(), twr_atsha204_get_serial_number(), twr_cmwx1zzabz_set_debug(), twr_cy8cmbr3102_is_touch(), twr_ds18b20_get_temperature_celsius(), twr_hdc2080_get_temperature_celsius(), twr_hts221_get_humidity_percentage(), twr_lis2dh12_get_result_g(), twr_lp8_calibration(), twr_ls013b7dh03_clear_memory_command(), twr_module_rs485_measure(), twr_mpl3115a2_get_pressure_pascal(), twr_opt3001_get_illuminance_lux(), twr_sgp30_set_compensation(), twr_sgpc3_set_compensation(), twr_sht20_get_temperature_kelvin(), twr_sht30_get_temperature_kelvin(), twr_soil_sensor_get_error(), twr_sps30_get_typical_particle_size(), twr_td1207r_send_rf_frame(), twr_tmp112_get_temperature_kelvin(), twr_wssfm10r1at_continuous_wave(), and twr_zssc3123_unlock_eeprom().
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 136 of file twr_scheduler.c.
Referenced by twr_analog_sensor_measure(), twr_button_set_hold_time(), twr_ds18b20_get_temperature_celsius(), twr_flood_detector_is_alarm(), twr_hc_sr04_get_distance_millimeter(), twr_hdc2080_get_temperature_celsius(), twr_hts221_get_humidity_percentage(), twr_lis2dh12_get_result_g(), twr_lp8_calibration(), twr_module_infra_grid_get_temperatures_celsius(), twr_module_rs485_measure(), twr_mpl3115a2_get_pressure_pascal(), twr_opt3001_get_illuminance_lux(), twr_pulse_counter_reset(), twr_pyq1648_set_blank_period(), twr_sam_m8q_get_accuracy(), twr_sgp30_set_compensation(), twr_sgpc3_set_compensation(), twr_sht20_get_temperature_kelvin(), twr_sht30_get_temperature_kelvin(), twr_soil_sensor_get_error(), twr_sps30_get_typical_particle_size(), twr_switch_set_pull_advance_time(), twr_tmp112_get_temperature_kelvin(), and twr_uart_async_read().
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 121 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 106 of file twr_scheduler.c.
Referenced by twr_adc_get_vdda_voltage(), twr_analog_sensor_measure(), twr_button_set_event_handler(), twr_cmwx1zzabz_get_error_response(), twr_cmwx1zzabz_join(), twr_cmwx1zzabz_send_message(), twr_cmwx1zzabz_send_message_confirmed(), twr_flood_detector_measure(), twr_hc_sr04_get_distance_millimeter(), 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_is_present(), twr_module_battery_measure(), twr_module_encoder_is_present(), twr_pulse_counter_reset(), twr_pyq1648_set_sensitivity(), twr_sam_m8q_start(), twr_sam_m8q_stop(), twr_soil_sensor_measure(), twr_spi_async_transfer(), twr_spirit1_rx(), twr_spirit1_sleep(), twr_spirit1_tx(), twr_sps30_measure(), twr_td1207r_send_rf_frame(), twr_usb_cdc_write(), twr_wssfm10r1at_continuous_wave(), 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 116 of file twr_scheduler.c.
Referenced by twr_analog_sensor_set_update_interval(), twr_atsha204_read_serial_number(), twr_cmwx1zzabz_init(), 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_calibration(), 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_ls013b7dh03_init(), twr_module_battery_init(), twr_module_encoder_init(), twr_module_infra_grid_init(), twr_module_relay_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_usb_cdc_read(), 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_eeprom_async_cancel(), twr_eeprom_get_size(), twr_hc_sr04_get_distance_millimeter(), twr_hdc2080_deinit(), twr_hts221_deinit(), twr_module_encoder_deinit(), twr_module_relay_init(), twr_module_rs485_async_read_stop(), twr_module_rs485_deinit(), twr_module_rs485_measure(), 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(), twr_uart_async_read_cancel(), twr_usb_cdc_read(), and twr_zssc3123_deinit().