BOD#

Introduction#

  • Brown-Out Detector (BOD) is a hardware module designed to monitor the supply voltage of the system. It ensures that the system operates within safe voltage levels by detecting voltage drops below a defined threshold. When a brown-out condition is detected, the BOD can trigger an interrupt or reset the system to prevent malfunction.

  • Blackout Monitoring is a feature that enables the BOD to reset the system during Active/Sleep mode when the supply voltage drops less then ~1.65v to VMCU.

Common use cases for BOD include:

  • Voltage Monitoring: Ensuring the supply voltage remains within safe operating limits.

  • System Reset: Resetting the system during unsafe voltage (voltage drops less then ~1.65v to VMCU) conditions to prevent damage or malfunction.

  • Interrupt Generation: Notifying the system of voltage drops via interrupts.

Configuration#

The BOD module offers several configurable parameters, such as:

  • Threshold Voltage: Specifies the voltage level at which the BOD will trigger an interrupt or system reset.

  • Slot Value: Specifies the number of inactive (empty) slots inserted between two active comparator sampling slots. Each empty slot corresponds to 6 cycles of the 32KHz (ulp_fsm_clk), determining the interval between consecutive active sampling events. Configuring the slot value allows you to adjust the timing and frequency of BOD checks, which can help balance synchronization requirements and power consumption. Each slot defines a time interval based on 6 cycles of the 32KHz (ulp_fsm_clk).

  • Slots are used to control the timing between active operations, supporting proper synchronization and improved power efficiency.

    • For example, if cmp_slot_value is programmed as 2, there will be 2 empty slots between active slots, each consisting of 6 cycles.

  • Blackout Enable: Enabling or disabling blackout reset functionality.

These configurations are encapsulated in the sl_bod_uc_param_t structure and initialized using the respective BOD APIs.

For more details on configuration parameters, see the respective peripheral example readme document.

Usage#

After defining the BOD configuration structures and passing an instance of sl_bod_uc_param_t, the following functions can be used to initiate and configure the BOD module. The typical flow for implementation is as follows:

  1. Initialize the BOD module: sl_si91x_bod_init

  2. Register a callback for BOD interrupts: sl_si91x_bod_register_callback

  3. Set the voltage threshold: sl_si91x_bod_set_threshold

  4. Set the BOD configuration parameters sl_si91x_bod_set_configuration.

  5. Get the calibrated threshold value sl_si91x_bod_get_threshold (Optional)

  6. Enable BOD interrupt: sl_si91x_bod_enable_interrupt

  7. Monitor battery status: sl_si91x_bod_get_battery_status

  8. Clear BOD interrupt: sl_si91x_bod_clear_interrupt

  9. Deinitialize the BOD module: sl_si91x_bod_deinit

APIs#

The following APIs are available for configuring and using the BOD module:

Example#

Below is an example of how to configure and use the BOD module:

#include "sl_si91x_bod.h"

void bod_callback(void) {
  // Handle BOD interrupt
}

int main(void) {
  sl_status_t status;
  sl_bod_uc_param_t bod_config = {
    .slot_value = 2,
    .blackout_en = SL_ENABLE,
  };

  // Initialize the BOD module
  status = sl_si91x_bod_init();
  if (status != SL_STATUS_OK) {
    // Handle initialization error
  }

  // Configure the slot value
  status = sl_si91x_bod_config_slot_value(2);
  if (status != SL_STATUS_OK) {
    // Handle slot value configuration error
  }

  // Set the voltage threshold
  status = sl_si91x_bod_set_threshold(2.5f);
  if (status != SL_STATUS_OK) {
    // Handle threshold setting error
  }

  // Register a callback for BOD interrupts
  status = sl_si91x_bod_register_callback(bod_callback);
  if (status != SL_STATUS_OK) {
    // Handle callback registration error
  }

  // Enable BOD interrupt
  sl_si91x_bod_enable_interrupt();

  while (1) {
    // Main loop
  }

  return 0;
}

Notes#

  • Ensure that the BOD module is properly initialized before using any other BOD APIs.

  • The voltage threshold must be within the range defined by SL_BOD_MIN_THRESHOLD and SL_BOD_MAX_THRESHOLD.

  • Use the blackout reset functionality to protect the system from unexpected power failures.

Modules#

sl_bod_button_uc_config_param_t

sl_bod_uc_param_t

Typedefs#

typedef void(*

BOD callback function type.

typedef void(*

Button callback function type.

typedef uint8_t

Button enable type.

Functions#

sl_status_t
sl_si91x_bod_set_mode(uint8_t mode)

Set the BOD mode.

sl_status_t
sl_si91x_bod_config_slot_value(uint16_t slot_value)

Configure the slot value for BOD.

sl_status_t

Initialize the BOD module.

sl_status_t

Deinitialize the BOD module.

sl_status_t
sl_si91x_bod_get_threshold(float *vbatt_threshold)

Get the BOD threshold value.

void
sl_si91x_bod_NVIC_enable_irq(void) SL_DEPRECATED_API_WISECONNECT_3_5

Enable the BOD interrupt in the NVIC.

en_t

sl_si91x_bod_get_blackout_status

sl_status_t
sl_si91x_bod_set_configuration(sl_bod_uc_param_t usr_config_params)

Set the BOD configuration.

void
sl_si91x_bod_button_configuration(uint16_t button_max_value, uint16_t button1_min_value, uint16_t button2_min_value, uint16_t button3_min_value)

Configures the BOD (Brown-Out Detector) button values.

sl_status_t

Disables the button wakeup functionality for the BOD (Brown-Out Detector).

void
sl_si91x_bod_button_wakeup_enable(uint8_t enable) SL_DEPRECATED_API_WISECONNECT_3_5

Enable or disable button wakeup functionality for the BOD (Brown-Out Detector).

sl_status_t
sl_si91x_bod_button_wakeup_enable_v2(boolean_t bod_button_enable)

Enable button wakeup functionality for the BOD (Brown-Out Detector).

sl_status_t
sl_si91x_bod_register_callback(bod_callback_t callback)

Register a callback function for BOD interrupts.

sl_status_t
sl_si91x_bod_button_register_callback(bod_button_callback_t callback)

Register a callback function for BOD button interrupts.

void

Unregister the callback function for BOD interrupts.

sl_status_t
sl_si91x_bod_get_battery_status(float *battery_status)

Get the current battery status.

sl_status_t

Set the BOD voltage threshold.

void

Enable BOD interrupt.

void

Enable the interrupt for the BOD (Brown-Out Detection) button.

void

Disable BOD interrupt.

void

Disable the interrupt for the BOD button.

void

Clear BOD interrupt.

uint8_t

Read the value of the BOD button.

void

Clear the BOD button interrupt.

sl_status_t
sl_si91x_bod_button_set_configuration(sl_bod_button_uc_config_param_t uc_config_param, uint8_t *button_max_value, uint8_t *button_1_min_value, uint8_t *button_2_min_value, uint8_t *button_3_min_value)

Configure the voltage percentage thresholds for the BOD buttons.

sl_status_t
sl_si91x_bod_battery_percentage(float voltage, float *vbat_per)

Calculate the battery percentage based on the given voltage.

void

Controls the Black Out Monitor reset functionality.

void

Clears the BOD (Brown-Out Detector) button interrupt.

void

Enable the blackout reset in sleep mode.

void

Disable the blackout reset in sleep mode.

Macros#

#define
BOD_IRQ_Handler IRQ023_Handler

BOD interrupt handler.

#define
SL_BGSAMPLE (*(volatile uint32_t *)(0x24048140))

Define the SL_BGSAMPLE register address.

#define
SL_BOD_CLOCK_DIVISON_FACTOR (*(volatile uint32_t *)(0x24050000) & 0xF)

Define BOD clock division factor and ULP processor clock selection.

#define
SL_BOD_ULP_PROC_CLK_SEL (*(volatile uint32_t *)(0x24041414) & 0x1E)

Define ULP processor clock selection.

#define
SL_NPSS_GPIO_2_ANALOG_MODE (*(volatile uint32_t *)0x24048624)

NPSS GPIO 2 analog mode.

#define
SL_NPSS_GPIO_2_ANALOG_MODE_VALUE 0x7

NPSS GPIO 2 analog mode value.

#define
SL_BOD_ENABLE_SIGNAL BIT(16)

Enable signal for bod detection.

#define
SL_SCDC_IN_LP_MODE_EN BIT(0)

SCDC in LP mode Bit.

#define
SL_ZERO_VAL 0x00

Zero Value define.

#define
SL_BUTTON_RANGE_VALUE_CLR 0x3

Button range value clear mask.

#define
SL_BOD_MANUAL_MODE 1

Manual mode selection.

#define
SL_BOD_AUTOMATIC_MODE 0

Automatic mode selection.

#define
SL_ENABLE 1

Enable flag.

#define
SL_DISABLE 0

Disable flag.

#define
SL_BOD_MIN_THRESHOLD 1.75f

Minimum BOD threshold value.

#define
SL_BOD_MAX_THRESHOLD 3.65f

Maximum BOD threshold value.

#define
SL_NVIC_BOD NPSS_TO_MCU_BOD_INTR_IRQn

NVIC BOD interrupt number.

#define
SL_AUTOMATIC_BOD 1

Automatic BOD mode.

#define
SL_BOD_MAX_MODE_VALUE 2

Maximum mode value.

#define
SL_BOD_THRESHOLD_OFFSET_VALUE 0.5

Threshold offset value.

#define
SL_BOD_THRESHOLD_ROUNDUP_VALUE 1

Threshold roundup value.

#define
SL_BOD_MANUAL_CMP_MUX_SEL_BUTTON_CLR 0xE0000

Manual comparator multiplexer selection button clear mask.

#define
SL_BOD_MANUAL_CMP_MUX_SEL_BUTTON_VALUE 0xA0000

Manual comparator multiplexer selection button value.

#define
BOD_TEST_SEL_BITS_CLR 0x180000

BOD test selection bits clear mask.

#define
SL_BOD_BATTERY_STATUS_MAX 38

Maximum battery status value.

#define
SL_BOD_VBATT_COMPUT_FIRST_ELEMENT 3.3f

BOD VBATT computation first element.

#define
SL_BOD_VBATT_COMPUT_SECOND_ELEMENT 34.814f

BOD VBATT computation second element.

#define
SL_BOD_VBATT_COMPUT_THIRD_ELEMENT 31

BOD VBATT computation third element.

#define
SL_BOD_SLOT_MAX_VALUE 65535

Slot maximum value.

#define
SL_BOD_SLOT_MIN_VALUE 2

Slot minimum value.

#define
SL_BOD_CLEAR_BATTERY_STATUS_BITS_EFUSE 0x3FFFFF

BOD clear battery status bits in EFUSE mask.

#define
SL_BOD_MAX_BATTERY_VOLTAGE 3.3f

Maximum battery voltage for Brown-Out Detector (BOD)

#define
SL_BOD_MIN_BATTERY_VOLTAGE 1.6f

Minimum battery voltage for Brown-Out Detector (BOD)

#define
SL_BOD_NVIC_BUTTON NPSS_TO_MCU_BUTTON_INTR_IRQn

BOD NVIC button interrupt.

#define
SL_BOD_NPSS_TO_MCU_BUTTON_IRQHandler IRQ024_Handler

BOD NPSS to MCU button interrupt handler.

#define
SL_BOD_CMP_MUX_SEL_EN 4

BOD comparator multiplexer selection enable value.

#define
SL_BOD_MAX_BUFF_SIZE 39

Maximum buffer size for BOD array.

#define
SL_BOD_MIN_BUFF_SIZE 0

Minimum buffer size for BOD array.

#define
SL_BOD_VBATT_STATUS_MIN 0.0f

Minimum VBATT status value.

#define
SL_BOD_BUTTON_ONE 1

BOD button one.

#define
SL_BOD_BUTTON_TWO 2

BOD button two.

#define
SL_BOD_BUTTON_THREE 3

BOD button three.

#define
SL_BOD_BUTTON_TOTAL_NUM_OF_BUTTONS 3

Total number of buttons can configured.

#define
SL_BOD_BUTTON_MIN_VAL 1.08f

BOD button minimum value.

#define
SL_BOD_BUTTON_MAX_VAL 2.27f

BOD button maximum value.

#define
SL_STATUS_BOD_NOT_ENABLED ((sl_status_t)0x0C1F)

Status code indicating that the BOD is not enabled.

#define
SL_STATUS_BOD_THRESHOLD_CONFIG_FAIL ((sl_status_t)0x0C20)

Status code indicating a failure in configuring the BOD threshold.

#define
SL_STATUS_BOD_SLOT_VALUE_CONFIG_FAIL ((sl_status_t)0x0C21)

Status code indicating a failure in configuring the BOD slot value.

#define
SL_STATUS_BOD_BUTTON_CONFIG_FAIL ((sl_status_t)0x0C22)

Status code indicating a failure in configuring the BOD button.

Typedef Documentation#

bod_callback_t#

typedef void(* bod_callback_t) (void) )(void)

BOD callback function type.


bod_button_callback_t#

typedef void(* bod_button_callback_t) (void) )(void)

Button callback function type.


sl_button_en_t#

typedef uint8_t sl_button_en_t

Button enable type.


Function Documentation#

sl_si91x_bod_set_mode#

sl_status_t sl_si91x_bod_set_mode (uint8_t mode)

Set the BOD mode.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]mode

The mode to set (manual or automatic).

Returns

  • sl_status_t Status of the operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_INVALID_PARAMETER if the mode is invalid.

    • SL_STATUS_NOT_INITIALIZED if the BOD is not enabled.

For more information on status codes, see SL STATUS DOCUMENTATION.

  • Note

    • The mode can be set to either SL_BOD_MANUAL_MODE or SL_BOD_AUTOMATIC_MODE.

      • SL_BOD_MANUAL_MODE allows manual control of the BOD settings.

      • SL_BOD_AUTOMATIC_MODE enables automatic BOD operation based on predefined settings.


sl_si91x_bod_config_slot_value#

sl_status_t sl_si91x_bod_config_slot_value (uint16_t slot_value)

Configure the slot value for BOD.

Parameters
TypeDirectionArgument NameDescription
uint16_t[in]slot_value

The slot value to set, which must be in the range 2 to 65535.

Returns

  • sl_status_t Status of the operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_INVALID_PARAMETER if the slot value is out of range.

    • SL_STATUS_NOT_INITIALIZED if the BOD is not enabled.

    • SL_STATUS_FAIL if the slot value could not be configured.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_init#

sl_status_t sl_si91x_bod_init (void )

Initialize the BOD module.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function initializes the BOD module with the specified battery voltage threshold.

Returns

  • sl_status_t Status of the BOD initialization operation.

    • SL_STATUS_OK if the initialization was successful.

    • SL_STATUS_FAIL if the initialization failed.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_deinit#

sl_status_t sl_si91x_bod_deinit (void )

Deinitialize the BOD module.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function deinitializes the BOD module.

Returns

  • sl_status_t Status of the BOD deinitialization operation.

    • SL_STATUS_OK if the deinitialization was successful.

    • SL_STATUS_FAIL if the deinitialization failed.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_get_threshold#

sl_status_t sl_si91x_bod_get_threshold (float * vbatt_threshold)

Get the BOD threshold value.

Parameters
TypeDirectionArgument NameDescription
float *[out]vbatt_threshold

to store the current threshold value

This function retrieves the current threshold value set for the BOD.

Returns

  • sl_status_t Status of the BOD configuration operation.

    • SL_STATUS_OK if the configuration was successful.

    • SL_STATUS_INVALID_PARAMETER if the provided pointer is NULL.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_NVIC_enable_irq#

void sl_si91x_bod_NVIC_enable_irq (void )

Enable the BOD interrupt in the NVIC.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function enables the interrupt for the BOD in the NVIC, allowing the system to handle BOD-related interrupts.


sl_si91x_bod_get_blackout_status#

en_t sl_si91x_bod_get_blackout_status (void )

sl_si91x_bod_get_blackout_status

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function is used to get the blackout status.

Returns

  • en_t Returns the blackout status.

    • Enable if blackout is enabled.

    • Disable if blackout is disabled.


sl_si91x_bod_set_configuration#

sl_status_t sl_si91x_bod_set_configuration (sl_bod_uc_param_t usr_config_params)

Set the BOD configuration.

Parameters
TypeDirectionArgument NameDescription
sl_bod_uc_param_t[in]usr_config_params

The BOD configuration parameters.

Returns

  • sl_status_t Status of the BOD configuration operation.

    • SL_STATUS_OK if the configuration was successful.

    • SL_STATUS_INVALID_PARAMETER if the provided parameters are invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_button_configuration#

void sl_si91x_bod_button_configuration (uint16_t button_max_value, uint16_t button1_min_value, uint16_t button2_min_value, uint16_t button3_min_value)

Configures the BOD (Brown-Out Detector) button values.

Parameters
TypeDirectionArgument NameDescription
uint16_t[in]button_max_value

The maximum value for the button.

uint16_t[in]button1_min_value

The minimum value for button 1.

uint16_t[in]button2_min_value

The minimum value for button 2.

uint16_t[in]button3_min_value

The minimum value for button 3.

This function sets the maximum value for the button and the minimum values for three different buttons.


sl_si91x_bod_button_wakeup_disable#

sl_status_t sl_si91x_bod_button_wakeup_disable (void )

Disables the button wakeup functionality for the BOD (Brown-Out Detector).

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function disables the button wakeup feature for the BOD. When disabled, the system cannot wake up from a low-power state using a button press.

Returns

  • sl_status_t Status of the button wakeup operation.

    • SL_STATUS_OK if the operation completed successfully.

    • SL_STATUS_FAIL if the operation was unsuccessful.


sl_si91x_bod_button_wakeup_enable#

void sl_si91x_bod_button_wakeup_enable (uint8_t enable)

Enable or disable button wakeup functionality for the BOD (Brown-Out Detector).

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]enable
  • 1: Enable button wakeup functionality.

  • 0: Disable button wakeup functionality.

This function allows the user to enable or disable the button wakeup feature for the BOD. When enabled, the system can wake up from a low-power state using a button press.


sl_si91x_bod_button_wakeup_enable_v2#

sl_status_t sl_si91x_bod_button_wakeup_enable_v2 (boolean_t bod_button_enable)

Enable button wakeup functionality for the BOD (Brown-Out Detector).

Parameters
TypeDirectionArgument NameDescription
boolean_t[in]bod_button_enable
  • 1: Enable button wakeup functionality.

  • 0: Disable button wakeup functionality.

This function allows the user to enable or disable the button wakeup feature for the BOD. When enabled, the system can wake up from a low-power state using a button press.

Returns

  • sl_status_t Status of the callback registration operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_FAIL if the operation failed.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_register_callback#

sl_status_t sl_si91x_bod_register_callback (bod_callback_t callback)

Register a callback function for BOD interrupts.

Parameters
TypeDirectionArgument NameDescription
bod_callback_t[in]callback

The callback function to register.

This function registers a callback function to be called when a BOD interrupt occurs.

Returns

  • sl_status_t Status of the callback registration operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_NULL_POINTER if the provided callback is NULL.

    • SL_STATUS_BUSY if a callback is already registered.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_button_register_callback#

sl_status_t sl_si91x_bod_button_register_callback (bod_button_callback_t callback)

Register a callback function for BOD button interrupts.

Parameters
TypeDirectionArgument NameDescription
bod_button_callback_t[in]callback

The callback function to register.

This function registers a callback function to be called when a BOD button interrupt occurs.

Returns

  • sl_status_t Status of the callback registration operation.

    • SL_STATUS_OK if the operation was successful.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_unregister_callback#

void sl_si91x_bod_unregister_callback (void )

Unregister the callback function for BOD interrupts.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function unregisters the callback function for BOD interrupts.


sl_si91x_bod_get_battery_status#

sl_status_t sl_si91x_bod_get_battery_status (float * battery_status)

Get the current battery status.

Parameters
TypeDirectionArgument NameDescription
float *[out]battery_status

Pointer to store the battery status.

This function retrieves the current battery status.

Returns

  • sl_status_t Status of the battery status retrieval operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_INVALID_PARAMETER if the battery_status pointer is NULL.

For more information on status codes, see SL STATUS DOCUMEN TATION.


sl_si91x_bod_set_threshold#

sl_status_t sl_si91x_bod_set_threshold (float threshold)

Set the BOD voltage threshold.

Parameters
TypeDirectionArgument NameDescription
float[in]threshold

The BOD voltage threshold to set.

This function sets the BOD voltage threshold to the specified value.

Returns

  • sl_status_t Status of the BOD threshold setting operation.

    • SL_STATUS_OK if the setting was successful.

    • SL_STATUS_INVALID_PARAMETER if the threshold is out of range.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_bod_enable_interrupt#

void sl_si91x_bod_enable_interrupt (void )

Enable BOD interrupt.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function enables the BOD interrupt for detecting voltage drops below the threshold.


sl_si91x_bod_button_enable_interrupt#

void sl_si91x_bod_button_enable_interrupt (void )

Enable the interrupt for the BOD (Brown-Out Detection) button.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function configures and enables the interrupt associated with the BOD button, allowing the system to respond to brown-out detection events.

Note

  • Ensure that the BOD button hardware and related configurations are properly initialized before calling this function.


sl_si91x_bod_disable_interrupt#

void sl_si91x_bod_disable_interrupt (void )

Disable BOD interrupt.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function disables the BOD interrupt.


sl_si91x_bod_button_disable_interrupt#

void sl_si91x_bod_button_disable_interrupt (void )

Disable the interrupt for the BOD button.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function disables the interrupt associated with the BOD button.

Note

  • This function is typically used when the BOD button is no longer needed or when the system needs to disable the button interrupt for any reason.

  • Ensure that the BOD button hardware and related configurations are properly initialized before calling this function.


sl_si91x_bod_clear_interrupt#

void sl_si91x_bod_clear_interrupt (void )

Clear BOD interrupt.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_si91x_bod_button_value_read#

uint8_t sl_si91x_bod_button_value_read (void )

Read the value of the BOD button.

Parameters
TypeDirectionArgument NameDescription
voidN/A
  • Pre-conditions:

    • The BOD module must be initialized using sl_si91x_bod_init(). This function reads the value of the BOD button.

Returns

  • The current value of the BOD button, which can be 1, 2, or 3.


sl_si91x_bod_button_clear_interrupt#

void sl_si91x_bod_button_clear_interrupt (void )

Clear the BOD button interrupt.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function clears the interrupt flag for the BOD button.


sl_si91x_bod_button_set_configuration#

sl_status_t sl_si91x_bod_button_set_configuration (sl_bod_button_uc_config_param_t uc_config_param, uint8_t * button_max_value, uint8_t * button_1_min_value, uint8_t * button_2_min_value, uint8_t * button_3_min_value)

Configure the voltage percentage thresholds for the BOD buttons.

Parameters
TypeDirectionArgument NameDescription
sl_bod_button_uc_config_param_t[in]uc_config_param

The voltage percentage configuration structure for the buttons.

uint8_t *[out]button_max_value

Pointer to store the calculated maximum button value.

uint8_t *[out]button_1_min_value

Pointer to store the calculated minimum value for button 1.

uint8_t *[out]button_2_min_value

Pointer to store the calculated minimum value for button 2.

uint8_t *[out]button_3_min_value

Pointer to store the calculated minimum value for button 3.

This function configures the voltage percentage thresholds for up to three BOD buttons, based on the provided configuration structure. It calculates and outputs the corresponding button values for the maximum and minimum voltage percentages for each button.

Returns

  • sl_status_t Status of the configuration operation.

    • SL_STATUS_OK if the configuration was successful.

    • SL_STATUS_INVALID_PARAMETER if any pointer is NULL or configuration is invalid.

Note

  • The voltage percentages in the configuration structure should be between 0.0 and 100.0. The calculated button values are based on the battery voltage range and the specified percentages.


sl_si91x_bod_battery_percentage#

sl_status_t sl_si91x_bod_battery_percentage (float voltage, float * vbat_per)

Calculate the battery percentage based on the given voltage.

Parameters
TypeDirectionArgument NameDescription
float[in]voltage

The input voltage value to be converted to battery percentage.

float *[out]vbat_per

Pointer to a float where the calculated battery percentage will be stored.

This function takes a voltage value and calculates the corresponding battery percentage, storing the result in the provided pointer.

Returns

  • sl_status_t Returns the status of the operation.

    • SL_STATUS_OK if the operation was successful.

    • SL_STATUS_INVALID_PARAMETER if the input voltage is out of range.


sl_si91x_bod_black_out_reset#

void sl_si91x_bod_black_out_reset (en_t enable)

Controls the Black Out Monitor reset functionality.

Parameters
TypeDirectionArgument NameDescription
en_tN/Aenable

A value of type en_t that specifies whether to enable or disable the BOD reset.

  • If enable is true, the BOD reset is enabled.

  • If enable is false, the BOD reset is disabled.

This function enables or disables the Black Out Monitor reset functionality. The BOD reset is used to reset the system when the supply voltage drops below a certain threshold, ensuring the system does not operate under unsafe conditions.


sl_si91x_bod_button_interrupt_clear#

void sl_si91x_bod_button_interrupt_clear (void )

Clears the BOD (Brown-Out Detector) button interrupt.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function is used to clear the interrupt triggered by the BOD button. It ensures that the interrupt flag is reset, allowing for subsequent interrupts to be detected and handled appropriately.


sl_si91x_bod_enable_blackout_in_sleep_mode#

void sl_si91x_bod_enable_blackout_in_sleep_mode (void )

Enable the blackout reset in sleep mode.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API is used to enable the blackout reset functionality when the device is in sleep mode. Blackout reset helps in protecting the device from unexpected power failures by resetting the device.


sl_si91x_bod_disable_blackout_in_sleep_mode#

void sl_si91x_bod_disable_blackout_in_sleep_mode (void )

Disable the blackout reset in sleep mode.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API is used to disable the blackout reset functionality when the device is in sleep mode. Blackout reset helps in protecting the device from unexpected power failures by resetting the device.