CORE

group npmx_core

Core events peripheral driver.

Enums

enum npmx_core_task_t

Main core tasks.

Values:

enumerator NPMX_CORE_TASK_RESET

Turn off all power supplies and apply an internal reset.

Functions

npmx_error_t npmx_core_task_trigger(npmx_instance_t const *p_pm, npmx_core_task_t task)

Function for activating the specified main core task.

Parameters:
  • p_pm – Pointer to the instance of nPM device.

  • task – Task to be activated.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_core_init(npmx_instance_t *p_pm, npmx_backend_t *p_backend, npmx_callback_t generic_callback, bool restore_values)

Function for initialization of nPM device instance with default values. Should be called in setup function to avoid runtime errors.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

  • p_backend[in] Pointer to the initialized backend instance.

  • generic_callback[in] Function callback pointer to be registered as generic callback.

  • restore_values[in] True if initial values are to be restored from nPM device, false for setting default values. If true, scratch registers are used to store state and cannot be used by application.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

void npmx_core_register_cb(npmx_instance_t *p_pm, npmx_callback_t cb, npmx_callback_type_t type)

Function for registering callback handler to specified callback type event/error. If no callback is registered, generlic callback specified in pm->generic_cb is called.

Parameters:
  • p_pm[in] Instance of nPM device.

  • cb[in] Function callback pointer to be registered.

  • type[in] Type of registered function callback pointer.

void npmx_core_interrupt(npmx_instance_t *p_pm)

Function for signaling an interrupt.

This function should be called when an interrupt associated with nPM device’s GPIO pin is handled, to register event from nPM device.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

npmx_error_t npmx_core_proc(npmx_instance_t *p_pm)

Function for running in loop a task to handle all interrupts from nPM device.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_core_event_interrupt_enable(npmx_instance_t *p_pm, npmx_event_group_t event, uint8_t flags_mask)

Function for enabling event interrupt.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

  • event[in] Specified event group type.

  • flags_mask[in] Specified bits in event group, see npmx_event_group_xxx_t for selected event to be enabled.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_core_event_interrupt_disable(npmx_instance_t *p_pm, npmx_event_group_t event, uint8_t flags_mask)

Function for disabling and clearing event interrupt.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

  • event[in] Specified event group type.

  • flags_mask[in] Specified bits in event group, see npmx_event_group_xxx_t for selected event to be disabled.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

void npmx_core_context_set(npmx_instance_t *p_pm, void *p_context)

Function for setting user-defined context data.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

  • p_context[in] Pointer to context data.

void *npmx_core_context_get(npmx_instance_t *p_pm)

Function for getting user-defined context data.

Parameters:
  • p_pm[in] Pointer to the instance of nPM device.

Returns:

Pointer to context data.