Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
PRU profile API

Macros

#define APP_TIMER_PRESCALER   0
 
#define APP_TIMER_OP_QUEUE_SIZE   10
 

Typedefs

typedef void(* app_sm_evt_handler_t) (pru_sm_signal_type_t signal, const pru_sm_state_vars_t *p_state_vars)
 
typedef void(* pru_sm_handler_t) (pru_sm_signal_type_t evt)
 

General API functions

void pru_init (app_sm_evt_handler_t sm_evt_handler)
 Initialize PRU. This function must be called before any other PRU function can be called. More...
 
void pru_start (void)
 Enable the PRU profile. When enabled sensor reading and signal generation will be enabled.
 
void pru_on_ble_evt (ble_evt_t *p_ble_evt)
 Handle BLE event.
 

API implementation

void terminate (void)
 Needs to be implemented by application. Perform all requried actions before jump to DFU application can be done.
 
bool dfu_check (void)
 Needs to be implemented by application. Check if it is OK to jump to the DFU application. More...
 

Detailed Description

Macro Definition Documentation

#define APP_TIMER_PRESCALER   0

Prescaling for internal timers.

Definition at line 33 of file pru.h.

#define APP_TIMER_OP_QUEUE_SIZE   10

Max number of internal timers.

Definition at line 34 of file pru.h.

Typedef Documentation

typedef void(* app_sm_evt_handler_t) (pru_sm_signal_type_t signal, const pru_sm_state_vars_t *p_state_vars)

Application State machine event handler.

Definition at line 29 of file pru.h.

typedef void(* pru_sm_handler_t) (pru_sm_signal_type_t evt)

PRU State machine event handler.

Definition at line 31 of file pru.h.

Function Documentation

void pru_init ( app_sm_evt_handler_t  sm_evt_handler)

Initialize PRU. This function must be called before any other PRU function can be called.

Parameters
sm_evt_handlerOptional handle state machine event callback. Set to NULL if no callback is required.

Definition at line 480 of file pru.c.

481 {
482  m_app_sm_evt_handler = sm_handler;
483  m_timers_init();
485 }
void pru_sensors_init(pru_sm_handler_t pru_sm_handler)
Initialize sensors and read default values.
Definition: pru_sensors.c:42
static void m_timers_init(void)
Instanicate timers used in this file.
Definition: pru.c:462
static void m_on_sm_event(pru_sm_signal_type_t evt)
Forward events to the PRU state machine. Also handles the resulting request event.
Definition: pru.c:175
static app_sm_evt_handler_t m_app_sm_evt_handler
Definition: pru.c:44
bool dfu_check ( void  )

Needs to be implemented by application. Check if it is OK to jump to the DFU application.

Returns
true if it is OK to jump to DFU application. False otherwise.

Definition at line 523 of file pru.c.

524 {
525  const pru_sensor_data_t * sensor_data;
526  sensor_data = pru_sensors_data_get();
527  return sensor_data->vrect == 0;
528 }
const pru_sensor_data_t * pru_sensors_data_get(void)
Get the latest data from the PRU sensors.
Definition: pru_sensors.c:146
Definition of PRU reporting data.
Definition: pru_sensors.h:26