Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0

Functions

uint32_t pru_hal_init (void)
 Initialize the PRU's Hardware abstraction layer. More...
 
uint32_t pru_hal_vrect_get (uint16_t *p_vrect)
 Read the value of VRECT. More...
 
uint32_t pru_hal_irect_get (uint16_t *p_irect)
 Read the value of IRECT. More...
 
uint32_t pru_hal_vout_enable_set (bool enable)
 Enable output to battery. More...
 
uint32_t pru_hal_vout_enable_get (bool *enable)
 Get status of VOUT enable. More...
 
uint32_t pru_hal_vout_get (uint16_t *p_vout)
 Read the voltage output to battery. More...
 
uint32_t pru_hal_iout_get (uint16_t *p_iout)
 Read the value of IOUT. More...
 
uint32_t pru_hal_temperature_get (int16_t *p_temperature)
 Read the temperature. More...
 
uint32_t pru_hal_wired_charge_detect_status_get (bool *p_wired)
 Get the status of whether the PRU is charged by wire. More...
 
uint32_t pru_hal_charge_complete_status_get (bool *p_charge_complete)
 Get the status of whether the PRU is charged. More...
 
uint32_t pru_hal_adj_power_set (ctl_adj_power_t adj_setting)
 Limit maximum power consumed by PRU. More...
 
uint32_t pru_hal_adj_power_get (ctl_adj_power_t *adj_setting)
 Get adjust power setting. More...
 
uint32_t pru_hal_power_adjusted_set (bool adjusted)
 Set power adjusted value. More...
 
uint32_t pru_hal_power_adjusted_get (bool *p_adjusted)
 This function is called by the PRU profile to see if the PRU has limited its power consumption as instructed by previous call to 'pru_hal_adj_power_set()'. More...
 

Detailed Description

Function Documentation

uint32_t pru_hal_init ( void  )

Initialize the PRU's Hardware abstraction layer.

Return values
NRF_SUCCESSStatus was read successfully.

Definition at line 54 of file pru_hal_evkit.c.

55 {
56  // Set default values
63  m_charge_complete = false;
64  m_vout_enable = false;
66  m_power_adjusted = false;
67 
68  return NRF_SUCCESS;
69 }
static uint32_t m_vout
Definition: pru_hal_evkit.c:38
static uint32_t m_vrect
Definition: pru_hal_evkit.c:36
#define VOUT_DEFAULT_VAL
Definition: pru_hal_evkit.c:27
#define IRECT_DEFAULT_VAL
Definition: pru_hal_evkit.c:26
static uint32_t m_irect
Definition: pru_hal_evkit.c:37
#define VRECT_DEFAULT_VAL
Definition: pru_hal_evkit.c:25
static ctl_adj_power_t m_power_adj
Definition: pru_hal_evkit.c:44
static bool m_power_adjusted
Definition: pru_hal_evkit.c:45
#define TEMP_DEFAULT_VAL
Definition: pru_hal_evkit.c:29
static int16_t m_temp
Definition: pru_hal_evkit.c:40
static bool m_wired_charge_detected
Definition: pru_hal_evkit.c:41
#define IOUT_DEFAULT_VAL
Definition: pru_hal_evkit.c:28
static uint32_t m_iout
Definition: pru_hal_evkit.c:39
static bool m_vout_enable
Definition: pru_hal_evkit.c:43
static bool m_charge_complete
Definition: pru_hal_evkit.c:42
uint32_t pru_hal_vrect_get ( uint16_t *  p_vrect)

Read the value of VRECT.

Parameters
[out]p_vrectVoltage at rectifier diode output [mV].
Return values
NRF_SUCCESSVRECT was read successfully.

Definition at line 71 of file pru_hal_evkit.c.

72 {
73  *p_vrect = m_vrect;
74  return NRF_SUCCESS;
75 }
static uint32_t m_vrect
Definition: pru_hal_evkit.c:36
uint32_t pru_hal_irect_get ( uint16_t *  p_irect)

Read the value of IRECT.

Parameters
[out]p_irectCurrent at rectifier diode output [mA].
Return values
NRF_SUCCESSIRECT was read successfully.

Definition at line 77 of file pru_hal_evkit.c.

78 {
79  *p_irect = m_irect;
80  return NRF_SUCCESS;
81 }
static uint32_t m_irect
Definition: pru_hal_evkit.c:37
uint32_t pru_hal_vout_enable_set ( bool  enable)

Enable output to battery.

Parameters
[in]enableset to true enables output to battery.
Return values
NRF_SUCCESSIf VOUT was enabled.

Definition at line 83 of file pru_hal_evkit.c.

84 {
85  m_vout_enable = enable;
86  return NRF_SUCCESS;
87 }
static bool m_vout_enable
Definition: pru_hal_evkit.c:43
uint32_t pru_hal_vout_enable_get ( bool *  enable)

Get status of VOUT enable.

Parameters
[out]enableenable status of VOUT enable.
Return values
NRF_SUCCESSIf VOUT was enabled.

Definition at line 89 of file pru_hal_evkit.c.

90 {
91  *enable = m_vout_enable;
92  return NRF_SUCCESS;
93 }
static bool m_vout_enable
Definition: pru_hal_evkit.c:43
uint32_t pru_hal_vout_get ( uint16_t *  p_vout)

Read the voltage output to battery.

Parameters
[out]p_voutVoltage at charge/battery port [mV].
Return values
NRF_SUCCESSVOUT was read successfully.

Definition at line 95 of file pru_hal_evkit.c.

96 {
97  *p_vout = m_vout;
98  return NRF_SUCCESS;
99 }
static uint32_t m_vout
Definition: pru_hal_evkit.c:38
uint32_t pru_hal_iout_get ( uint16_t *  p_iout)

Read the value of IOUT.

Parameters
[out]p_ioutCurrent at charge/battery port [mA].
Return values
NRF_SUCCESSIOUT was read successfully.

Definition at line 101 of file pru_hal_evkit.c.

102 {
103  *p_iout = m_iout;
104  return NRF_SUCCESS;
105 }
static uint32_t m_iout
Definition: pru_hal_evkit.c:39
uint32_t pru_hal_temperature_get ( int16_t *  p_temperature)

Read the temperature.

Parameters
[out]p_temperatureTemperature of PRU [Deg C].
Return values
NRF_SUCCESSTemperature was read successfully.

Definition at line 107 of file pru_hal_evkit.c.

108 {
109  *p_temperature = m_temp;
110  return NRF_SUCCESS;
111 }
static int16_t m_temp
Definition: pru_hal_evkit.c:40
uint32_t pru_hal_wired_charge_detect_status_get ( bool *  p_wired)

Get the status of whether the PRU is charged by wire.

Parameters
[out]p_wiredTrue if PRU is connected to a wired charger, false otherwise.
Return values
NRF_SUCCESSStatus was read successfully.

Definition at line 113 of file pru_hal_evkit.c.

114 {
115  *p_wired = m_wired_charge_detected;
116  return NRF_SUCCESS;
117 }
static bool m_wired_charge_detected
Definition: pru_hal_evkit.c:41
uint32_t pru_hal_charge_complete_status_get ( bool *  p_charge_complete)

Get the status of whether the PRU is charged.

Parameters
[out]p_charge_completeTrue if PRU has completed charging, false otherwise.
Return values
NRF_SUCCESSStatus was read successfully.

Definition at line 119 of file pru_hal_evkit.c.

120 {
121  *p_charge_complete = m_charge_complete;
122  return NRF_SUCCESS;
123 }
static bool m_charge_complete
Definition: pru_hal_evkit.c:42
uint32_t pru_hal_adj_power_set ( ctl_adj_power_t  adj_setting)

Limit maximum power consumed by PRU.

This function is invoked by the PRU Profile when the PRU receives a power adjust command from the PTU.

Once the PRU has successfully adjusted its power consumption, it should set the power adjusted value to 'true' by invoking 'pru_hal_power_adjusted_set'.

Parameters
[in]adj_settingspecifies the maximium amount of power the PRU can consume.
Return values
NRF_SUCCESSValue was set successfully.

Definition at line 125 of file pru_hal_evkit.c.

126 {
127  m_power_adj = adj_setting;
128  return NRF_SUCCESS;
129 }
static ctl_adj_power_t m_power_adj
Definition: pru_hal_evkit.c:44
uint32_t pru_hal_adj_power_get ( ctl_adj_power_t adj_setting)

Get adjust power setting.

Parameters
[out]adj_settingPower adjust setting.
Return values
NRF_SUCCESSValue was returned successfully.

Definition at line 131 of file pru_hal_evkit.c.

132 {
133  *adj_setting = m_power_adj;
134  return NRF_SUCCESS;
135 }
static ctl_adj_power_t m_power_adj
Definition: pru_hal_evkit.c:44
uint32_t pru_hal_power_adjusted_set ( bool  adjusted)

Set power adjusted value.

When power adjusted value is set to 'true' the PRU will set its 'Adjusted Power Response' bit in the 'PRU Dynamic' characteristic to '1' for 1 second, informing the PTU that the PRU has adjusted its power draw as instructed.

The PRU profile will automatically invoke this function to set the power adjusted value to 'false' after reading it as 'true'.

Note: If 'STATIC_POWER_ADJUSTED_BIT' is defined, the PRU profile will not reset the power adjusted value as described above.

Parameters
[in]adjustedNew power adjusted value.
Return values
NRF_SUCCESSthe value was successfully set.

Definition at line 143 of file pru_hal_evkit.c.

144 {
145  m_power_adjusted = adjusted;
146  return NRF_SUCCESS;
147 }
static bool m_power_adjusted
Definition: pru_hal_evkit.c:45
uint32_t pru_hal_power_adjusted_get ( bool *  p_adjusted)

This function is called by the PRU profile to see if the PRU has limited its power consumption as instructed by previous call to 'pru_hal_adj_power_set()'.

When *p_adjusted is set to 'true', the PRU will set its 'Adjusted Power Response' bit in the 'PRU Dynamic' characteristic to '1' for 1 second, informing the PTU that the PRU has adjusted its power draw as instructed.

Parameters
[out]p_adjustedSet to 'true' when power draw has been adjusted as specified by previous call to 'pru_hal_adj_power_set()'.
Return values
NRF_SUCCESSValue was returned successfully.

Definition at line 137 of file pru_hal_evkit.c.

138 {
139  *adjusted = m_power_adjusted;
140  return NRF_SUCCESS;
141 }
static bool m_power_adjusted
Definition: pru_hal_evkit.c:45