IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
ble_c.h File Reference
#include "esp_err.h"
#include "esp_gatts_api.h"
#include "sensors_reading/mpu6050/mpu6050_c.h"
#include "sensors_reading/sensors_reading.h"
#include <stdint.h>
Include dependency graph for ble_c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LO_UINT16(a)
#define HI_UINT16(a)
#define GATTS_SERVICE_UUID   0x00FF
#define GATTS_CHAR_UUID_ROCKET_STATUS   0xFF01
#define GATTS_CHAR_UUID_ROCKET_ALTITUDE   0xFF02
#define GATTS_CHAR_UUID_ROCKET_SPEED   0xFF03
#define GATTS_CHAR_UUID_ROCKET_PRESSURE   0xFF04
#define GATTS_CHAR_UUID_ROCKET_TEMPERATURE    0xFF05
#define GATTS_CHAR_UUID_ROCKET_ACC_X   0xFF06
#define GATTS_CHAR_UUID_ROCKET_ACC_Y   0xFF07
#define GATTS_CHAR_UUID_ROCKET_ACC_Z   0xFF08
#define GATTS_CHAR_UUID_ROCKET_ROT_X   0xFF09
#define GATTS_CHAR_UUID_ROCKET_ROT_Y   0xFF10
#define GATTS_CHAR_UUID_ROCKET_ROT_Z   0xFF11
#define GATTS_NUM_HANDLE   25
#define TAG_BLE   "BLE"

Functions

esp_err_t ble_init (void)
 Initializes BLE application with all the needed drivers and components.
void ble_gatts_event_handler (esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
 Callback function for GATT services.
void create_and_add_service (void)
 Create a and add service object.
void crete_characteristics (void)
 Create the characteristic.
esp_err_t ble_notify_float (float value, uint16_t char_handler)
 Notify a float value.
esp_err_t ble_notify_uint8 (uint8_t value, uint16_t char_handler)
 Notify a uint8_t value.
esp_err_t update_rocket_status (int value)
 Notify rocket status over BLE.
esp_err_t update_rocket_altitude (float value)
 Notify altitude over BLE.
esp_err_t update_rocket_speed (float value)
 Notify speed over BLE.
esp_err_t update_rocket_pressure (int32_t value)
 Notify pressure over BLE.
esp_err_t update_rocket_temperature (float value)
 Notify temperature over BLE.
esp_err_t update_rocket_acc_x (float value)
 Notify new X-axis linear acceleration.
esp_err_t update_rocket_acc_y (float value)
 Notify new Y-axis linear acceleration.
esp_err_t update_rocket_acc_z (float value)
 Notify new Z-axis linear acceleration.
esp_err_t update_rocket_rot_x (float value)
 Notify new X-axis angular acceleration.
esp_err_t update_rocket_rot_y (float value)
 Notify new Y-axis angular acceleration.
esp_err_t update_rocket_rot_z (float value)
 Notify new Z-axis angular acceleration.

Variables

ROCKET_STATUS_T rocket_status
mpu6050_acceleration_t rocket_accel
mpu6050_rotation_t rocket_rot
float rocket_temperature
float rocket_altitude
int32_t rocket_pressure

Macro Definition Documentation

◆ GATTS_CHAR_UUID_ROCKET_ACC_X

#define GATTS_CHAR_UUID_ROCKET_ACC_X   0xFF06

◆ GATTS_CHAR_UUID_ROCKET_ACC_Y

#define GATTS_CHAR_UUID_ROCKET_ACC_Y   0xFF07

◆ GATTS_CHAR_UUID_ROCKET_ACC_Z

#define GATTS_CHAR_UUID_ROCKET_ACC_Z   0xFF08

◆ GATTS_CHAR_UUID_ROCKET_ALTITUDE

#define GATTS_CHAR_UUID_ROCKET_ALTITUDE   0xFF02

◆ GATTS_CHAR_UUID_ROCKET_PRESSURE

#define GATTS_CHAR_UUID_ROCKET_PRESSURE   0xFF04

◆ GATTS_CHAR_UUID_ROCKET_ROT_X

#define GATTS_CHAR_UUID_ROCKET_ROT_X   0xFF09

◆ GATTS_CHAR_UUID_ROCKET_ROT_Y

#define GATTS_CHAR_UUID_ROCKET_ROT_Y   0xFF10

◆ GATTS_CHAR_UUID_ROCKET_ROT_Z

#define GATTS_CHAR_UUID_ROCKET_ROT_Z   0xFF11

◆ GATTS_CHAR_UUID_ROCKET_SPEED

#define GATTS_CHAR_UUID_ROCKET_SPEED   0xFF03

◆ GATTS_CHAR_UUID_ROCKET_STATUS

#define GATTS_CHAR_UUID_ROCKET_STATUS   0xFF01

◆ GATTS_CHAR_UUID_ROCKET_TEMPERATURE

#define GATTS_CHAR_UUID_ROCKET_TEMPERATURE    0xFF05

◆ GATTS_NUM_HANDLE

#define GATTS_NUM_HANDLE   25

◆ GATTS_SERVICE_UUID

#define GATTS_SERVICE_UUID   0x00FF

◆ HI_UINT16

#define HI_UINT16 ( a)
Value:
((uint8_t)(((a) >> 8) & 0xFF))

◆ LO_UINT16

#define LO_UINT16 ( a)
Value:
((uint8_t)((a) & 0xFF))

◆ TAG_BLE

#define TAG_BLE   "BLE"

Function Documentation

◆ ble_gatts_event_handler()

void ble_gatts_event_handler ( esp_gatts_cb_event_t event,
esp_gatt_if_t gatts_if,
esp_ble_gatts_cb_param_t * param )

Callback function for GATT services.

Parameters
event
gatts_if
param
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ble_init()

esp_err_t ble_init ( void )

Initializes BLE application with all the needed drivers and components.

Returns
esp_err_t ESP_OK if success.

< Starting number of error codes

< NVS partition doesn't contain any empty pages. This may happen if NVS partition was truncated. Erase the whole partition and call nvs_flash_init again.

< Starting number of error codes

< NVS partition contains data in new format and cannot be recognized by this version of code

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ble_notify_float()

esp_err_t ble_notify_float ( float value,
uint16_t char_handler )

Notify a float value.

Parameters
value
char_handler
Returns
esp_err_t

< Generic esp_err_t code indicating failure

Here is the caller graph for this function:

◆ ble_notify_uint8()

esp_err_t ble_notify_uint8 ( uint8_t value,
uint16_t char_handler )

Notify a uint8_t value.

Parameters
value
char_handler
Returns
esp_err_t

< Generic esp_err_t code indicating failure

Here is the caller graph for this function:

◆ create_and_add_service()

void create_and_add_service ( void )

Create a and add service object.

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the caller graph for this function:

◆ crete_characteristics()

void crete_characteristics ( void )

Create the characteristic.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_acc_x()

esp_err_t update_rocket_acc_x ( float value)

Notify new X-axis linear acceleration.

Parameters
valuenew X-axis linear acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_acc_y()

esp_err_t update_rocket_acc_y ( float value)

Notify new Y-axis linear acceleration.

Parameters
valuenew Y-axis linear acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_acc_z()

esp_err_t update_rocket_acc_z ( float value)

Notify new Z-axis linear acceleration.

Parameters
valuenew Z-axis linear acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_altitude()

esp_err_t update_rocket_altitude ( float value)

Notify altitude over BLE.

Parameters
valuenew altitude value.
Returns
esp_err_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_pressure()

esp_err_t update_rocket_pressure ( int32_t value)

Notify pressure over BLE.

Parameters
valuenew pressure value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_rot_x()

esp_err_t update_rocket_rot_x ( float value)

Notify new X-axis angular acceleration.

Parameters
valuenew X-axis angular acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_rot_y()

esp_err_t update_rocket_rot_y ( float value)

Notify new Y-axis angular acceleration.

Parameters
valuenew Y-axis angular acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_rot_z()

esp_err_t update_rocket_rot_z ( float value)

Notify new Z-axis angular acceleration.

Parameters
valuenew Z-axis angular acceleration value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_speed()

esp_err_t update_rocket_speed ( float value)

Notify speed over BLE.

Parameters
valuenew rocket speed value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_status()

esp_err_t update_rocket_status ( int value)

Notify rocket status over BLE.

Parameters
valuenew rocket status.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_rocket_temperature()

esp_err_t update_rocket_temperature ( float value)

Notify temperature over BLE.

Parameters
valuenew temperature value.
Returns
esp_err_t ESP_OK if success.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ rocket_accel

mpu6050_acceleration_t rocket_accel
extern

◆ rocket_altitude

float rocket_altitude

◆ rocket_pressure

int32_t rocket_pressure
extern

◆ rocket_rot

mpu6050_rotation_t rocket_rot
extern

◆ rocket_status

ROCKET_STATUS_T rocket_status
extern

◆ rocket_temperature

float rocket_temperature
extern