Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Battery measurement

Battery measurement module API. More...

Data Structures

struct  batt_meas_init_t
 Init parameters for m_batt_meas. More...
 
struct  batt_meas_param_t
 Input parameters for m_batt_meas. More...
 
struct  m_batt_meas_event_t
 The struct passed to the handler with relevant battery information. More...
 
struct  voltage_divider_t
 Struct for providing m_batt_meas with physical voltage divider information. More...
 

Typedefs

typedef void(* m_batt_meas_event_handler_t )(m_batt_meas_event_t const *p_event)
 m_batt sensor event handler type. Should be implemented by user e.g. in main()
 

Enumerations

enum  { M_BATT_STATUS_CODE_SUCCESS, M_BATT_STATUS_CODE_INVALID_PARAM }
 The m_batt_meas return status codes. More...
 
enum  m_batt_meas_event_type_t {
  M_BATT_MEAS_EVENT_DATA, M_BATT_MEAS_EVENT_LOW, M_BATT_MEAS_EVENT_FULL, M_BATT_MEAS_EVENT_USB_CONN_CHARGING,
  M_BATT_MEAS_EVENT_USB_CONN_CHARGING_FINISHED, M_BATT_MEAS_EVENT_USB_DISCONN, M_BATT_MEAS_EVENT_ERROR
}
 Battery and charge event codes. More...
 

Functions

uint32_t m_batt_meas_disable (void)
 Stops the battery measurement. More...
 
uint32_t m_batt_meas_enable (uint32_t meas_interval_ms)
 Enables battery measurement at the given interval. More...
 
uint32_t m_batt_meas_init (m_ble_service_handle_t *p_handle, batt_meas_init_t const *const p_batt_meas_init)
 Initalizes the battery driver. More...
 

Detailed Description

Battery measurement module API.

Enumeration Type Documentation

anonymous enum

The m_batt_meas return status codes.

Enumerator
M_BATT_STATUS_CODE_SUCCESS 

Successfull.

M_BATT_STATUS_CODE_INVALID_PARAM 

Invalid parameters.

Battery and charge event codes.

Enumerator
M_BATT_MEAS_EVENT_DATA 

Is called back at the desired frequency.

M_BATT_MEAS_EVENT_LOW 

Low battery event (<= set by user).

M_BATT_MEAS_EVENT_FULL 

Full battery event (>= value set by user).

M_BATT_MEAS_EVENT_USB_CONN_CHARGING 

Battery main og tricle charging active.

M_BATT_MEAS_EVENT_USB_CONN_CHARGING_FINISHED 

Battery charging finished/not charging.

M_BATT_MEAS_EVENT_USB_DISCONN 

USB disconnected, battery not charging.

M_BATT_MEAS_EVENT_ERROR 

Error state detected signalled by the charger (not implemeted, CHG and CHG finished will toggle in case of error).

Function Documentation

uint32_t m_batt_meas_disable ( void  )

Stops the battery measurement.

Returns
M_BATT_STATUS_CODE_SUCCESS
Other codes from the underlying driver
uint32_t m_batt_meas_enable ( uint32_t  meas_interval_ms)

Enables battery measurement at the given interval.

Parameters
meas_interval_msSampling interval given in milliseconds.
Note
This will call the handler supplied in p_batt_meas_init at the given interval which is supplied with a m_batt_meas_event_t struct containing the information.
Returns
M_BATT_STATUS_CODE_SUCCESS
Other codes from the underlying driver
uint32_t m_batt_meas_init ( m_ble_service_handle_t p_handle,
batt_meas_init_t const *const  p_batt_meas_init 
)

Initalizes the battery driver.

Parameters
[out]p_handlePointer to the location to store the service handle.
[in]p_batt_meas_initStruct containing the configuration parameters.
Returns
M_BATT_STATUS_CODE_SUCCESS
M_BATT_STATUS_CODE_INVALID_PARAM
NRF_ERROR_NULL
Other codes from the underlying driver.