Buoyancy Firmware  1.0
Buoyancy Vehicle Firmware Documentation
main.c File Reference

Copyright (c) 2014 - 2019, Nordic Semiconductor ASA. More...

#include "main.h"
#include "FSM.h"
Include dependency graph for main.c:

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 button Interrupt handler. More...
 
void limitSwitchBottom_handler (void)
 Bottom limit switch Interrupt handler. More...
 
void limitSwitchTop_handler (void)
 Upper limit switch Interrupt handler. More...
 
void TMP_temp_Alert_Interrupt_handler (void)
 TMP117 Temperature Alert Interrupt handler. More...
 
void motionSensorInterrupt_handler (void)
 ICM20948 Motion Sensor Interrupt handler. More...
 
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 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 enablePressureSensor ()
 Function to enable pressure sensor. More...
 
void disablePressureSensor ()
 Function to disable pressure sensor. More...
 
void sleep_mode_enter (void)
 Function for putting the chip into sleep mode. More...
 
void nus_send (uint8_t data[], uint16_t length)
 Send data over BLE Nordic UART Service (NUS) More...
 
void advertising_start (bool erase_bonds)
 Function for starting advertising. More...
 
void HFCLKstart ()
 Start HFCLK from crystal oscillator, this will give the PWM and SAADC higher accuracy. More...
 
void BLEdisconnect ()
 Disconnect BLE connection. More...
 
void disableAdvOnDisconnect (void)
 disable restarted advertising upon disconnection. More...
 
void enableAdvOnDisconnect (void)
 enable restarted advertising upon disconnection. More...
 
bool BLEconnected ()
 Check if connected to client. More...
 
void stopAdvertising ()
 stop advertising More...
 
void readTMP117 (uint8_t *tempMSB, uint8_t *tempLSB)
 Read TMP117 16 bit temperature register. More...
 
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...
 
bool isAdvertising = false
 Flag to signal if advertising or not. More...
 
bool bottomLimit = false
 Flag to signal when bottom limit switch is reached. More...
 
mission_t mission
 Create mission struct instance. More...
 
FSM_t fsm
 Create Finite State Machine struct instance. More...
 
enum menu currentMenu
 Create menu enumeration instance to keep track of menu operations. More...
 

Detailed Description

Copyright (c) 2014 - 2019, Nordic Semiconductor ASA.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA integrated circuit in a product or a software update for such product, must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit.
  5. Any software provided in binary form under this license must not be reverse engineered, decompiled, modified and/or disassembled.

THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.