IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
|
#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>
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 |
void add_characteristic | ( | int | identifier | ) |
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.
event | |
gatts_if | |
param |
esp_err_t ble_init | ( | void | ) |
Initializes BLE application with all the needed drivers and components.
< 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)
esp_err_t ble_notify_float | ( | float | value, |
uint16_t | char_handler ) |
Notify a float value.
value | |
char_handler |
< Generic esp_err_t code indicating failure
esp_err_t ble_notify_uint8 | ( | uint8_t | value, |
uint16_t | char_handler ) |
Notify a uint8_t value.
value | |
char_handler |
< Generic esp_err_t code indicating failure
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)
void crete_characteristics | ( | void | ) |
Create the characteristic.
esp_err_t update_rocket_acc_x | ( | float | value | ) |
Notify new X-axis linear acceleration.
value | new X-axis linear acceleration value. |
esp_err_t update_rocket_acc_y | ( | float | value | ) |
Notify new Y-axis linear acceleration.
value | new Y-axis linear acceleration value. |
esp_err_t update_rocket_acc_z | ( | float | value | ) |
Notify new Z-axis linear acceleration.
value | new Z-axis linear acceleration value. |
esp_err_t update_rocket_altitude | ( | float | value | ) |
Notify altitude over BLE.
value | new altitude value. |
esp_err_t update_rocket_pressure | ( | int32_t | value | ) |
Notify pressure over BLE.
value | new pressure value. |
esp_err_t update_rocket_rot_x | ( | float | value | ) |
Notify new X-axis angular acceleration.
value | new X-axis angular acceleration value. |
esp_err_t update_rocket_rot_y | ( | float | value | ) |
Notify new Y-axis angular acceleration.
value | new Y-axis angular acceleration value. |
esp_err_t update_rocket_rot_z | ( | float | value | ) |
Notify new Z-axis angular acceleration.
value | new Z-axis angular acceleration value. |
esp_err_t update_rocket_speed | ( | float | value | ) |
Notify speed over BLE.
value | new rocket speed value. |
esp_err_t update_rocket_status | ( | int | value | ) |
Notify rocket status over BLE.
value | new rocket status. |
esp_err_t update_rocket_temperature | ( | float | value | ) |
Notify temperature over BLE.
value | new temperature value. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |