Sensor Hub#
Introduction#
Sensor Hub products are primarily intended to address consumer, industrial, and medical applications that require wireless connectivity, extremely low power, and high performance for sensor fusion algorithms. The MCU core, wireless connectivity, and peripherals are identical to the SI917 CCP Radio board.
Sensor Hub functions as a sensor management system, facilitating hardware abstraction layer, peripheral drivers, and sensor driver layer integration to collect and distribute desired sensor data.
It enables users to collect sensor data based on time interval or number of samples or when a specific data requirement are met.
Sensor Hub serves as a framework that can be seamlessly integrated into any application requiring sensor management.
The Sensor HUB works with sensors as per configurations provided by the application and notifies the necessary events throughout the application.
The configuration for the sensors must be provided through the sensor hub config file on which the sensor hub should act.
Sensor Hub relies on FreeRTOS using CMSIS RTOS version 2 wrapper.
Configuration#
Sensor Hub has 2 Sensor Mode:
- SL_SH_POLLING_MODE: This mode is Timer based.
- SL_SH_INTERRUPT_MODE: This mode is NPSS Button 0 GPIO Interrupt based.
There are 3 types of data_deliver.mode in Polling Sensor Mode and they are - SL_SH_THRESHOLD, - SL_SH_TIMEOUT and - SL_SH_NUM_OF_SAMPLES.
- SL_SH_NO_DATA data_deliver.mode is used when Interrupt Sensor Mode is selected.
If the user wants a value that sets a limit or boundary, above which the sensor data should be shown then - SL_SH_THRESHOLD mode should be chosen
- SL_SH_TIMEOUT mode is used when user wants to get the data at some intervals of time for some sampling time
- SL_SH_NUM_OF_SAMPLES mode is used when user wants to get the particular number of sensor data
- SL_SH_NO_DATA mode is used when .
Here data_deliver.timeout is the time for which the sensor should keep collecting the data for.
sampling_interval is the the amount of time between two sensor data read is sampled or collected.
sampling_intr_req_pin is the GPIO pin for sampling the sensor data
Configure the number of sensors info in the /sensors/inc/sensors_config.h file
#define - SL_MAX_NUM_SENSORS 5 // Maximum sensors present in the system
Modes: Using the configuration structure, one can configure the following parameters in the sensorhub_config.c file:
For POLLING Sensor Mode configure the below parameters:
.sensor_mode = - SL_SH_POLLING_MODE, .sampling_interval = 100,
If sensor_mode is selected as - SL_SH_POLLING_MODE, then data_deliver.mode should be configured as one of the following for a sensor configuration structure:
For TIMEOUT Data Mode configure the below parameters:
.data_deliver.mode = - SL_SH_TIMEOUT, .data_deliver.timeout = 1000,
For THRESHOLD Data Mode configure the below parameters:
.data_deliver.mode = - SL_SH_THRESHOLD, .data_deliver.threshold = 1000,
For SAMPLING Data Mode configure the below parameters:
.data_deliver.mode = - SL_SH_NUM_OF_SAMPLES, .data_deliver.numOfSamples = 5,
For INTERRUPT Sensor Mode configure the below parameters:
.sensor_mode = - SL_SH_INTERRUPT_MODE, .sampling_intr_req_pin = BUTTON_0_GPIO_PIN, .sensor_intr_type = - SL_SH_FALL_EDGE, .data_deliver.data_mode = - SL_SH_NO_DATA_MODE,
To configure the PS2, please update the below macro in the preprocessor settings:
- SL_SENSORHUB_POWERSAVE=1 Enabling this macro will move the application from PS4 state to PS2 state. In PS2 state the sensor data will be sampled and collected.
To configure the power states to PS4 sleep or PS2 Sleep, please update the defines in sisdk/util/third_party/freertos/kernel/include/FreeRTOS.h file as below:
#ifndef configUSE_TICKLESS_IDLE #define configUSE_TICKLESS_IDLE 1 // 1 is to Enable the tickless Idle mode #endif #ifndef configPRE_SLEEP_PROCESSING #define configPRE_SLEEP_PROCESSING(x) sli_si91x_sleep_wakeup(x) // Here x is idle time, #endif // Configure the sleep time by using the below macro. // If the number of Ideal task ticks exceeds this value, the system is allowed to sleep. #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 70 #endif
Note:
By using above sleep configuration, sensor hub is going to sleep by using the idle task and idle time.
If the Ideal time exceeds the expected sleep time value, the system is allowed to sleep.
The above idle time is fed to the Alarm timer, which we are using as a wake-up source.
ADC Configurations: Configure only below parameters for ADC to change its mode from FIFO to STATIC and vice versa
For ADC FIFO mode, configure as shown below:
.adc_config.adc_cfg.operation_mode = - SL_ADC_FIFO_MODE, .adc_config.adc_ch_cfg.sampling_rate[0] = - SL_SH_ADC_SAMPLING_RATE, // Use 100 for FIFO Mode
For ADC Static mode, configure as shown below:
.adc_config.adc_cfg.operation_mode = - SL_ADC_STATIC_MODE, .adc_config.adc_ch_cfg.sampling_rate[0] = - SL_SH_ADC_SAMPLING_RATE, // Use 1000 for Static Mode
To configure the PS1 power state from PS2 State, please update the below macro in the preprocessor settings:
- SL_SH_ADC_PS1=1 Enabling this macro will move the core from PS2 Active state to PS1 state
Please update the defines in sisdk/util/third_party/freertos/kernel/include/FreeRTOS.h file as below:
#ifndef configUSE_TICKLESS_IDLE #define configUSE_TICKLESS_IDLE 1 // 1 is to Enable the tickless Idle mode #endif #ifndef configPRE_SLEEP_PROCESSING #define configPRE_SLEEP_PROCESSING(x) sli_si91x_sleep_wakeup(x) // Here x is idle time, #endif
Note:
The PS1 state transition only applies to ADC FIFO Mode. Before entering this mode, kindly turn off any other sensors.
Usage#
Sensorhub provides two apis which user can use for intergrating into any application
sl_si91x_sensorhub_app_task(void);
sl_si91x_sensor_event_handler(uint8_t sensor_id, uint8_t event);
sl_si91x_sensorhub_app_task(void): initialises and starts sensor data collection. it achieves this by calling the following apis
sl_si91x_sensorhub_notify_cb_register(sl_sensor_signalEvent_t cb_event, sl_sensor_id_t *cb_ack): links the event handler provided by the user as a callback function in the event task
sl_si91x_sensorhub_init(): initializes the peripherals I2C, SPI, ADC, SDC
sl_si91x_sensorhub_detect_sensors(sl_sensor_id_t *sensor_id_info, uint8_t num_of_sensors): scans the i2c sensors provided in the sensorhub_config.c and returns the number of these sensors that are currently connected
sl_si91x_sensorhub_create_sensor(sl_sensor_id_t sensor_id): Initializes the sensor by calling the init function of the sensor provided by the user in the respective HAL, Assigs memory to it based on the data delivery mode, Creates a timer for this sensor if required
sl_si91x_sensor_hub_start(): initializes the sensor task, event task and power task
sl_si91x_sensorhub_start_sensor(sl_sensor_id_t sensor_id): starts the timers of the sensors created in create sensor api
sl_si91x_sensor_event_handler(uint8_t sensor_id, uint8_t event) is called by the event task after sensor data is collected ,in the sensorhub appilcation it prints the data based on the sensor id and uploads it to the cloud
Modules#
Enumerations#
Enumeration for Sensor HUB data reading mode.
Enumeration for Sensor Hub Callback Events.
Enumeration for GPIO Interrupt Configurations.
Enumeration for Sensor HUB data delivery mode.
Enumeration for Sensors Status.
Typedefs#
ADC bus interface configuration structure.
Functions#
To initialize Peripherals of Sensor HUB.
To detect the I2C sensors.
To delete specific sensor from the Sensor HUB list.
To create a sensor instance in the sensor hub list.
To start sensor operation of the given sensor.
To stop sensor operation of the given sensor.
To post the events to Event Manager (EM) to be notified to the application.
Task to handle the sensor operations.
Task to handle the system power operations.
Task to handle the operations of the Event Manager (EM).
To initialize the I2C interface based on configuration.
To initialize SPI Interface based on configuration.
To scan the I2C sensors.
To get sensor implementation.
To create sensor list index.
To get sensor index for the sensor list.
To delete the sensor index for the sensor list.
To get sensor info from the sensor configuration structure.
To register callback function to the application.
Callback function to set the event flag.
To configuring different types of NPSS GPIO interrupts in the Sensor HUB.
To enable and set the priority of NPSS GPIO interrupt.
To mask and disable the NPSS GPIO interrupt.
To start the sensor hub tasks.
To set the alarm interrupt time.
To initialize the Alarm block.
To configure wake-up source for the system.
To configures sleep/wakeup sources for the system.
To change the system status from PS4 to PS2.
To change the system status from PS2 to PS4.
To initialize ADC Interface based on configuration.
To initialize and configure systic timer for the RTOS.
I2C event handler.
To fetch ADC bus interface information.
ADC callback to set event flag.
To initialize sdc Interface based on the configuration.
Macros#
Sensor task stack size.
EM task stack size.
Power task stack size.
Max wait time of message queue in Event task.
Size of the sensors interrupt MAP table.
NPSS gpio IRQ handler.
NPSS gpio IRQ Number 21.
Periodic alarm configuration in milliseconds.
RC clock trigger time.
RO clock trigger time.
Number of hours in a day.
Number of minutes in an hour.
Number of Seconds in a minute.
Number of milliseconds in a second.
Number of months in a year.
Start year for alarm configuration.
Month with 28 days.
Month with 29 days.
Month with 30 days.
Month with 31 days.
Alarm IRQ handler.
Alarm IRQ number 28.
Creating OS timer for the sensor failed.
Deleting OS timer of the sensor failed.
Starting OS timer of the sensor failed.
Stopping OS timer of the sensor failed.
Max number of sensor limit reached.
Memory allocation for sensor data storage failed.
Sensor API is called for a sensor without creating it.
Sensor set power command execution failed.
Sensor set range command execution failed.
Sensor self-test command execution failed.
Generic error code for any invalid parameters.
Invalid gpio number.
No hal implementation found for given sensor type.
Interrupt type configuration failed.
Allocating memory for sensor hal failed.
Sensor not created.
Sensor configuration not found.
No sensor found at given address.
Invalid interrupt type is given for the sensor.
Invalid mode is given for the sensor.
Invalid delivery mode is given for the sensor.
Create sensor in HAL failed.
Delete sensor in HAL failed.
Sample sensor in HAL failed.
Control sensor in HAL failed.
Power task creation failed.
Sensor task creation failed.
EM task creation failed.
All(i2c,spi,adc) peripheral's initialization failed.
Enumeration Documentation#
sl_sensor_mode_t#
sl_sensor_mode_t
Enumeration for Sensor HUB data reading mode.
Enumerator | |
---|---|
SL_SH_POLLING_MODE | POLLING_MODE. |
SL_SH_INTERRUPT_MODE | INTERRUPT_MODE. |
SL_SH_NO_MODE | NO_MODE. |
105
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_sensorhub_event_t#
sl_sensorhub_event_t
Enumeration for Sensor Hub Callback Events.
This enumeration defines various events related to the operation of sensors within a Sensor Hub. The events represent different states and actions of the sensors, such as creation, starting, stopping, and data readiness.
Enumerator | |
---|---|
SL_SENSOR_CREATION_FAILED | Event indicating that sensor creation failed. |
SL_SENSOR_STARTED | Event indicating that the sensor has started successfully. |
SL_SENSOR_STOPPED | Event indicating that the sensor has stopped. |
SL_SENSOR_DATA_READY | Event indicating that sensor data is ready to be read. |
SL_SENSOR_CNFG_INVALID | Event indicating that the sensor configuration is invalid. |
SL_SENSOR_START_FAILED | Event indicating that the sensor failed to start. |
SL_SENSOR_STOP_FAILED | Event indicating that the sensor failed to stop. |
SL_SENSOR_DELETED | Event indicating that the sensor has been deleted. |
SL_SENSOR_DELETE_FAILED | Event indicating that the sensor deletion failed. |
118
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_gpio_intr_type_t#
sl_gpio_intr_type_t
Enumeration for GPIO Interrupt Configurations.
Enumerator | |
---|---|
SL_SH_RISE_EDGE | Interrupt at GPIO rise edge. |
SL_SH_FALL_EDGE | Interrupt at GPIO fall edge. |
SL_SH_LOW_LEVEL | Interrupt at GPIO low level. |
SL_SH_HIGH_LEVEL | Interrupt at GPIO high level. |
133
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_data_deliver_mode_t#
sl_data_deliver_mode_t
Enumeration for Sensor HUB data delivery mode.
Enumerator | |
---|---|
SL_SH_THRESHOLD | Threshold value for sensor data delivery. |
SL_SH_TIMEOUT | Timeout value for sensor data delivery. |
SL_SH_NUM_OF_SAMPLES | Number of samples for sensor data delivery. |
SL_SH_NO_DATA_MODE | Intterupt mode data delivery. |
143
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_sensor_status_t#
sl_sensor_status_t
Enumeration for Sensors Status.
Enumerator | |
---|---|
SL_SENSOR_INVALID | Sensor is Invalid. |
SL_SENSOR_VALID | Sensor is Valid. |
SL_SENSOR_START | Sensor has Started. |
SL_SENSOR_STOP | Sensor has Stoped. |
153
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
Typedef Documentation#
sl_adc_cfg_t#
typedef struct sl_adc_config sl_adc_cfg_t
ADC bus interface configuration structure.
314
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
Function Documentation#
sl_si91x_sensorhub_init#
sl_status_t sl_si91x_sensorhub_init ()
To initialize Peripherals of Sensor HUB.
This function will initialize the Peripherals like I2C/SPI/ADC, based on the user configuration.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, peripherals initialization was done properly.
SL_STATUS_FAIL - Failed, peripherals initialization failed.
SL_ALL_PERIPHERALS_INIT_FAILED , All peripherals initializaion failed.
For more information on status codes, see SL STATUS DOCUMENTATION.
376
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_detect_sensors#
sl_status_t sl_si91x_sensorhub_detect_sensors (sl_sensor_id_t sensor_id_info, uint8_t num_of_sensors)
To detect the I2C sensors.
[in] | sensor_id_info | - Sensor IDs. |
[in] | num_of_sensors | - Number of sensors given by user. |
This function detects I2C sensors according to user configuration and stores the scanned sensor IDs in the provided structure. Returns
Number of sensors scanned, if successful.
SL_STATUS_FAIL - No sensors found. For more information on status codes, see SL STATUS DOCUMENTATION.
388
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_delete_sensor#
sl_status_t sl_si91x_sensorhub_delete_sensor (sl_sensor_id_t sensor_id)
To delete specific sensor from the Sensor HUB list.
[in] | sensor_id | - Sensor ID. |
This function will delete the specific sensor from the sensor list, modify the sensor status to invalid, and publish the events to the event task.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, delete sensor success.
SL_SH_TIMER_DELETION_FAILED - Timer deletion failed.
SL_SH_COMMAND_SET_POWER_FAIL - Set power failed.
SL_SH_HAL_SENSOR_DELETION_FAILED - Sensor deletion failed at HAL layer.
SL_SH_SENSOR_INDEX_NOT_FOUND - Given sensor index not found.
For more information on status codes, see SL STATUS DOCUMENTATION.
408
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_create_sensor#
sl_status_t sl_si91x_sensorhub_create_sensor (sl_sensor_id_t sensor_id)
To create a sensor instance in the sensor hub list.
[in] | sensor_id | - Sensor ID. |
This function creates a sensor instance as per user configuration. It also allocates max sample memory for the configured sensor.
Returns
Status code indicating the result:
SL_STATUS_OK - Create sensor instance success.
SL_SH_TIMER_CREATION_FAILED - Timer creation for the sensor failed.
SL_SH_MAX_SENSORS_REACHED - Maximum number of sensors reached.
SL_SH_MEMORY_LIMIT_EXCEEDED - Memory limit exceeded.
SL_SH_COMMAND_SET_POWER_FAIL - Command to set power failed.
SL_SH_COMMAND_SET_RANGE_FAIL - Command to set range failed.
SL_SH_COMMAND_SELF_TEST_FAIL - Command for the self test failed.
SL_SH_SENSOR_IMPLEMENTATION_NOT_FOUND - Implementation of the sensor not found.
SL_SH_CONFIG_NOT_FOUND - Configuration of the sensor not found.
SL_SH_INVALID_MODE - Invalid mode.
SL_SH_HAL_SENSOR_CREATION_FAILED - Sensor creation failed at HAL. For more information on status codes, see SL STATUS DOCUMENTATION.
432
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_start_sensor#
sl_status_t sl_si91x_sensorhub_start_sensor (sl_sensor_id_t sensor_id)
To start sensor operation of the given sensor.
[in] | sensor_id | - Sensor ID. |
This function can be called after creating a sensor with given sensor ID It performs the following operations:
Starts timer for sensor with polling mode.
Enable IRQ handle for sensor with interrupt mode.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, sensor started.
SL_SH_TIMER_START_FAIL - Failed to start timer.
SL_SH_SENSOR_CREATE_FAIL - Given sensor not created.
SL_SH_INVALID_MODE - Invaild mode given.
For more information on status codes, see SL STATUS DOCUMENTATION.
453
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_stop_sensor#
sl_status_t sl_si91x_sensorhub_stop_sensor (sl_sensor_id_t sensor_id)
To stop sensor operation of the given sensor.
[in] | sensor_id | - Sensor ID. |
This function performs the following operations:
Stop the sensor operations of the given sensor.
Based on the sensor mode it will stop the polling/interrupt mode operations and updates the sensor statutes.
Disable IRQ handles of the interrupt mode sensors.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, sensor stopped.
SL_SH_TIMER_STOP_FAIL - Failed to stop timer.
SL_SH_SENSOR_CREATE_FAIL - Given sensor not created.
For more information on status codes, see SL STATUS DOCUMENTATION.
473
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_em_post_event#
void sl_si91x_em_post_event (sl_sensor_id_t sensor_id, sl_sensorhub_event_t event, void * dataPtr, TickType_t ticks_to_wait)
To post the events to Event Manager (EM) to be notified to the application.
[in] | sensor_id | - Sensor ID. |
[in] | event | - Sensor hub events. |
[in] | dataPtr | - Sensor data pointer. |
[in] | ticks_to_wait | - Max time to wait for the post. |
It waits for mutex till ticks_to_wait and updates event queue if mutex is acquired
487
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensor_task#
void sl_si91x_sensor_task (void )
Task to handle the sensor operations.
N/A |
Sensor Task performs the following operations:
Create the OS event and mutex to perform the sensor operations.
Sample the sensor data based on the event flags.
Check the events and post the sensor data to the EM task based on the sensor data delivery mode.
502
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_power_state_task#
void sl_si91x_power_state_task (void )
Task to handle the system power operations.
N/A |
Power state task changes the system from one power save mode to another power save mode like(PS4 to PS2),(PS2toPS4),(Sleep_mode) using Binary semaphore.
511
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_em_task#
void sl_si91x_em_task (void )
Task to handle the operations of the Event Manager (EM).
N/A |
EM task performs the following operations:
Create the osMessageQueue and mutex to perform the event operations.
Calls the callback event.
522
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_i2c_init#
int32_t sli_si91x_i2c_init (void )
To initialize the I2C interface based on configuration.
N/A |
This function will configure/Initialize I2C Interface based on configuration.
Returns
I2C Initializtion status
533
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_spi_init#
int32_t sli_si91x_spi_init (void )
To initialize SPI Interface based on configuration.
N/A |
This function will configure/Initialize SPI Interface based on configuration.
Returns
SPI Initializtion status.
544
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_i2c_sensors_scan#
int32_t sli_si91x_i2c_sensors_scan (uint16_t address)
To scan the I2C sensors.
[in] | address | - Address of sensor |
This function will scan the I2C sensors based on the sensor address.
Returns
Status 0 if successful; otherwise, it will wait for the sensor response.
556
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_get_sensor_implementation#
sl_sensor_impl_type_t * sli_si91x_get_sensor_implementation (int32_t sensor_id)
To get sensor implementation.
[in] | sensor_id | - Sensor ID. |
This function will get the sensor implementation of the sensor based on sensor ID.
Returns
If successful, it returns the Sensor implementation structure. Otherwise, it returns NULL.
569
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_create_sensor_list_index#
int32_t sli_si91x_create_sensor_list_index ()
To create sensor list index.
This function will create the sensor list index based on the sensor status For the maximum sensors available in the sensor hub
Returns
Returns the sensor index in sensor_list.
581
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_get_sensor_index#
uint32_t sli_si91x_get_sensor_index (sl_sensor_id_t sensor_id)
To get sensor index for the sensor list.
[in] | sensor_id | - Sensor ID. |
This function will retrieve the sensor index from the sensor list based on the sensor status and sensor ID for the maximum number of sensors available in the sensor hub.
Returns
If successful, it returns the sensor index. Otherwise, it returns - SL_SH_SENSOR_INDEX_NOT_FOUND.
596
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_delete_sensor_list_index#
uint32_t sli_si91x_delete_sensor_list_index (sl_sensor_id_t sensor_id)
To delete the sensor index for the sensor list.
[in] | sensor_id | - Sensor ID. |
This function will delete the sensor from the sensor list based on the sensor ID for the maximum number of sensors available in the sensor hub.
Returns
If successful, it returns the sensor index. Otherwise, it returns error code - SL_SH_SENSOR_INDEX_NOT_FOUND.
610
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_get_sensor_info#
sl_sensor_info_t * sli_si91x_get_sensor_info (sl_sensor_id_t sensor_id)
To get sensor info from the sensor configuration structure.
[in] | sensor_id | - Sensor ID. |
This function will retrieve sensor data from the sensor configuration structure to update the sensor list configuration structure for the maximum number of sensors available in the sensor hub.
Returns
If successful, it returns the sensor information. Otherwise, it returns NULL.
625
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensorhub_notify_cb_register#
sl_status_t sl_si91x_sensorhub_notify_cb_register (sl_sensor_signalEvent_t cb_event, sl_sensor_id_t * cb_ack)
To register callback function to the application.
[in] | cb_event | - Pointer to the callback event. |
[in] | cb_ack | - Pointer to callback acknowledge to the application. |
This function will update the callback function event and acknowledgment.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, callback registered.
SL_SH_INVALID_PARAMETERS - Invalid parameters.
For more information on status codes, see SL STATUS DOCUMENTATION.
641
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensors_timer_cb#
void sl_si91x_sensors_timer_cb (TimerHandle_t xTimer)
Callback function to set the event flag.
[in] | xTimer | - Timer handle. |
This function will set the event flag bits based on the sensor sampling intervals. In the polling mode call the timer call-back function.
653
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_gpio_interrupt_config#
sl_status_t sl_si91x_gpio_interrupt_config (uint16_t gpio_pin, sl_si91x_gpio_interrupt_config_flag_t intr_type)
To configuring different types of NPSS GPIO interrupts in the Sensor HUB.
[in] | gpio_pin | - NPSS GPIO pin number. |
[in] | intr_type | - NPSS GPIO interrupt type. |
This function configures the NPSS GPIOs and enables the interrupt mode for the gpios.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, interrupt configured.
SL_SH_INTERRUPT_TYPE_CONFIG_FAIL - Invaild interrupt type.
For more information on status codes, see SL STATUS DOCUMENTATION.
669
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_gpio_interrupt_start#
void sl_si91x_gpio_interrupt_start (uint16_t gpio_pin)
To enable and set the priority of NPSS GPIO interrupt.
[in] | gpio_pin | - NPSS GPIO pin number. |
This function configures and sets the priority of the NPSS GPIO interrupt. GPIO interrupt priority is (configMAX_SYSCALL_INTERRUPT_PRIORITY - 1)
681
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_gpio_interrupt_stop#
void sl_si91x_gpio_interrupt_stop (uint16_t gpio_pin)
To mask and disable the NPSS GPIO interrupt.
[in] | gpio_pin | - NPSS GPIO pin number. |
This function masks and disables the IRQ handler of the NPSS GPIO interrupt.
692
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_sensor_hub_start#
sl_status_t sl_si91x_sensor_hub_start (void )
To start the sensor hub tasks.
N/A |
This Starts the sensor hub Tasks.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, sensorhub started.
SL_SH_POWER_TASK_CREATION_FAILED - Failed to create power task.
SL_SH_SENSOR_TASK_CREATION_FAILED - Failed to create sensor task.
SL_SH_EM_TASK_CREATION_FAILED - Failed to create EM task.
For more information on status codes, see SL STATUS DOCUMENTATION.
708
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_set_alarm_intr_time#
void sli_si91x_set_alarm_intr_time (uint16_t interval)
To set the alarm interrupt time.
[in] | interval | - interval time |
This function will set the alarm interrupt based on the periodic time.
719
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_init_m4alarm_config#
void sli_si91x_init_m4alarm_config (void )
To initialize the Alarm block.
N/A |
This function will initialize the Alarm block.
729
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_config_wakeup_source#
void sli_si91x_config_wakeup_source (uint16_t sleep_time)
To configure wake-up source for the system.
[in] | sleep_time | - Sleep time for the sensor hub. |
This function will configure the wake-up source to the system.
740
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_sleep_wakeup#
void sli_si91x_sleep_wakeup (uint16_t sh_sleep_time)
To configures sleep/wakeup sources for the system.
[in] | sh_sleep_time | - Sleep time for the sensor hub, in ADC PS-1 no parameters. |
This function will configure sleep/wakeup sources.
754
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_sensorhub_ps4tops2_state#
void sli_si91x_sensorhub_ps4tops2_state (void )
To change the system status from PS4 to PS2.
N/A |
This function will change the system status from PS4 to PS2.
763
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_sensorhub_ps2tops4_state#
void sli_si91x_sensorhub_ps2tops4_state (void )
To change the system status from PS2 to PS4.
N/A |
This function will change the system status from PS2 to PS4.
772
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_adc_init#
sl_status_t sli_si91x_adc_init (void )
To initialize ADC Interface based on configuration.
N/A |
This function will configure/Initialize ADC Interface based on configuration.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, ADC initialized.
SL_STATUS_FAIL - Failed to initialize ADC .
For more information on status codes, see SL STATUS DOCUMENTATION.
786
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
vPortSetupTimerInterrupt#
void vPortSetupTimerInterrupt (void )
To initialize and configure systic timer for the RTOS.
N/A |
Set up the systic timer to generate the tick interrupts at the required frequency.
795
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
ARM_I2C_SignalEvent#
void ARM_I2C_SignalEvent (uint32_t event)
I2C event handler.
[in] | event | - I2C transmit and receive events. |
803
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_fetch_adc_bus_intf_info#
sl_adc_cfg_t * sl_si91x_fetch_adc_bus_intf_info (void )
To fetch ADC bus interface information.
N/A |
This can be used by lower level layers. Returns
Pointer to ADC configuration structure.
811
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sl_si91x_adc_callback#
void sl_si91x_adc_callback (uint8_t channel_no, uint8_t event)
ADC callback to set event flag.
[in] | channel_no | - Respective channel number. |
[in] | event | - Callback event (ADC_STATIC_MODE_CALLBACK, ADC_THRSHOLD_CALLBACK, INTERNAL_DMA, FIFO_MODE_EVENT). |
This callback function is called when ADC event occured and it sets event flag corresponding to that event
822
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
sli_si91x_sdc_init#
sl_status_t sli_si91x_sdc_init (void )
To initialize sdc Interface based on the configuration.
N/A |
Returns
Returns status 0 if successful. Otherwise, it returns an error code.
SL_STATUS_FAIL - Fail.
SL_STATUS_OK - Success.
For more information on status codes, see SL STATUS DOCUMENTATION.
833
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
Macro Definition Documentation#
SL_SH_SENSOR_TASK_STACK_SIZE#
#define SL_SH_SENSOR_TASK_STACK_SIZEValue:
(1024 * 2)
Sensor task stack size.
56
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
SL_SH_EM_TASK_STACK_SIZE#
#define SL_SH_EM_TASK_STACK_SIZEValue:
(512 * 2)
EM task stack size.
57
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
SL_SH_POWER_SAVE_TASK_STACK_SIZE#
#define SL_SH_POWER_SAVE_TASK_STACK_SIZEValue:
(512 * 2)
Power task stack size.
58
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
SL_EM_TASK_RUN_TICKS#
#define SL_EM_TASK_RUN_TICKSValue:
osWaitForever
Max wait time of message queue in Event task.
59
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
MAP_TABLE_SIZE#
#define MAP_TABLE_SIZEValue:
10
Size of the sensors interrupt MAP table.
60
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NPSS_GPIO_IRQHandler#
#define NPSS_GPIO_IRQHandlerValue:
IRQ021_Handler
NPSS gpio IRQ handler.
65
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NPSS_GPIO_NVIC#
#define NPSS_GPIO_NVICValue:
NPSS_TO_MCU_GPIO_INTR_IRQn
NPSS gpio IRQ Number 21.
66
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
SL_ALARM_PERIODIC_TIME#
#define SL_ALARM_PERIODIC_TIMEValue:
10
Periodic alarm configuration in milliseconds.
71
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
RC_TRIGGER_TIME#
#define RC_TRIGGER_TIMEValue:
5
RC clock trigger time.
72
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
RO_TRIGGER_TIME#
#define RO_TRIGGER_TIMEValue:
0
RO clock trigger time.
73
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_HOURS_IN_A_DAY#
#define NO_OF_HOURS_IN_A_DAYValue:
24
Number of hours in a day.
74
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_MINUTES_IN_AN_HOUR#
#define NO_OF_MINUTES_IN_AN_HOURValue:
60
Number of minutes in an hour.
75
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_SECONDS_IN_A_MINUTE#
#define NO_OF_SECONDS_IN_A_MINUTEValue:
60
Number of Seconds in a minute.
76
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_MILLISECONDS_IN_A_SECOND#
#define NO_OF_MILLISECONDS_IN_A_SECONDValue:
1000
Number of milliseconds in a second.
77
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_MONTHS_IN_A_YEAR#
#define NO_OF_MONTHS_IN_A_YEARValue:
12
Number of months in a year.
78
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
BASE_YEAR#
#define BASE_YEARValue:
2000
Start year for alarm configuration.
79
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_DAYS_IN_A_MONTH_1#
#define NO_OF_DAYS_IN_A_MONTH_1Value:
28
Month with 28 days.
80
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_DAYS_IN_A_MONTH_2#
#define NO_OF_DAYS_IN_A_MONTH_2Value:
29
Month with 29 days.
81
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_DAYS_IN_A_MONTH_3#
#define NO_OF_DAYS_IN_A_MONTH_3Value:
30
Month with 30 days.
82
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NO_OF_DAYS_IN_A_MONTH_4#
#define NO_OF_DAYS_IN_A_MONTH_4Value:
31
Month with 31 days.
83
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
RTC_ALARM_IRQHandler#
#define RTC_ALARM_IRQHandlerValue:
IRQ028_Handler
Alarm IRQ handler.
88
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
NVIC_RTC_ALARM#
#define NVIC_RTC_ALARMValue:
MCU_CAL_ALARM_IRQn
Alarm IRQ number 28.
89
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensor_hub.h
SL_SH_TIMER_CREATION_FAILED#
#define SL_SH_TIMER_CREATION_FAILEDValue:
(1 << SL_SH_SENSORHUB_ERRORS_MASK)
Creating OS timer for the sensor failed.
52
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_TIMER_DELETION_FAILED#
#define SL_SH_TIMER_DELETION_FAILEDValue:
(2 << SL_SH_SENSORHUB_ERRORS_MASK)
Deleting OS timer of the sensor failed.
53
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_TIMER_START_FAIL#
#define SL_SH_TIMER_START_FAILValue:
(3 << SL_SH_SENSORHUB_ERRORS_MASK)
Starting OS timer of the sensor failed.
54
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_TIMER_STOP_FAIL#
#define SL_SH_TIMER_STOP_FAILValue:
(4 << SL_SH_SENSORHUB_ERRORS_MASK)
Stopping OS timer of the sensor failed.
55
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_MAX_SENSORS_REACHED#
#define SL_SH_MAX_SENSORS_REACHEDValue:
(5 << SL_SH_SENSORHUB_ERRORS_MASK)
Max number of sensor limit reached.
59
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_MEMORY_LIMIT_EXCEEDED#
#define SL_SH_MEMORY_LIMIT_EXCEEDEDValue:
(6 << SL_SH_SENSORHUB_ERRORS_MASK)
Memory allocation for sensor data storage failed.
60
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_SENSOR_CREATE_FAIL#
#define SL_SH_SENSOR_CREATE_FAILValue:
(7 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor API is called for a sensor without creating it.
62
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_COMMAND_SET_POWER_FAIL#
#define SL_SH_COMMAND_SET_POWER_FAILValue:
(8 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor set power command execution failed.
64
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_COMMAND_SET_RANGE_FAIL#
#define SL_SH_COMMAND_SET_RANGE_FAILValue:
(9 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor set range command execution failed.
65
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_COMMAND_SELF_TEST_FAIL#
#define SL_SH_COMMAND_SELF_TEST_FAILValue:
(10 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor self-test command execution failed.
66
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_INVALID_PARAMETERS#
#define SL_SH_INVALID_PARAMETERSValue:
(11 << SL_SH_SENSORHUB_ERRORS_MASK)
Generic error code for any invalid parameters.
67
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_GPIO_OUT_OF_RANGE#
#define SL_SH_GPIO_OUT_OF_RANGEValue:
(12 << SL_SH_SENSORHUB_ERRORS_MASK)
Invalid gpio number.
68
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_SENSOR_IMPLEMENTATION_NOT_FOUND#
#define SL_SH_SENSOR_IMPLEMENTATION_NOT_FOUNDValue:
(13 << SL_SH_SENSORHUB_ERRORS_MASK)
No hal implementation found for given sensor type.
69
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_INTERRUPT_TYPE_CONFIG_FAIL#
#define SL_SH_INTERRUPT_TYPE_CONFIG_FAILValue:
(14 << SL_SH_SENSORHUB_ERRORS_MASK)
Interrupt type configuration failed.
71
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_MEMORY_ALLOCATION_FAILED#
#define SL_SH_MEMORY_ALLOCATION_FAILEDValue:
(15 << SL_SH_SENSORHUB_ERRORS_MASK)
Allocating memory for sensor hal failed.
72
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_SENSOR_INDEX_NOT_FOUND#
#define SL_SH_SENSOR_INDEX_NOT_FOUNDValue:
(0xFF)
Sensor not created.
73
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_CONFIG_NOT_FOUND#
#define SL_SH_CONFIG_NOT_FOUNDValue:
(16 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor configuration not found.
77
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_INVALID_ADDRESS#
#define SL_SH_INVALID_ADDRESSValue:
(17 << SL_SH_SENSORHUB_ERRORS_MASK)
No sensor found at given address.
78
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_WRONG_INTERRUPT_TYPE#
#define SL_SH_WRONG_INTERRUPT_TYPEValue:
(18 << SL_SH_SENSORHUB_ERRORS_MASK)
Invalid interrupt type is given for the sensor.
79
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_INVALID_MODE#
#define SL_SH_INVALID_MODEValue:
(19 << SL_SH_SENSORHUB_ERRORS_MASK)
Invalid mode is given for the sensor.
81
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_INVALID_DELIVERY_MODE#
#define SL_SH_INVALID_DELIVERY_MODEValue:
(20 << SL_SH_SENSORHUB_ERRORS_MASK)
Invalid delivery mode is given for the sensor.
82
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_HAL_SENSOR_CREATION_FAILED#
#define SL_SH_HAL_SENSOR_CREATION_FAILEDValue:
(21 << SL_SH_SENSORHUB_ERRORS_MASK)
Create sensor in HAL failed.
87
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_HAL_SENSOR_DELETION_FAILED#
#define SL_SH_HAL_SENSOR_DELETION_FAILEDValue:
(22 << SL_SH_SENSORHUB_ERRORS_MASK)
Delete sensor in HAL failed.
88
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_HAL_SENSOR_SAMPLE_FAIL#
#define SL_SH_HAL_SENSOR_SAMPLE_FAILValue:
(23 << SL_SH_SENSORHUB_ERRORS_MASK)
Sample sensor in HAL failed.
89
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_HAL_SENSOR_CONTROL_FAIL#
#define SL_SH_HAL_SENSOR_CONTROL_FAILValue:
(24 << SL_SH_SENSORHUB_ERRORS_MASK)
Control sensor in HAL failed.
90
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_POWER_TASK_CREATION_FAILED#
#define SL_SH_POWER_TASK_CREATION_FAILEDValue:
(25 << SL_SH_SENSORHUB_ERRORS_MASK)
Power task creation failed.
94
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_SENSOR_TASK_CREATION_FAILED#
#define SL_SH_SENSOR_TASK_CREATION_FAILEDValue:
(26 << SL_SH_SENSORHUB_ERRORS_MASK)
Sensor task creation failed.
95
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_SH_EM_TASK_CREATION_FAILED#
#define SL_SH_EM_TASK_CREATION_FAILEDValue:
(27 << SL_SH_SENSORHUB_ERRORS_MASK)
EM task creation failed.
96
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h
SL_ALL_PERIPHERALS_INIT_FAILED#
#define SL_ALL_PERIPHERALS_INIT_FAILEDValue:
(28 << SL_SH_SENSORHUB_ERRORS_MASK)
All(i2c,spi,adc) peripheral's initialization failed.
97
of file components/device/silabs/si91x/mcu/drivers/service/sensorhub/inc/sensorhub_error_codes.h