Master Thesis
V1.0
Research and Design of Sensor Node for NMSD Treatment
|
Send data via BLE wirelessly. More...
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | DIY 1 |
#define | BUFFER_SIZE 80 |
#define | BLE_ERROR 99 |
#define | BLE_POWER_PIN 11 |
#define | BLE_POWER_PORT gpioPortB |
#define | BLE_PIN_TX 0 |
#define | BLE_PIN_RX 1 |
#define | BLE_PORT gpioPortC |
#define | BLE_USART USART1 |
#define | BLE_LED2_PIN 10 |
#define | BLE_LED2_PORT gpioPortA |
#define | BLE_OUTPUT_POWER_4DB 0x04 |
#define | BLE_OUTPUT_POWER_0DB 0x00 |
#define | BLE_OUTPUT_POWER_N4DB 0xFC |
#define | BLE_OUTPUT_POWER_N8DB 0xF8 |
#define | BLE_OUTPUT_POWER_N12DB 0xF4 |
#define | BLE_OUTPUT_POWER_N16DB 0xF0 |
#define | BLE_OUTPUT_POWER_N20DB 0xEC |
#define | BLE_OUTPUT_POWER_N40DB 0xD8 |
Functions | |
void | BLE_power (bool enable) |
Turn power on/off for BLE module. More... | |
void | BLE_Init () |
BLE chip init. 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_packet) |
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 *input, uint8_t *out) |
Float to uint8_t conversion x3. More... | |
void | BLE_set_output_power (uint8_t power) |
Set BLE output power. More... | |
Variables | |
char | RX_buffer [BUFFER_SIZE] |
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().
char RX_buffer[BUFFER_SIZE] |