Buoyancy Firmware  v1.0
Buoyancy Vehicle Firmware Documentation
main.c

Template project main file. More...

Functions

 BLE_NUS_DEF (m_nus, NRF_SDH_BLE_TOTAL_LINK_COUNT)
 BLE NUS service instance. More...
 
 NRF_BLE_GATT_DEF (m_gatt)
 GATT module instance. More...
 
 NRF_BLE_QWR_DEF (m_qwr)
 Context for the Queued Write module. More...
 
 BLE_ADVERTISING_DEF (m_advertising)
 Advertising module instance. More...
 
void hallEffectInterrupt_handler (void)
 < Hall Effect Interrupt handler More...
 
void limitSwitchBottom_handler (void)
 limitSwitchTop Interrupt handler More...
 
void limitSwitchTop_handler (void)
 TMP117 Alert Interrupt handler. More...
 
void TMP_temp_Alert_Interrupt_handler (void)
 MotionSensor Interrupt handler. More...
 
void motionSensorInterrupt_handler (void)
 
void assert_nrf_callback (uint16_t line_num, const uint8_t *p_file_name)
 Callback function for asserts in the SoftDevice. More...
 
void pm_evt_handler (pm_evt_t const *p_evt)
 Function for handling Peer Manager events. More...
 
void gatt_evt_handler (nrf_ble_gatt_t *p_gatt, nrf_ble_gatt_evt_t const *p_evt)
 Function for handling events from the GATT library. More...
 
void menu_handler (ble_evt_t const *p_evt)
 Function for handling data received to the application. More...
 
void uart_event_handle (app_uart_evt_t *p_event)
 Function for handling app_uart events. More...
 
void idle_state_handle (void)
 
More...
 
void gatt_init (void)
 Function for initializing the GATT library. More...
 
void sleep_mode_enter (void)
 Function for putting the chip into sleep mode. More...
 
void nus_send (uint8_t data[], uint16_t length)
 
void advertising_start (bool erase_bonds)
 Function for starting advertising. More...
 
void HFCLKstart ()
 
void BLEdisconnect ()
 
void disableAdvOnDisconnect (void)
 
void enableAdvOnDisconnect (void)
 
bool BLEconnected ()
 
void stopAdvertising ()
 
void readTMP117 (uint8_t *tempMSB, uint8_t *tempLSB)
 
int main (void)
 Function for application main entry. More...
 

Variables

bool getValue = false
 Menu is waiting for value from BLE application. More...
 
bool transferDataFlag = false
 Menu is in the process of transfering data to BLE application. More...
 
bool updateFSM = true
 Init to true in order to access state machine. More...
 
bool sendNUS = false
 Flag to signal Nordic UART Service to send data. More...
 
bool motorStopped = false
 Flag to signal if motor is stopped or need to be stopped. More...
 
mission_t mission
 
FSM_t fsm
 
enum menu currentMenu
 

Detailed Description

Template project main file.

This file contains a template for creating a new application. It has the code necessary to wakeup from button, advertise, get a connection, restart advertising on disconnect, and if no new connection created go back to system-off mode. It can easily be used as a starting point for creating a new application, the comments identified with 'YOUR_JOB' indicates where and how you can customize.

Function Documentation

◆ advertising_start()

void advertising_start ( bool  erase_bonds)

Function for starting advertising.

◆ assert_nrf_callback()

void assert_nrf_callback ( uint16_t  line_num,
const uint8_t p_file_name 
)

Callback function for asserts in the SoftDevice.

This function will be called in case of an assert in the SoftDevice.

Warning
This handler is an example only and does not fit a final product. You need to analyze how your product is supposed to react in case of Assert.
On assert from the SoftDevice, the system can only recover on reset.
Parameters
[in]line_numLine number of the failing ASSERT call.
[in]file_nameFile name of the failing ASSERT call.

◆ BLE_ADVERTISING_DEF()

BLE_ADVERTISING_DEF ( m_advertising  )

Advertising module instance.

◆ BLE_NUS_DEF()

BLE_NUS_DEF ( m_nus  ,
NRF_SDH_BLE_TOTAL_LINK_COUNT   
)

BLE NUS service instance.

◆ BLEconnected()

bool BLEconnected ( void  )

◆ BLEdisconnect()

void BLEdisconnect ( void  )

◆ disableAdvOnDisconnect()

void disableAdvOnDisconnect ( void  )

◆ enableAdvOnDisconnect()

void enableAdvOnDisconnect ( void  )

◆ gatt_evt_handler()

void gatt_evt_handler ( nrf_ble_gatt_t *  p_gatt,
nrf_ble_gatt_evt_t const *  p_evt 
)

Function for handling events from the GATT library.

◆ gatt_init()

void gatt_init ( void  )

Function for initializing the GATT library.

◆ hallEffectInterrupt_handler()

void hallEffectInterrupt_handler ( void  )

< Hall Effect Interrupt handler

limitSwitchBottom Interrupt handler

◆ HFCLKstart()

void HFCLKstart ( )

◆ idle_state_handle()

void idle_state_handle ( void  )

Function for handling the idle state (main loop).

If there is no pending log operation, then sleep until next the next event occurs.

◆ limitSwitchBottom_handler()

void limitSwitchBottom_handler ( void  )

limitSwitchTop Interrupt handler

◆ limitSwitchTop_handler()

void limitSwitchTop_handler ( void  )

TMP117 Alert Interrupt handler.

◆ main()

int main ( void  )

Function for application main entry.

◆ menu_handler()

void menu_handler ( ble_evt_t const *  p_evt)

Function for handling data received to the application.

◆ motionSensorInterrupt_handler()

void motionSensorInterrupt_handler ( void  )

◆ NRF_BLE_GATT_DEF()

NRF_BLE_GATT_DEF ( m_gatt  )

GATT module instance.

◆ NRF_BLE_QWR_DEF()

NRF_BLE_QWR_DEF ( m_qwr  )

Context for the Queued Write module.

◆ nus_send()

void nus_send ( uint8_t  data[],
uint16_t  length 
)

< End of array

< Set dataPkg to 0

◆ pm_evt_handler()

void pm_evt_handler ( pm_evt_t const *  p_evt)

Function for handling Peer Manager events.

Parameters
[in]p_evtPeer Manager event.

◆ readTMP117()

void readTMP117 ( uint8_t tempMSB,
uint8_t tempLSB 
)

<Temperature register within TMP117

◆ sleep_mode_enter()

void sleep_mode_enter ( void  )

Function for putting the chip into sleep mode.

Note
This function will not return.

◆ stopAdvertising()

void stopAdvertising ( void  )

◆ TMP_temp_Alert_Interrupt_handler()

void TMP_temp_Alert_Interrupt_handler ( void  )

MotionSensor Interrupt handler.

◆ uart_event_handle()

void uart_event_handle ( app_uart_evt_t *  p_event)

Function for handling app_uart events.

This function will receive a single character from the app_uart module and append it to a string. The string will be be sent over BLE when the last character received was a 'new line' '
' (hex 0x0A) or if the string has reached the maximum data length.

< Go to failure state to change LED to RED and 'float to surface'

< Go to failure state to change LED to RED and 'float to surface'

Variable Documentation

◆ currentMenu

enum menu currentMenu

◆ fsm

FSM_t fsm

◆ getValue

bool getValue = false

Menu is waiting for value from BLE application.

◆ mission

mission_t mission

◆ motorStopped

bool motorStopped = false

Flag to signal if motor is stopped or need to be stopped.

◆ sendNUS

bool sendNUS = false

Flag to signal Nordic UART Service to send data.

◆ transferDataFlag

bool transferDataFlag = false

Menu is in the process of transfering data to BLE application.

◆ updateFSM

bool updateFSM = true

Init to true in order to access state machine.