Nordic Semiconductor nRF5 AirFuel SDK
version 2.2.0
|
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "nrf_assert.h"
#include "pru.h"
#include "pru_sensors.h"
#include "pru_hw_config.h"
#include "pru_test_mux.h"
#include "pru_sm.h"
#include "pru_adv.h"
#include "pru_config.h"
#include "ble_hci.h"
#include "pru_pstorage.h"
Go to the source code of this file.
Functions | |
API implementation | |
void | pru_init (app_sm_evt_handler_t sm_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. | |
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... | |
Static functions and variables | |
static uint16_t | m_conn_handle = BLE_CONN_HANDLE_INVALID |
static ble_wpts_t | m_wpts |
static uint32_t | m_vrect_high_duration_ms |
static pru_sm_state_vars_t | m_state_variables |
static bool | m_adv_allowed = false |
static app_sm_evt_handler_t | m_app_sm_evt_handler = NULL |
static bool | m_advertising |
APP_TIMER_DEF (m_pru_sensors_timer_single_shot_id) | |
APP_TIMER_DEF (m_p_pru_sensors_timer_id) | |
static void | m_advertising_start (void) |
Start advertising. More... | |
static void | m_sys_evt_dispatch (uint32_t event) |
Dispatches a System stack event to flash storage module. More... | |
static void | m_gap_params_init (void) |
GAP initialization. More... | |
static void | m_handle_event (pru_sm_signal_type_t evt) |
Handle PRU SM events that require profile handling. More... | |
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. More... | |
static void | m_wpts_evt_handler (ble_wpts_t *p_wpts, ble_wpts_evt_t *p_evt) |
WPT Service event handler. More... | |
static void | on_ble_evt (ble_evt_t *p_ble_evt) |
BLE stack GAP event handler. More... | |
static void | m_ble_wpts_init (void) |
Initialize the WPT Service. | |
static uint32_t | m_ble_wpts_pru_dynamic_set (ble_wpts_t *p_wpts, const pru_sensor_data_t *p_pru_sensor_data) |
Set PRU dynamic data. More... | |
static void | m_sensors_timer_handler (void *p_context) |
Sensors measurement timer timeout handler. More... | |
static void | m_sensors_timer_trigger () |
Start timer for reading sensors one time. | |
static void | m_sensors_timer_start (uint16_t period_ms) |
Start timer for reading sensors periodically. | |
static void | m_timers_init (void) |
Instanicate timers used in this file. | |
APP_TIMER_DEF | ( | m_pru_sensors_timer_single_shot_id | ) |
App timer ID of single shot measurement.
APP_TIMER_DEF | ( | m_p_pru_sensors_timer_id | ) |
App timer ID of repeating sensor measurement.
|
static |
Start advertising.
Initialize advertisement data, and start advertising.
Definition at line 57 of file pru.c.
|
static |
Dispatches a System stack event to flash storage module.
This function is called after a system event has been received.
[in] | event | Bluetooth stack event. |
Definition at line 90 of file pru.c.
|
static |
GAP initialization.
This function shall be used to setup all the necessary GAP (Generic Access Profile) parameters of the device. It also sets the permissions and appearance.
Definition at line 101 of file pru.c.
|
static |
Handle PRU SM events that require profile handling.
evt | The event |
Definition at line 132 of file pru.c.
|
static |
Forward events to the PRU state machine. Also handles the resulting request event.
[in] | evt | PRU state machine event. |
Definition at line 175 of file pru.c.
|
static |
WPT Service event handler.
This function handles events from the WPT Service.
[in] | p_wpts | WPT Service context. |
[in] | p_evt | Event. |
Definition at line 239 of file pru.c.
|
static |
BLE stack GAP event handler.
This function handles BLE GAP events.
[in] | p_ble_evt | Bluetooth stack event. |
Definition at line 271 of file pru.c.
|
static |
Set PRU dynamic data.
Updates the characteristic attributes with p_pru_sensor_data.
[in] | p_wpts | WPT Service context. |
[in] | p_pru_sensor_data | PRU sensor data |
Definition at line 375 of file pru.c.
|
static |
Sensors measurement timer timeout handler.
This function will be called each time the sensors measurement timer expires.
[in] | p_context | Pointer used for passing some arbitrary information (context) from the app_start_timer() call to the timeout handler. |
Definition at line 417 of file pru.c.
|
static |
|
static |
|
static |
|
static |
|
static |