Appiko
Macros | Functions | Variables
System level testing application for Sense Rev4 board

The main file for System level testing application which is used to test functioning of board. More...

Macros

#define TRIGGER   2
 
#define FOCUS   3
 
#define PRODUCT_ID_LEN   16
 

Functions

void ble_stack_init (void)
 Function for initializing the BLE stack by enabling the SoftDevice and the BLE event interrupt. More...
 
void conn_to_sense_pi (void)
 Function to generate table of scanned devices with MAC addresses. More...
 
void extract_product_id (void)
 Function to extract Product ID from Scan response data. More...
 
uint32_t if_pulse (uint32_t pin_trigger, uint32_t pin_focus)
 Function to detect pulses from trigger pin and focus pin. More...
 
void scan_start ()
 Function to start scanning. More...
 
void check_pir (void)
 Function to check if PIR is present or not. More...
 
void recv_data (uint8_t *buffer)
 IRQHandler for UART RX_DONE event. More...
 
int main (void)
 MAIN.
 

Variables

volatile uint32_t conn_terminate_flag = 0
 
uint8_t scan_resp [BLE_GAP_SCAN_BUFFER_MAX] = {}
 
uint8_t scan_data_buffer [BLE_GAP_SCAN_BUFFER_MAX]
 
ble_data_t sys_lvl_app_scan_buffer
 

Detailed Description

Macro Definition Documentation

◆ FOCUS

#define FOCUS   3

Pin number for focus pin

Definition at line 60 of file main.c.

◆ PRODUCT_ID_LEN

#define PRODUCT_ID_LEN   16

Standard product length of Appiko product

Definition at line 63 of file main.c.

◆ TRIGGER

#define TRIGGER   2

Defines Pin number for trigger pin

Definition at line 58 of file main.c.

Function Documentation

◆ ble_stack_init()

void ble_stack_init ( void  )

BLE Stack Initialization.

Definition at line 278 of file main.c.

References APP_ERROR_CHECK, app_error_fault_handler(), and BOARD_LFCLKSRC_STRUCT.

Referenced by scan_start().

◆ check_pir()

void check_pir ( void  )

Check PIR.

Definition at line 435 of file main.c.

Referenced by recv_data().

◆ conn_to_sense_pi()

void conn_to_sense_pi ( void  )

Detect SensePi.

Definition at line 312 of file main.c.

◆ extract_product_id()

void extract_product_id ( void  )

Extract Product ID.

Definition at line 363 of file main.c.

References PRODUCT_ID_LEN, and scan_resp.

◆ if_pulse()

uint32_t if_pulse ( uint32_t  pin_trigger,
uint32_t  pin_focus 
)

Detect Pulse at Trigger pin and Focus pin.

Parameters
pin_triggerTrigger pin's number
pin_focusFocus pin's number
Return values
toggle_flagIf this flag is 1 then both trigger and focus pulse is detected. And if this flag is 0 then not.

Loop to check for pulse in 16 sec window

Definition at line 376 of file main.c.

◆ recv_data()

void recv_data ( uint8_t *  buffer)

IRQ Handler for UART.

Parameters
bufferbuffer array to store information received over UART

Definition at line 453 of file main.c.

References check_pir(), and scan_start().

Referenced by main().

◆ scan_start()

void scan_start ( )

Scan Start.

Definition at line 298 of file main.c.

References ble_stack_init().

Referenced by recv_data().

Variable Documentation

◆ conn_terminate_flag

volatile uint32_t conn_terminate_flag = 0

Flag which is to be set to 1 after BLE connection is terminated

Definition at line 126 of file main.c.

Referenced by main().

◆ scan_data_buffer

uint8_t scan_data_buffer[BLE_GAP_SCAN_BUFFER_MAX]

Data buffer for storing BLE scanned data

Definition at line 136 of file main.c.

◆ scan_resp

uint8_t scan_resp[BLE_GAP_SCAN_BUFFER_MAX] = {}

Data buffer to store Scan Response from Sense Rev4

Definition at line 134 of file main.c.

Referenced by extract_product_id().

◆ sys_lvl_app_scan_buffer

ble_data_t sys_lvl_app_scan_buffer
Initial value:
= {
(BLE_GAP_SCAN_BUFFER_MAX),
}
uint8_t scan_data_buffer[BLE_GAP_SCAN_BUFFER_MAX]
Definition: main.c:136

Data structure required to store scan data

Definition at line 139 of file main.c.