[FL-3271] cubewb: updated to v1.16.0 (#2595)
* cubewb: updated project to v1.16.0 * hal: updated api_symbols for f18 * FuriHal: add missing enterprise sleep and insomnia * FuriHal: slightly more paranoic sleep mode Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
parent
3932503660
commit
4d015a1106
@ -20,7 +20,7 @@ DIST_SUFFIX = "local"
|
||||
COPRO_OB_DATA = "scripts/ob.data"
|
||||
|
||||
# Must match lib/STM32CubeWB version
|
||||
COPRO_CUBE_VERSION = "1.13.3"
|
||||
COPRO_CUBE_VERSION = "1.16.0"
|
||||
|
||||
COPRO_CUBE_DIR = "lib/STM32CubeWB"
|
||||
|
||||
|
@ -176,17 +176,17 @@ Header,+,lib/toolbox/tar/tar_archive.h,,
|
||||
Header,+,lib/toolbox/value_index.h,,
|
||||
Header,+,lib/toolbox/version.h,,
|
||||
Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef*
|
||||
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, LL_ADC_CommonInitTypeDef*"
|
||||
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, const LL_ADC_CommonInitTypeDef*"
|
||||
Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef*
|
||||
Function,-,LL_ADC_DeInit,ErrorStatus,ADC_TypeDef*
|
||||
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_INJ_InitTypeDef*"
|
||||
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_INJ_InitTypeDef*"
|
||||
Function,-,LL_ADC_INJ_StructInit,void,LL_ADC_INJ_InitTypeDef*
|
||||
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_REG_InitTypeDef*"
|
||||
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_REG_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_StructInit,void,LL_ADC_REG_InitTypeDef*
|
||||
Function,-,LL_ADC_StructInit,void,LL_ADC_InitTypeDef*
|
||||
Function,-,LL_COMP_DeInit,ErrorStatus,COMP_TypeDef*
|
||||
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, LL_COMP_InitTypeDef*"
|
||||
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, const LL_COMP_InitTypeDef*"
|
||||
Function,-,LL_COMP_StructInit,void,LL_COMP_InitTypeDef*
|
||||
Function,-,LL_CRC_DeInit,ErrorStatus,CRC_TypeDef*
|
||||
Function,-,LL_CRS_DeInit,ErrorStatus,
|
||||
@ -199,16 +199,16 @@ Function,-,LL_EXTI_StructInit,void,LL_EXTI_InitTypeDef*
|
||||
Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef*
|
||||
Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*"
|
||||
Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef*
|
||||
Function,-,LL_I2C_DeInit,ErrorStatus,I2C_TypeDef*
|
||||
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, LL_I2C_InitTypeDef*"
|
||||
Function,-,LL_I2C_DeInit,ErrorStatus,const I2C_TypeDef*
|
||||
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, const LL_I2C_InitTypeDef*"
|
||||
Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef*
|
||||
Function,-,LL_Init1msTick,void,uint32_t
|
||||
Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef*
|
||||
Function,-,LL_LPTIM_Disable,void,LPTIM_TypeDef*
|
||||
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, LL_LPTIM_InitTypeDef*"
|
||||
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, const LL_LPTIM_InitTypeDef*"
|
||||
Function,-,LL_LPTIM_StructInit,void,LL_LPTIM_InitTypeDef*
|
||||
Function,-,LL_LPUART_DeInit,ErrorStatus,USART_TypeDef*
|
||||
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, LL_LPUART_InitTypeDef*"
|
||||
Function,-,LL_LPUART_DeInit,ErrorStatus,const USART_TypeDef*
|
||||
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, const LL_LPUART_InitTypeDef*"
|
||||
Function,-,LL_LPUART_StructInit,void,LL_LPUART_InitTypeDef*
|
||||
Function,-,LL_PKA_DeInit,ErrorStatus,PKA_TypeDef*
|
||||
Function,-,LL_PKA_Init,ErrorStatus,"PKA_TypeDef*, LL_PKA_InitTypeDef*"
|
||||
@ -253,23 +253,23 @@ Function,+,LL_SPI_Init,ErrorStatus,"SPI_TypeDef*, LL_SPI_InitTypeDef*"
|
||||
Function,-,LL_SPI_StructInit,void,LL_SPI_InitTypeDef*
|
||||
Function,-,LL_SetFlashLatency,ErrorStatus,uint32_t
|
||||
Function,+,LL_SetSystemCoreClock,void,uint32_t
|
||||
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_BDTR_InitTypeDef*"
|
||||
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_BDTR_InitTypeDef*"
|
||||
Function,-,LL_TIM_BDTR_StructInit,void,LL_TIM_BDTR_InitTypeDef*
|
||||
Function,+,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
|
||||
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_ENCODER_InitTypeDef*"
|
||||
Function,-,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
|
||||
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_ENCODER_InitTypeDef*"
|
||||
Function,-,LL_TIM_ENCODER_StructInit,void,LL_TIM_ENCODER_InitTypeDef*
|
||||
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_HALLSENSOR_InitTypeDef*"
|
||||
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_HALLSENSOR_InitTypeDef*"
|
||||
Function,-,LL_TIM_HALLSENSOR_StructInit,void,LL_TIM_HALLSENSOR_InitTypeDef*
|
||||
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_IC_InitTypeDef*"
|
||||
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_IC_InitTypeDef*"
|
||||
Function,-,LL_TIM_IC_StructInit,void,LL_TIM_IC_InitTypeDef*
|
||||
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_InitTypeDef*"
|
||||
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_OC_InitTypeDef*"
|
||||
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_InitTypeDef*"
|
||||
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_OC_InitTypeDef*"
|
||||
Function,-,LL_TIM_OC_StructInit,void,LL_TIM_OC_InitTypeDef*
|
||||
Function,-,LL_TIM_StructInit,void,LL_TIM_InitTypeDef*
|
||||
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, LL_USART_ClockInitTypeDef*"
|
||||
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, const LL_USART_ClockInitTypeDef*"
|
||||
Function,-,LL_USART_ClockStructInit,void,LL_USART_ClockInitTypeDef*
|
||||
Function,-,LL_USART_DeInit,ErrorStatus,USART_TypeDef*
|
||||
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, LL_USART_InitTypeDef*"
|
||||
Function,-,LL_USART_DeInit,ErrorStatus,const USART_TypeDef*
|
||||
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, const LL_USART_InitTypeDef*"
|
||||
Function,-,LL_USART_StructInit,void,LL_USART_InitTypeDef*
|
||||
Function,-,LL_mDelay,void,uint32_t
|
||||
Function,-,SystemCoreClockUpdate,void,
|
||||
|
|
@ -208,17 +208,17 @@ Header,+,lib/toolbox/tar/tar_archive.h,,
|
||||
Header,+,lib/toolbox/value_index.h,,
|
||||
Header,+,lib/toolbox/version.h,,
|
||||
Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef*
|
||||
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, LL_ADC_CommonInitTypeDef*"
|
||||
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, const LL_ADC_CommonInitTypeDef*"
|
||||
Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef*
|
||||
Function,-,LL_ADC_DeInit,ErrorStatus,ADC_TypeDef*
|
||||
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_INJ_InitTypeDef*"
|
||||
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_INJ_InitTypeDef*"
|
||||
Function,-,LL_ADC_INJ_StructInit,void,LL_ADC_INJ_InitTypeDef*
|
||||
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_REG_InitTypeDef*"
|
||||
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_REG_InitTypeDef*"
|
||||
Function,-,LL_ADC_REG_StructInit,void,LL_ADC_REG_InitTypeDef*
|
||||
Function,-,LL_ADC_StructInit,void,LL_ADC_InitTypeDef*
|
||||
Function,-,LL_COMP_DeInit,ErrorStatus,COMP_TypeDef*
|
||||
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, LL_COMP_InitTypeDef*"
|
||||
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, const LL_COMP_InitTypeDef*"
|
||||
Function,-,LL_COMP_StructInit,void,LL_COMP_InitTypeDef*
|
||||
Function,-,LL_CRC_DeInit,ErrorStatus,CRC_TypeDef*
|
||||
Function,-,LL_CRS_DeInit,ErrorStatus,
|
||||
@ -231,16 +231,16 @@ Function,-,LL_EXTI_StructInit,void,LL_EXTI_InitTypeDef*
|
||||
Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef*
|
||||
Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*"
|
||||
Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef*
|
||||
Function,-,LL_I2C_DeInit,ErrorStatus,I2C_TypeDef*
|
||||
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, LL_I2C_InitTypeDef*"
|
||||
Function,-,LL_I2C_DeInit,ErrorStatus,const I2C_TypeDef*
|
||||
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, const LL_I2C_InitTypeDef*"
|
||||
Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef*
|
||||
Function,-,LL_Init1msTick,void,uint32_t
|
||||
Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef*
|
||||
Function,-,LL_LPTIM_Disable,void,LPTIM_TypeDef*
|
||||
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, LL_LPTIM_InitTypeDef*"
|
||||
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, const LL_LPTIM_InitTypeDef*"
|
||||
Function,-,LL_LPTIM_StructInit,void,LL_LPTIM_InitTypeDef*
|
||||
Function,-,LL_LPUART_DeInit,ErrorStatus,USART_TypeDef*
|
||||
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, LL_LPUART_InitTypeDef*"
|
||||
Function,-,LL_LPUART_DeInit,ErrorStatus,const USART_TypeDef*
|
||||
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, const LL_LPUART_InitTypeDef*"
|
||||
Function,-,LL_LPUART_StructInit,void,LL_LPUART_InitTypeDef*
|
||||
Function,-,LL_PKA_DeInit,ErrorStatus,PKA_TypeDef*
|
||||
Function,-,LL_PKA_Init,ErrorStatus,"PKA_TypeDef*, LL_PKA_InitTypeDef*"
|
||||
@ -285,23 +285,23 @@ Function,+,LL_SPI_Init,ErrorStatus,"SPI_TypeDef*, LL_SPI_InitTypeDef*"
|
||||
Function,-,LL_SPI_StructInit,void,LL_SPI_InitTypeDef*
|
||||
Function,-,LL_SetFlashLatency,ErrorStatus,uint32_t
|
||||
Function,+,LL_SetSystemCoreClock,void,uint32_t
|
||||
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_BDTR_InitTypeDef*"
|
||||
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_BDTR_InitTypeDef*"
|
||||
Function,-,LL_TIM_BDTR_StructInit,void,LL_TIM_BDTR_InitTypeDef*
|
||||
Function,+,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
|
||||
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_ENCODER_InitTypeDef*"
|
||||
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_ENCODER_InitTypeDef*"
|
||||
Function,-,LL_TIM_ENCODER_StructInit,void,LL_TIM_ENCODER_InitTypeDef*
|
||||
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_HALLSENSOR_InitTypeDef*"
|
||||
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_HALLSENSOR_InitTypeDef*"
|
||||
Function,-,LL_TIM_HALLSENSOR_StructInit,void,LL_TIM_HALLSENSOR_InitTypeDef*
|
||||
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_IC_InitTypeDef*"
|
||||
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_IC_InitTypeDef*"
|
||||
Function,-,LL_TIM_IC_StructInit,void,LL_TIM_IC_InitTypeDef*
|
||||
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_InitTypeDef*"
|
||||
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_OC_InitTypeDef*"
|
||||
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_InitTypeDef*"
|
||||
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_OC_InitTypeDef*"
|
||||
Function,-,LL_TIM_OC_StructInit,void,LL_TIM_OC_InitTypeDef*
|
||||
Function,-,LL_TIM_StructInit,void,LL_TIM_InitTypeDef*
|
||||
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, LL_USART_ClockInitTypeDef*"
|
||||
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, const LL_USART_ClockInitTypeDef*"
|
||||
Function,-,LL_USART_ClockStructInit,void,LL_USART_ClockInitTypeDef*
|
||||
Function,-,LL_USART_DeInit,ErrorStatus,USART_TypeDef*
|
||||
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, LL_USART_InitTypeDef*"
|
||||
Function,-,LL_USART_DeInit,ErrorStatus,const USART_TypeDef*
|
||||
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, const LL_USART_InitTypeDef*"
|
||||
Function,-,LL_USART_StructInit,void,LL_USART_InitTypeDef*
|
||||
Function,-,LL_mDelay,void,uint32_t
|
||||
Function,-,SystemCoreClockUpdate,void,
|
||||
|
|
@ -33,6 +33,7 @@ extern "C" {
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <core/common_defines.h>
|
||||
#include <tl.h>
|
||||
|
||||
#include "app_conf.h"
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#define CFG_TX_POWER (0x19) /* +0dBm */
|
||||
|
||||
#define CFG_IDENTITY_ADDRESS GAP_PUBLIC_ADDR
|
||||
|
||||
/**
|
||||
* Define Advertising parameters
|
||||
*/
|
||||
|
@ -33,7 +33,8 @@ PLACE_IN_SECTION("MB_MEM2")
|
||||
ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig = {0, 0, 0, 0};
|
||||
PLACE_IN_SECTION("MB_MEM2")
|
||||
ALIGN(4)
|
||||
static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig = {BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}};
|
||||
static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig =
|
||||
{BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}, 0, 0, 0, 0, 0};
|
||||
|
||||
/**
|
||||
* THE DEBUG ON GPIO FOR CPU2 IS INTENDED TO BE USED ONLY ON REQUEST FROM ST SUPPORT
|
||||
|
@ -18,8 +18,8 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static TL_CmdPacket_t ble_app_cmd_buffer;
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint32_t ble_app_nvm[BLE_NVM_SRAM_SIZE];
|
||||
|
||||
_Static_assert(
|
||||
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 49,
|
||||
"Ble stack config structure size mismatch");
|
||||
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 58,
|
||||
"Ble stack config structure size mismatch (check new config options - last updated for v.1.16.0)");
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* hci_mtx;
|
||||
@ -88,6 +88,12 @@ bool ble_app_init() {
|
||||
.min_tx_power = 0,
|
||||
.max_tx_power = 0,
|
||||
.rx_model_config = 1,
|
||||
/* New stack (13.3->16.0)*/
|
||||
.max_adv_set_nbr = 1, // Only used if SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV is set
|
||||
.max_adv_data_len = 31, // Only used if SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV is set
|
||||
.tx_path_compens = 0, // RF TX Path Compensation, * 0.1 dB
|
||||
.rx_path_compens = 0, // RF RX Path Compensation, * 0.1 dB
|
||||
.ble_core_version = 11, // BLE Core Version: 11(5.2), 12(5.3)
|
||||
}};
|
||||
status = SHCI_C2_BLE_Init(&ble_init_cmd_packet);
|
||||
if(status) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <ble/core/ble_std.h>
|
||||
#include <ble/core/ble_defs.h>
|
||||
#include "osal.h"
|
||||
#include "compiler.h"
|
||||
|
||||
/* Default BLE variant */
|
||||
#ifndef BASIC_FEATURES
|
||||
@ -34,6 +35,9 @@
|
||||
#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
|
||||
|
@ -403,7 +403,9 @@ void shci_cmd_resp_release(uint32_t flag) {
|
||||
void shci_cmd_resp_wait(uint32_t timeout) {
|
||||
UNUSED(timeout);
|
||||
if(ble_glue) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
furi_semaphore_acquire(ble_glue->shci_sem, FuriWaitForever);
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*****************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2018-2022 STMicroelectronics.
|
||||
* Copyright (c) 2018-2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
@ -18,6 +18,14 @@
|
||||
#ifndef COMPILER_H__
|
||||
#define COMPILER_H__
|
||||
|
||||
#ifndef __PACKED_STRUCT
|
||||
#define __PACKED_STRUCT PACKED(struct)
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED_UNION
|
||||
#define __PACKED_UNION PACKED(union)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief This is the section dedicated to IAR toolchain
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "gap.h"
|
||||
|
||||
#include "app_common.h"
|
||||
#include <ble/ble.h>
|
||||
|
||||
#include <furi_hal.h>
|
||||
@ -85,7 +86,7 @@ static void gap_verify_connection_parameters(Gap* gap) {
|
||||
SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
hci_event_pckt* event_pckt;
|
||||
evt_le_meta_event* meta_evt;
|
||||
evt_blue_aci* blue_evt;
|
||||
evt_blecore_aci* blue_evt;
|
||||
hci_le_phy_update_complete_event_rp0* evt_le_phy_update_complete;
|
||||
uint8_t tx_phy;
|
||||
uint8_t rx_phy;
|
||||
@ -97,7 +98,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
furi_mutex_acquire(gap->state_mutex, FuriWaitForever);
|
||||
}
|
||||
switch(event_pckt->evt) {
|
||||
case EVT_DISCONN_COMPLETE: {
|
||||
case HCI_DISCONNECTION_COMPLETE_EVT_CODE: {
|
||||
hci_disconnection_complete_event_rp0* disconnection_complete_event =
|
||||
(hci_disconnection_complete_event_rp0*)event_pckt->data;
|
||||
if(disconnection_complete_event->Connection_Handle == gap->service.connection_handle) {
|
||||
@ -106,6 +107,8 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
FURI_LOG_I(
|
||||
TAG, "Disconnect from client. Reason: %02X", disconnection_complete_event->Reason);
|
||||
}
|
||||
// Enterprise sleep
|
||||
furi_delay_us(666 + 666);
|
||||
if(gap->enable_adv) {
|
||||
// Restart advertising
|
||||
gap_advertise_start(GapStateAdvFast);
|
||||
@ -114,10 +117,10 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
gap->on_event_cb(event, gap->context);
|
||||
} break;
|
||||
|
||||
case EVT_LE_META_EVENT:
|
||||
case HCI_LE_META_EVT_CODE:
|
||||
meta_evt = (evt_le_meta_event*)event_pckt->data;
|
||||
switch(meta_evt->subevent) {
|
||||
case EVT_LE_CONN_UPDATE_COMPLETE: {
|
||||
case HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE: {
|
||||
hci_le_connection_update_complete_event_rp0* event =
|
||||
(hci_le_connection_update_complete_event_rp0*)meta_evt->data;
|
||||
gap->connection_params.conn_interval = event->Conn_Interval;
|
||||
@ -128,7 +131,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
break;
|
||||
}
|
||||
|
||||
case EVT_LE_PHY_UPDATE_COMPLETE:
|
||||
case HCI_LE_PHY_UPDATE_COMPLETE_SUBEVT_CODE:
|
||||
evt_le_phy_update_complete = (hci_le_phy_update_complete_event_rp0*)meta_evt->data;
|
||||
if(evt_le_phy_update_complete->Status) {
|
||||
FURI_LOG_E(
|
||||
@ -144,7 +147,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_LE_CONN_COMPLETE: {
|
||||
case HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE: {
|
||||
hci_le_connection_complete_event_rp0* event =
|
||||
(hci_le_connection_complete_event_rp0*)meta_evt->data;
|
||||
gap->connection_params.conn_interval = event->Conn_Interval;
|
||||
@ -168,16 +171,16 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_VENDOR:
|
||||
blue_evt = (evt_blue_aci*)event_pckt->data;
|
||||
case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE:
|
||||
blue_evt = (evt_blecore_aci*)event_pckt->data;
|
||||
switch(blue_evt->ecode) {
|
||||
aci_gap_pairing_complete_event_rp0* pairing_complete;
|
||||
|
||||
case EVT_BLUE_GAP_LIMITED_DISCOVERABLE:
|
||||
case ACI_GAP_LIMITED_DISCOVERABLE_VSEVT_CODE:
|
||||
FURI_LOG_I(TAG, "Limited discoverable event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_PASS_KEY_REQUEST: {
|
||||
case ACI_GAP_PASS_KEY_REQ_VSEVT_CODE: {
|
||||
// Generate random PIN code
|
||||
uint32_t pin = rand() % 999999; //-V1064
|
||||
aci_gap_pass_key_resp(gap->service.connection_handle, pin);
|
||||
@ -190,7 +193,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
gap->on_event_cb(event, gap->context);
|
||||
} break;
|
||||
|
||||
case EVT_BLUE_ATT_EXCHANGE_MTU_RESP: {
|
||||
case ACI_ATT_EXCHANGE_MTU_RESP_VSEVT_CODE: {
|
||||
aci_att_exchange_mtu_resp_event_rp0* pr = (void*)blue_evt->data;
|
||||
FURI_LOG_I(TAG, "Rx MTU size: %d", pr->Server_RX_MTU);
|
||||
// Set maximum packet size given header size is 3 bytes
|
||||
@ -199,32 +202,28 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
gap->on_event_cb(event, gap->context);
|
||||
} break;
|
||||
|
||||
case EVT_BLUE_GAP_AUTHORIZATION_REQUEST:
|
||||
case ACI_GAP_AUTHORIZATION_REQ_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Authorization request event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED:
|
||||
case ACI_GAP_SLAVE_SECURITY_INITIATED_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Slave security initiated");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_BOND_LOST:
|
||||
case ACI_GAP_BOND_LOST_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Bond lost event. Start rebonding");
|
||||
aci_gap_allow_rebond(gap->service.connection_handle);
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_DEVICE_FOUND:
|
||||
FURI_LOG_D(TAG, "Device found event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_ADDR_NOT_RESOLVED:
|
||||
case ACI_GAP_ADDR_NOT_RESOLVED_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Address not resolved event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_KEYPRESS_NOTIFICATION:
|
||||
case ACI_GAP_KEYPRESS_NOTIFICATION_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Key press notification event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_NUMERIC_COMPARISON_VALUE: {
|
||||
case ACI_GAP_NUMERIC_COMPARISON_VALUE_VSEVT_CODE: {
|
||||
uint32_t pin =
|
||||
((aci_gap_numeric_comparison_value_event_rp0*)(blue_evt->data))->Numeric_Value;
|
||||
FURI_LOG_I(TAG, "Verify numeric comparison: %06lu", pin);
|
||||
@ -234,7 +233,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
break;
|
||||
}
|
||||
|
||||
case EVT_BLUE_GAP_PAIRING_CMPLT:
|
||||
case ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE:
|
||||
pairing_complete = (aci_gap_pairing_complete_event_rp0*)blue_evt->data;
|
||||
if(pairing_complete->Status) {
|
||||
FURI_LOG_E(
|
||||
@ -249,11 +248,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_BLUE_GAP_PROCEDURE_COMPLETE:
|
||||
case ACI_L2CAP_CONNECTION_UPDATE_RESP_VSEVT_CODE:
|
||||
FURI_LOG_D(TAG, "Procedure complete event");
|
||||
break;
|
||||
|
||||
case EVT_BLUE_L2CAP_CONNECTION_UPDATE_RESP: {
|
||||
case ACI_L2CAP_CONNECTION_UPDATE_REQ_VSEVT_CODE: {
|
||||
uint16_t result =
|
||||
((aci_l2cap_connection_update_resp_event_rp0*)(blue_evt->data))->Result;
|
||||
if(result == 0) {
|
||||
@ -362,7 +361,7 @@ static void gap_init_svc(Gap* gap) {
|
||||
CFG_ENCRYPTION_KEY_SIZE_MAX,
|
||||
CFG_USED_FIXED_PIN,
|
||||
0,
|
||||
PUBLIC_ADDR);
|
||||
CFG_IDENTITY_ADDRESS);
|
||||
// Configure whitelist
|
||||
aci_gap_configure_whitelist();
|
||||
}
|
||||
@ -397,7 +396,7 @@ static void gap_advertise_start(GapState new_state) {
|
||||
ADV_IND,
|
||||
min_interval,
|
||||
max_interval,
|
||||
PUBLIC_ADDR,
|
||||
CFG_IDENTITY_ADDRESS,
|
||||
0,
|
||||
strlen(gap->service.adv_name),
|
||||
(uint8_t*)gap->service.adv_name,
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <furi_hal_flash.h>
|
||||
#include <furi_hal_bt.h>
|
||||
#include <furi_hal_power.h>
|
||||
#include <furi.h>
|
||||
#include <ble/ble.h>
|
||||
#include <interface/patterns/ble_thread/shci/shci.h>
|
||||
@ -114,6 +115,7 @@ static void furi_hal_flash_lock(void) {
|
||||
}
|
||||
|
||||
static void furi_hal_flash_begin_with_core2(bool erase_flag) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
/* Take flash controller ownership */
|
||||
while(LL_HSEM_1StepLock(HSEM, CFG_HW_FLASH_SEMID) != 0) {
|
||||
furi_thread_yield();
|
||||
@ -188,6 +190,7 @@ static void furi_hal_flash_end_with_core2(bool erase_flag) {
|
||||
|
||||
/* Release flash controller ownership */
|
||||
LL_HSEM_ReleaseLock(HSEM, CFG_HW_FLASH_SEMID, 0);
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
static void furi_hal_flash_end(bool erase_flag) {
|
||||
|
@ -29,6 +29,14 @@
|
||||
#define FURI_HAL_POWER_DEBUG_STOP_GPIO (&gpio_ext_pc3)
|
||||
#endif
|
||||
|
||||
#ifndef FURI_HAL_POWER_DEBUG_ABNORMAL_GPIO
|
||||
#define FURI_HAL_POWER_DEBUG_ABNORMAL_GPIO (&gpio_ext_pb3)
|
||||
#endif
|
||||
|
||||
#ifndef FURI_HAL_POWER_STOP_MODE
|
||||
#define FURI_HAL_POWER_STOP_MODE (LL_PWR_MODE_STOP2)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
volatile uint8_t insomnia;
|
||||
volatile uint8_t suppress_charge;
|
||||
@ -84,14 +92,16 @@ void furi_hal_power_init() {
|
||||
#ifdef FURI_HAL_POWER_DEBUG
|
||||
furi_hal_gpio_init_simple(FURI_HAL_POWER_DEBUG_WFI_GPIO, GpioModeOutputPushPull);
|
||||
furi_hal_gpio_init_simple(FURI_HAL_POWER_DEBUG_STOP_GPIO, GpioModeOutputPushPull);
|
||||
furi_hal_gpio_init_simple(FURI_HAL_POWER_DEBUG_ABNORMAL_GPIO, GpioModeOutputPushPull);
|
||||
furi_hal_gpio_write(FURI_HAL_POWER_DEBUG_WFI_GPIO, 0);
|
||||
furi_hal_gpio_write(FURI_HAL_POWER_DEBUG_STOP_GPIO, 0);
|
||||
furi_hal_gpio_write(FURI_HAL_POWER_DEBUG_ABNORMAL_GPIO, 0);
|
||||
#endif
|
||||
|
||||
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
|
||||
LL_PWR_SMPS_SetMode(LL_PWR_SMPS_STEP_DOWN);
|
||||
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
|
||||
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
|
||||
LL_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE);
|
||||
LL_C2_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE);
|
||||
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
bq27220_init(&furi_hal_i2c_handle_power, &cedv);
|
||||
@ -148,7 +158,9 @@ bool furi_hal_power_sleep_available() {
|
||||
|
||||
static inline bool furi_hal_power_deep_sleep_available() {
|
||||
return furi_hal_bt_is_alive() && !furi_hal_rtc_is_flag_set(FuriHalRtcFlagLegacySleep) &&
|
||||
!furi_hal_debug_is_gdb_session_active();
|
||||
!furi_hal_debug_is_gdb_session_active() && !LL_PWR_IsActiveFlag_CRPE() &&
|
||||
!LL_PWR_IsActiveFlag_CRP() && !LL_PWR_IsActiveFlag_BLEA() &&
|
||||
!LL_PWR_IsActiveFlag_BLEWU();
|
||||
}
|
||||
|
||||
static inline void furi_hal_power_light_sleep() {
|
||||
@ -199,7 +211,16 @@ static inline void furi_hal_power_deep_sleep() {
|
||||
__force_stores();
|
||||
#endif
|
||||
|
||||
bool should_abort_sleep = LL_PWR_IsActiveFlag_CRPE() || LL_PWR_IsActiveFlag_CRP() ||
|
||||
LL_PWR_IsActiveFlag_BLEA() || LL_PWR_IsActiveFlag_BLEWU();
|
||||
|
||||
if(should_abort_sleep) {
|
||||
#ifdef FURI_HAL_POWER_DEBUG
|
||||
furi_hal_gpio_write(FURI_HAL_POWER_DEBUG_ABNORMAL_GPIO, 1);
|
||||
#endif
|
||||
} else {
|
||||
__WFI();
|
||||
}
|
||||
|
||||
LL_LPM_EnableSleep();
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit a9e29b431f6dac95b6fc860a717834f35b7f78e5
|
||||
Subproject commit 06b8133fa295474507b55b1a5695d4b8bf804ed6
|
@ -14,7 +14,7 @@ IWDGSTOP:0x1:rw
|
||||
IWDGSW:0x1:rw
|
||||
IPCCDBA:0x0:rw
|
||||
ESE:0x1:r
|
||||
SFSA:0xD7:r
|
||||
SFSA:0xD5:r
|
||||
FSD:0x0:r
|
||||
DDS:0x1:r
|
||||
C2OPT:0x1:r
|
||||
@ -22,7 +22,7 @@ NBRSD:0x0:r
|
||||
SNBRSA:0xD:r
|
||||
BRSD:0x0:r
|
||||
SBRSA:0x12:r
|
||||
SBRV:0x35C00:r
|
||||
SBRV:0x35400:r
|
||||
PCROP1A_STRT:0x1FF:r
|
||||
PCROP1A_END:0x0:r
|
||||
PCROP_RDP:0x1:rw
|
||||
|
Loading…
Reference in New Issue
Block a user