IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
ble_c.c File Reference
#include "ble/ble_c.h"
#include "esp_bt.h"
#include "esp_bt_main.h"
#include "esp_gap_ble_api.h"
#include "esp_gatt_common_api.h"
#include "esp_gattc_api.h"
#include "esp_gatts_api.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include <string.h>
Include dependency graph for ble_c.c:

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 add_characteristic (int identifier)
void crete_characteristics (void)
 Create the characteristic.
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.
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.

Variables

static uint16_t char_handle_rocket_status = 0
static uint16_t char_handle_rocket_altitude = 0
static uint16_t char_handle_rocket_speed = 0
static uint16_t char_handle_rocket_pressure = 0
static uint16_t char_handle_rocket_temperature = 0
static uint16_t char_handle_rocket_acc_x = 0
static uint16_t char_handle_rocket_acc_y = 0
static uint16_t char_handle_rocket_acc_z = 0
static uint16_t char_handle_rocket_rot_x = 0
static uint16_t char_handle_rocket_rot_y = 0
static uint16_t char_handle_rocket_rot_z = 0
static int registered_char_count = 0
static uint16_t service_handle = 0
static esp_gatt_if_t gatts_if_global = 0
static uint16_t conn_id = 0
static bool is_connected = false
static uint16_t cccd_handle = 0

Function Documentation

◆ add_characteristic()

void add_characteristic ( int identifier)
Here is the caller graph for this function:

◆ 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

◆ cccd_handle

uint16_t cccd_handle = 0
static

◆ char_handle_rocket_acc_x

uint16_t char_handle_rocket_acc_x = 0
static

◆ char_handle_rocket_acc_y

uint16_t char_handle_rocket_acc_y = 0
static

◆ char_handle_rocket_acc_z

uint16_t char_handle_rocket_acc_z = 0
static

◆ char_handle_rocket_altitude

uint16_t char_handle_rocket_altitude = 0
static

◆ char_handle_rocket_pressure

uint16_t char_handle_rocket_pressure = 0
static

◆ char_handle_rocket_rot_x

uint16_t char_handle_rocket_rot_x = 0
static

◆ char_handle_rocket_rot_y

uint16_t char_handle_rocket_rot_y = 0
static

◆ char_handle_rocket_rot_z

uint16_t char_handle_rocket_rot_z = 0
static

◆ char_handle_rocket_speed

uint16_t char_handle_rocket_speed = 0
static

◆ char_handle_rocket_status

uint16_t char_handle_rocket_status = 0
static

◆ char_handle_rocket_temperature

uint16_t char_handle_rocket_temperature = 0
static

◆ conn_id

uint16_t conn_id = 0
static

◆ gatts_if_global

esp_gatt_if_t gatts_if_global = 0
static

◆ is_connected

bool is_connected = false
static

◆ registered_char_count

int registered_char_count = 0
static

◆ service_handle

uint16_t service_handle = 0
static