npmx  1.0.0
 
Loading...
Searching...
No Matches

Core events peripheral driver. More...

Enumerations

enum  npmx_core_task_t { NPMX_CORE_TASK_RESET = offsetof(NPM_MAIN_Type, TASKSWRESET) }
 Main core tasks. More...
 

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.
 
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.
 
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.
 
void npmx_core_interrupt (npmx_instance_t *p_pm)
 Function for signaling an interrupt.
 
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.
 
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.
 
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.
 
void npmx_core_context_set (npmx_instance_t *p_pm, void *p_context)
 Function for setting user-defined context data.
 
void * npmx_core_context_get (npmx_instance_t *p_pm)
 Function for getting user-defined context data.
 

Detailed Description

Core events peripheral driver.

Enumeration Type Documentation

◆ npmx_core_task_t

Main core tasks.

Enumerator
NPMX_CORE_TASK_RESET 

Turn off all power supplies and apply an internal reset.

Function Documentation

◆ npmx_core_context_get()

void * npmx_core_context_get ( npmx_instance_t * p_pm)

Function for getting user-defined context data.

Parameters
[in]p_pmPointer to the instance of nPM device.
Returns
Pointer to context data.

◆ npmx_core_context_set()

void npmx_core_context_set ( npmx_instance_t * p_pm,
void * p_context )

Function for setting user-defined context data.

Parameters
[in]p_pmPointer to the instance of nPM device.
[in]p_contextPointer to context data.

◆ npmx_core_event_interrupt_disable()

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
[in]p_pmPointer to the instance of nPM device.
[in]eventSpecified event group type.
[in]flags_maskSpecified bits in event group, see npmx_event_group_xxx_t for selected event to be disabled.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_core_event_interrupt_enable()

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
[in]p_pmPointer to the instance of nPM device.
[in]eventSpecified event group type.
[in]flags_maskSpecified bits in event group, see npmx_event_group_xxx_t for selected event to be enabled.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_core_init()

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
[in]p_pmPointer to the instance of nPM device.
[in]p_backendPointer to the initialized backend instance.
[in]generic_callbackFunction callback pointer to be registered as generic callback.
[in]restore_valuesTrue 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_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_core_interrupt()

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
[in]p_pmPointer to the instance of nPM device.

◆ npmx_core_proc()

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
[in]p_pmPointer to the instance of nPM device.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.

◆ npmx_core_register_cb()

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
[in]p_pmInstance of nPM device.
[in]cbFunction callback pointer to be registered.
[in]typeType of registered function callback pointer.

◆ npmx_core_task_trigger()

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_pmPointer to the instance of nPM device.
taskTask to be activated.
Return values
NPMX_SUCCESSOperation performed successfully.
NPMX_ERROR_IOError using IO bus line.