Master Thesis
V1.0
Research and Design of Sensor Node for NMSD Treatment
|
Send data via BLE wirelessly. More...
#include "ble.h"
#include "em_device.h"
#include "em_chip.h"
#include "em_cmu.h"
#include "em_emu.h"
#include "em_gpio.h"
#include "em_usart.h"
#include "em_rtc.h"
#include "em_adc.h"
#include "em_wdog.h"
#include "rtcdriver.h"
#include "em_core.h"
#include "debug_dbprint.h"
#include "delay.h"
#include "interrupt.h"
#include "adc.h"
#include "pinout.h"
#include <stdint.h>
#include <stdbool.h>
#include "uart.h"
Go to the source code of this file.
Functions | |
void | BLE_Init () |
BLE chip init. More... | |
void | BLE_power (bool enable) |
Turn power on/off for BLE module. More... | |
void | BLE_rxtx_enable (bool enable) |
Enable disable RX/TX pins from BLE module. More... | |
void | BLE_connect () |
Connect sequence BLE. More... | |
void | BLE_check_connect () |
Check if LED pin on BLE is high to check if the module is connected to a receiver. More... | |
void | BLE_disconnect () |
Disconnect BLE from receiver. More... | |
void | BLE_sendData4 (uint8_t data_in[]) |
Test function, not used. More... | |
void | BLE_sendData (uint8_t *data, uint8_t *batt, uint8_t length, uint8_t *ble_data) |
Send all the data over BLE. More... | |
void | BLE_readData (uint8_t *readData, uint8_t length) |
Test function, not used. More... | |
void | BLE_sendIMUData (uint8_t *gyroData, uint8_t *accelData, uint8_t *magnData) |
Test function, not used. More... | |
void | float_to_uint8_t (float *input, uint8_t *out) |
Float to uint8_t conversion. More... | |
void | float_to_uint8_t_x3 (float *in, uint8_t *out) |
Float to uint8_t conversion x3. More... | |
void | BLE_set_output_power (uint8_t power) |
Set BLE output power. More... | |
Variables | |
bool | ble_Initialized = false |
bool | check = false |
uint8_t | buffer [80] |
uint8_t | BLE_POWER_ON_RETURN [7] = { 0x02, 0x41, 0x02, 0x00, 0x01, 0x01, 0x41 } |
bool | bleConnected |
void BLE_check_connect | ( | ) |
Check if LED pin on BLE is high to check if the module is connected to a receiver.
Definition at line 179 of file ble.c.
References BLE_LED2_PIN, BLE_LED2_PORT, and bleConnected.
Referenced by measure_send().
void BLE_connect | ( | ) |
Connect sequence BLE.
The only function that's not send interrupt based (can be a future improvement)
Definition at line 152 of file ble.c.
Referenced by measure_send().
void BLE_disconnect | ( | ) |
void BLE_Init | ( | ) |
BLE chip init.
Init UART Init BLE power pin
Definition at line 61 of file ble.c.
References BLE_LED2_PIN, BLE_LED2_PORT, and uart_Init().
void BLE_power | ( | bool | enable | ) |
Turn power on/off for BLE module.
[in] | enable |
|
Definition at line 84 of file ble.c.
References BLE_POWER_PIN, and BLE_POWER_PORT.
Referenced by measure_send().
void BLE_readData | ( | uint8_t * | readData, |
uint8_t | length | ||
) |
void BLE_rxtx_enable | ( | bool | enable | ) |
Enable disable RX/TX pins from BLE module.
[in] | enable |
|
Definition at line 128 of file ble.c.
References BLE_PIN_RX, BLE_PIN_TX, and BLE_PORT.
void BLE_sendData | ( | uint8_t * | data, |
uint8_t * | batt, | ||
uint8_t | length, | ||
uint8_t * | ble_data | ||
) |
Send all the data over BLE.
[in] | data | Euler angles |
[in] | length | packet length |
[in] | batt | battery in percentage |
[out] | ble_data | return ble_data for debugging purposes |
Definition at line 261 of file ble.c.
References data, and uartPutData().
Referenced by measure_send().
void BLE_sendData4 | ( | uint8_t | data_in[] | ) |
void BLE_sendIMUData | ( | uint8_t * | gyroData, |
uint8_t * | accelData, | ||
uint8_t * | magnData | ||
) |
void BLE_set_output_power | ( | uint8_t | power | ) |
Set BLE output power.
Momentarily not used, since the reset value of the BLE is the one used
[in] | power | power value (see datasheet for options) |
Definition at line 441 of file ble.c.
References data, and uartPutData().
void float_to_uint8_t | ( | float * | input, |
uint8_t * | out | ||
) |
Float to uint8_t conversion.
[in] | input | float |
[out] | out | 4 x uint8_t's |
Definition at line 391 of file ble.c.
Referenced by float_to_uint8_t_x3().
void float_to_uint8_t_x3 | ( | float * | in, |
uint8_t * | out | ||
) |
Float to uint8_t conversion x3.
[in] | input | float |
[out] | out | 4 x uint8_t's |
Definition at line 419 of file ble.c.
References float_to_uint8_t().
Referenced by measure_send().
uint8_t BLE_POWER_ON_RETURN[7] = { 0x02, 0x41, 0x02, 0x00, 0x01, 0x01, 0x41 } |
bool bleConnected |
Keep track of the state of the BLE module
Definition at line 125 of file main.c.
Referenced by BLE_check_connect(), and measure_send().