TIMER

group npmx_timer

TIMER peripheral driver.

Enums

enum npmx_timer_task_t

TIMER tasks.

Values:

enumerator NPMX_TIMER_TASK_ENABLE

Start timer.

enumerator NPMX_TIMER_TASK_DISABLE

Stop timer.

enumerator NPMX_TIMER_TASK_STROBE

Load timer value from 24-bit timer’s register.

enumerator NPMX_TIMER_TASK_KICK

Kick watchdog.

enumerator NPMX_TIMER_TASK_COUNT

Timer tasks count.

enum npmx_timer_mode_t

Available modes of the timer.

Values:

enumerator NPMX_TIMER_MODE_BOOT_MONITOR

Boot monitor.

enumerator NPMX_TIMER_MODE_WATCHDOG_WARNING

Watchdog warning.

enumerator NPMX_TIMER_MODE_WATCHDOG_RESET

Watchdog reset.

enumerator NPMX_TIMER_MODE_GENERAL_PURPOSE

General purpose timer.

enumerator NPMX_TIMER_MODE_WAKEUP

Wake-up timer.

enumerator NPMX_TIMER_MODE_COUNT

Timer modes count.

enumerator NPMX_TIMER_MODE_INVALID

Invalid timer mode.

enum npmx_timer_prescaler_t

Switches between 64 Hz and 512 Hz timer clock .

Values:

enumerator NPMX_TIMER_PRESCALER_SLOW

Timer clock set to 64 Hz.

enumerator NPMX_TIMER_PRESCALER_FAST

Timer clock set to 512 Hz.

enumerator NPMX_TIMER_PRESCALER_COUNT

Timer prescalers count.

enumerator NPMX_TIMER_PRESCALER_INVALID

Invalid timer prescaler.

Functions

npmx_timer_t *npmx_timer_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning TIMER instance based on index.

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

  • idx[in] Index of the TIMER instance.

Returns:

Pointer to the TIMER instance.

npmx_error_t npmx_timer_task_trigger(npmx_timer_t const *p_instance, npmx_timer_task_t task)

Function for activating the specified TIMER task.

Parameters:
  • p_instance – Pointer to the TIMER 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_timer_config_set(npmx_timer_t const *p_instance, npmx_timer_config_t const *p_config)

Function for setting timer’s configuration with mode, prescaler, and compare value.

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

  • p_config[in] Pointer to the configuration of the TIMER to apply.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_timer_config_get(npmx_timer_t const *p_instance, npmx_timer_config_t *p_config)

Function for reading the ADC configuration.

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

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

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_timer_status_get(npmx_timer_t const *p_instance, npmx_timer_status_t *p_status)

Function for getting TIMER status.

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

  • p_status[out] Pointer to the structure to be filled with TIMER status.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_timer_t
#include <npmx_timer.h>

Data structure of the TIMER driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.

struct npmx_timer_config_t
#include <npmx_timer.h>

Configuration structure for timer.

Public Members

npmx_timer_mode_t mode

Mode of the timer.

npmx_timer_prescaler_t prescaler

Prescaler value to use.

uint32_t compare_value

Timer’s 24 bits counter compare value.

struct npmx_timer_status_t
#include <npmx_timer.h>

Timer status structure.

Public Members

bool boot_monitor

Boot monitor running.

bool slow_domain_config

Slow domain configuration status.