SHIP

group npmx_ship

Ship and hibernate modes peripheral driver.

Enums

enum npmx_ship_task_t

Ship and hibernate tasks.

Values:

enumerator NPMX_SHIP_TASK_HIBERNATE

Task enter hibernate.

enumerator NPMX_SHIP_TASK_CONFIG_SHIPHOLD

Task ship hold configuration.

enumerator NPMX_SHIP_TASK_SHIPMODE

Task enter ship mode.

enumerator NPMX_SHIP_TASK_CONFIG_RESET

Task request reset configuration.

enumerator NPMX_SHIP_TASK_COUNT

Tasks count.

enum npmx_ship_time_t

SHPHLD duration button must be pressed to exit ship or hibernate mode.

Values:

enumerator NPMX_SHIP_TIME_16_MS

16 ms.

enumerator NPMX_SHIP_TIME_32_MS

32 ms.

enumerator NPMX_SHIP_TIME_64_MS

64 ms.

enumerator NPMX_SHIP_TIME_96_MS

96 ms.

enumerator NPMX_SHIP_TIME_304_MS

304 ms.

enumerator NPMX_SHIP_TIME_608_MS

608 ms.

enumerator NPMX_SHIP_TIME_1008_MS

1008 ms.

enumerator NPMX_SHIP_TIME_3008_MS

3008 ms.

enumerator NPMX_SHIP_TIME_COUNT

Possible durations count.

enumerator NPMX_SHIP_TIME_MIN

Minimum time.

enumerator NPMX_SHIP_TIME_DEFAULT

Default time.

enumerator NPMX_SHIP_TIME_MAX

Maximum time.

enumerator NPMX_SHIP_TIME_INVALID

Invalid time.

Functions

npmx_ship_t *npmx_ship_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning SHIP instance based on index.

Parameters:
  • p_pmic[in] Pointer to the SHIP instance.

  • idx[in] Index of the SHIP instance.

Returns:

Pointer to the SHIP instance.

npmx_ship_time_t npmx_ship_time_convert(uint32_t time_ms)

Function for converting milliseconds to npmx_ship_time_t enumeration.

Parameters:
  • time_ms[in] Time in milliseconds to be converted into npmx_ship_time_t enumeration.

Returns:

Result of conversion. NPMX_SHIP_TIME_INVALID if given time is not represented in enumeration.

bool npmx_ship_time_convert_to_ms(npmx_ship_time_t enum_value, uint32_t *p_val)

Function for converting npmx_ship_time_t enumeration to milliseconds.

Parameters:
  • enum_value[in] Time defined as npmx_ship_time_t enumeration to be converted into milliseconds.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

npmx_error_t npmx_ship_task_trigger(npmx_ship_t const *p_instance, npmx_ship_task_t task)

Function for activating the specified SHIP task.

Note

The wakeup timer needs to be configured before entering the hibernate mode.

Parameters:
  • p_instance – Pointer to the SHIP instance.

  • task – Task to be activated.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_ship_config_set(npmx_ship_t *p_instance, npmx_ship_config_t const *p_config)

Function for setting the ship hold configuration.

Parameters:
  • p_instance[in] Pointer to the SHIP instance.

  • p_config[in] Pointer to the configuration of the SHIP to be applied.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_ship_config_get(npmx_ship_t *p_instance, npmx_ship_config_t *p_config)

Function for reading the ship hold configuration.

Parameters:
  • p_instance[in] Pointer to the SHIP instance.

  • p_config[out] Pointer to the SHIP configuration structure.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_ship_gpio_status_check(npmx_ship_t const *p_instance, bool *p_active)

Function for checking whether the ship button is active.

Parameters:
  • p_instance[in] Pointer to the SHIP instance.

  • p_active[out] Pointer to the variable to be filled with ship button status. True if button is active, false otherwise.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_ship_reset_config_set(npmx_ship_t const *p_instance, npmx_ship_reset_config_t const *p_config)

Function for setting long press reset button configuration.

Parameters:
  • p_instance[in] Pointer to the SHIP instance.

  • p_config[in] Pointer to the configuration of the reset button to be applied.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_ship_reset_config_get(npmx_ship_t const *p_instance, npmx_ship_reset_config_t *p_config)

Function for reading the long press reset button configuration.

Parameters:
  • p_instance[in] Pointer to the SHIP instance.

  • p_config[out] Pointer to the reset button configuration structure.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_ship_t
#include <npmx_ship.h>

Data structure of the SHIP driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.

bool ship_button_inverted

Flag set when polarity of SHPHLD button is inverted. False by default.

struct npmx_ship_config_t
#include <npmx_ship.h>

Configuration structure for ship hold.

Public Members

npmx_ship_time_t time

Time required to exit from the ship or the hibernate mode.

bool inverted_polarity

True if the device is to invert the SHPHLD button active status, false otherwise. By default, the button is active in the LOW state.

struct npmx_ship_reset_config_t
#include <npmx_ship.h>

Configuration structure for reset button.

Public Members

bool long_press

True if device is to use long press (10 s) button, false otherwise.

bool two_buttons

True if device is to use two buttons (SHPHLD and GPIO0) to perform long press reset, false if only one button should be used (SHPHLD).