mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-19 09:13:11 +00:00
338fc3afea
* Updated stack to 1.17.0 * hal: ble: Fixed stack config * Bumped stack version in config * scripts: added validation of copro stack version in update bundles * Copro: update to 1.17.2 * FuriHal: adjust tick frequency for HSE as sys clk * FuriHal: adjust systick reload on sys clock change * Sync api and format sources * scripts: updated ob.data for newer stack * FuriHal: return core2 hse pll transition on deep sleep * FuriHal: cleanup ble glue * FuriHal: rework ble glue, allow shci_send in critical section * FuriHal: sync api symbols * FuriHal: cleanup BLE glue, remove unused garbage and duplicate declarations * FuriHal: BLE glue cleanup, 2nd iteration * FuriHal: hide tick drift reports under FURI_HAL_OS_DEBUG * Lib: sync stm32wb_copro with latest dev * FuriHal: ble-glue, slightly less editable device name and duplicate definition cleanup * FuriHal: update ble config options, enable some optimizations and ext adv * FuriHal: update clock switch method documentation * FuriHal: better SNBRSA bug workaround fix * FuriHal: complete comment about tick skew * FuriHal: proper condition in clock hsi2hse transition * FuriHal: move PLL start to hse2pll routine, fix lockup caused by core2 switching to HSE before us * FuriHal: explicit HSE start before switch * FuriHal: fix documentation and move flash latency change to later stage, remove duplicate LL_RCC_SetRFWKPClockSource call --------- Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: hedger <hedger@users.noreply.github.com>
99 lines
2.4 KiB
C
99 lines
2.4 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <ble/core/ble_std.h>
|
|
#include <ble/core/ble_defs.h>
|
|
#include "osal.h"
|
|
#include "compiler.h"
|
|
|
|
/* Default BLE variant */
|
|
#ifndef BASIC_FEATURES
|
|
#define BASIC_FEATURES 0
|
|
#endif
|
|
#ifndef SLAVE_ONLY
|
|
#define SLAVE_ONLY 0
|
|
#endif
|
|
#ifndef LL_ONLY
|
|
#define LL_ONLY 0
|
|
#endif
|
|
#ifndef LL_ONLY_BASIC
|
|
#define LL_ONLY_BASIC 0
|
|
#endif
|
|
#ifndef BEACON_ONLY
|
|
#define BEACON_ONLY 0
|
|
#endif
|
|
|
|
/* Size of command/events buffers:
|
|
*
|
|
* To change the size of commands and events parameters used in the
|
|
* auto-generated files, you need to update 2 defines:
|
|
*
|
|
* - BLE_CMD_MAX_PARAM_LEN
|
|
* - BLE_EVT_MAX_PARAM_LEN
|
|
*
|
|
* These 2 defines are set below with default values and can be changed.
|
|
*
|
|
* To compute the value to support a characteristic of 512 bytes for a specific
|
|
* command or an event, you need to look in "ble_types.h".
|
|
*
|
|
* Here are 2 examples, one with a command and one with an event:
|
|
*
|
|
* - aci_gatt_update_char_value_ext_cp0
|
|
* ----------------------------------
|
|
*
|
|
* we have in the structure:
|
|
*
|
|
* uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)];
|
|
*
|
|
* so to support a 512 byte value, we need to have
|
|
*
|
|
* BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524
|
|
*
|
|
* - aci_gatt_read_handle_value_rp0
|
|
* ------------------------------
|
|
*
|
|
* we have in the structure:
|
|
*
|
|
* uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)];
|
|
*
|
|
* so to support a 512 byte value, we need to have
|
|
*
|
|
* BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520
|
|
*
|
|
* If you need several events or commands with 512-size values, you need to
|
|
* take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN.
|
|
*
|
|
*/
|
|
|
|
/* Maximum parameter size of BLE commands.
|
|
* Change this value if needed. */
|
|
#define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN
|
|
|
|
/* Maximum parameter size of BLE responses/events.
|
|
* Change this value if needed. */
|
|
#define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN
|
|
|
|
/* Callback function to send command and receive response */
|
|
struct hci_request {
|
|
uint16_t ogf;
|
|
uint16_t ocf;
|
|
int event;
|
|
void* cparam;
|
|
int clen;
|
|
void* rparam;
|
|
int rlen;
|
|
};
|
|
extern int hci_send_req(struct hci_request* req, uint8_t async);
|
|
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#endif
|
|
|
|
#ifndef MIN
|
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
#endif
|
|
|
|
#ifndef MAX
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
#endif
|