Skip to content

Commit

Permalink
Merge pull request stm32duino#38
Browse files Browse the repository at this point in the history
Rework the STM32CubeWB FW files to ease update
  • Loading branch information
fpistm authored Dec 6, 2021
2 parents 095fe18 + 14c0f73 commit e1a92dd
Show file tree
Hide file tree
Showing 16 changed files with 1,395 additions and 1,306 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ https://github.com/arduino-libraries/ArduinoBLE
# Configuration
STM32Cube_WPAN has several configuration options, which are set in the `app_conf.h`.
This package has a default configuration named `app_conf_default.h`.
The user can include the file `app_conf_custom.h` to customize the ble application. Options wrapped in `#ifndef, #endif` in `app_conf_default.h` can be overwritten. Additional options can be added.
The user can include the file `app_conf_custom.h` to customize the BLE application.
Options wrapped in `#ifndef`, `#endif` in `app_conf_default.h` can be overwritten.
Additional options can be added.

## License

Expand Down
6 changes: 3 additions & 3 deletions src/utility/STM32Cube_FW/app_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#ifndef APP_CONF_H
#define APP_CONF_H

#include "ble_bufsize.h"
#include "hw.h"
#include "ble_bufsize.h"

#if __has_include("app_conf_custom.h")
#include "app_conf_custom.h"
#include "app_conf_custom.h"
#endif
#include "app_conf_default.h"

#endif /* APP_CONF_H */
#endif /* APP_CONF_H */
30 changes: 15 additions & 15 deletions src/utility/STM32Cube_FW/app_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
#define HCI_RESET 0x0C03

#ifndef BLE_SHARED_MEM_BYTE_ORDER
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
#endif
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128

/**
* Define Tx Power
*/
#ifndef CFG_TX_POWER
#define CFG_TX_POWER (0x18) /* -0.15dBm */
#define CFG_TX_POWER (0x18) /* -0.15dBm */
#endif

/******************************************************************************
Expand All @@ -53,7 +53,7 @@
* Valid values are from 1 to 8
*/
#ifndef CFG_BLE_NUM_LINK
#define CFG_BLE_NUM_LINK 8
#define CFG_BLE_NUM_LINK 8
#endif

/**
Expand All @@ -62,7 +62,7 @@
* services
*/
#ifndef CFG_BLE_NUM_GATT_SERVICES
#define CFG_BLE_NUM_GATT_SERVICES 8
#define CFG_BLE_NUM_GATT_SERVICES 8
#endif

/**
Expand All @@ -72,14 +72,14 @@
* added automatically during device initialization so this parameters should be 9 plus the number of user Attributes
*/
#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
#endif

/**
* Maximum supported ATT_MTU size
*/
#ifndef CFG_BLE_MAX_ATT_MTU
#define CFG_BLE_MAX_ATT_MTU (156)
#define CFG_BLE_MAX_ATT_MTU (156)
#endif

/**
Expand All @@ -94,15 +94,15 @@
* The total amount of memory needed is the sum of the above quantities for each attribute.
*/
#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
#endif

/**
* Prepare Write List size in terms of number of packet
*/
//#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
#endif

/**
Expand All @@ -111,21 +111,21 @@
//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU,
// CFG_BLE_NUM_LINK))
#ifndef CFG_BLE_MBLOCK_COUNT
#define CFG_BLE_MBLOCK_COUNT (0x79)
#define CFG_BLE_MBLOCK_COUNT (0x79)
#endif

/**
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
*/
#ifndef CFG_BLE_DATA_LENGTH_EXTENSION
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
#endif

/**
* Sleep clock accuracy in Slave mode (ppm value)
*/
#ifndef CFG_BLE_SLAVE_SCA
#define CFG_BLE_SLAVE_SCA 500
#define CFG_BLE_SLAVE_SCA 500
#endif

/**
Expand All @@ -140,7 +140,7 @@
* 7 : 0 ppm to 20 ppm
*/
#ifndef CFG_BLE_MASTER_SCA
#define CFG_BLE_MASTER_SCA 0
#define CFG_BLE_MASTER_SCA 0
#endif

/**
Expand All @@ -149,21 +149,21 @@
* 0 : external crystal ( no calibration )
*/
#ifndef CFG_BLE_LSE_SOURCE
#define CFG_BLE_LSE_SOURCE 0
#define CFG_BLE_LSE_SOURCE 0
#endif

/**
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
*/
#ifndef CFG_BLE_HSE_STARTUP_TIME
#define CFG_BLE_HSE_STARTUP_TIME 0x148
#define CFG_BLE_HSE_STARTUP_TIME 0x148
#endif

/**
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
*/
#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
#endif

/**
Expand Down
18 changes: 9 additions & 9 deletions src/utility/STM32Cube_FW/ble_bufsize.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,35 @@

/*
* BLE_FIXED_BUFFER_SIZE_BYTES:
* A part of the RAM, is dynamically allocated by initializing all the pointers
* A part of the RAM, is dynamically allocated by initializing all the pointers
* defined in a global context variable "mem_alloc_ctx_p".
* This initialization is made in the Dynamic_allocator functions, which
* This initialization is made in the Dynamic_allocator functions, which
* assign a portion of RAM given by the external application to the above
* mentioned "global pointers".
*
* The size of this Dynamic RAM is made of 2 main components:
* The size of this Dynamic RAM is made of 2 main components:
* - a part that is parameters-dependent (num of links, GATT buffers, ...),
* and which value is defined by the following macro;
* - a part, that may be considered "fixed", i.e. independent from the above
* mentioned parameters.
*/
#if (SLAVE_ONLY == 0) && (LL_ONLY == 0)
#define BLE_FIXED_BUFFER_SIZE_BYTES 6960 /* Full stack */
#define BLE_FIXED_BUFFER_SIZE_BYTES 6960 /* Full stack */
#elif SLAVE_ONLY == 0
#define BLE_FIXED_BUFFER_SIZE_BYTES 6256 /* LL only */
#define BLE_FIXED_BUFFER_SIZE_BYTES 6256 /* LL only */
#else
#define BLE_FIXED_BUFFER_SIZE_BYTES 6696 /* Slave only */
#define BLE_FIXED_BUFFER_SIZE_BYTES 6696 /* Slave only */
#endif

/*
* BLE_PER_LINK_SIZE_BYTES: additional memory size used per link
*/
#if (SLAVE_ONLY == 0) && (LL_ONLY == 0)
#define BLE_PER_LINK_SIZE_BYTES 380 /* Full stack */
#define BLE_PER_LINK_SIZE_BYTES 380 /* Full stack */
#elif SLAVE_ONLY == 0
#define BLE_PER_LINK_SIZE_BYTES 196 /* LL only */
#define BLE_PER_LINK_SIZE_BYTES 196 /* LL only */
#else
#define BLE_PER_LINK_SIZE_BYTES 332 /* Slave only */
#define BLE_PER_LINK_SIZE_BYTES 332 /* Slave only */
#endif

/*
Expand Down
102 changes: 51 additions & 51 deletions src/utility/STM32Cube_FW/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm32_def.h"
#include "stm32wbxx_ll_bus.h"
#include "stm32wbxx_ll_exti.h"
Expand All @@ -37,56 +37,56 @@ extern "C" {
#include "stm32wbxx_ll_utils.h"
#include "stm32wbxx_ll_pwr.h"

/******************************************************************************
* HW IPCC
******************************************************************************/
void HW_IPCC_Enable(void);
void HW_IPCC_Init(void);

void HW_IPCC_BLE_Init(void);
void HW_IPCC_BLE_SendCmd(void);
void HW_IPCC_MM_SendFreeBuf(void (*cb)(void));
void HW_IPCC_BLE_RxEvtNot(void);
void HW_IPCC_BLE_SendAclData(void);
void HW_IPCC_BLE_AclDataAckNot(void);

void HW_IPCC_SYS_Init(void);
void HW_IPCC_SYS_SendCmd(void);
void HW_IPCC_SYS_CmdEvtNot(void);
void HW_IPCC_SYS_EvtNot(void);

void HW_IPCC_THREAD_Init(void);
void HW_IPCC_OT_SendCmd(void);
void HW_IPCC_CLI_SendCmd(void);
void HW_IPCC_THREAD_SendAck(void);
void HW_IPCC_OT_CmdEvtNot(void);
void HW_IPCC_CLI_CmdEvtNot(void);
void HW_IPCC_THREAD_EvtNot(void);
void HW_IPCC_THREAD_CliSendAck(void);
void HW_IPCC_THREAD_CliEvtNot(void);


void HW_IPCC_LLDTESTS_Init(void);
void HW_IPCC_LLDTESTS_SendCliCmd(void);
void HW_IPCC_LLDTESTS_ReceiveCliRsp(void);
void HW_IPCC_LLDTESTS_SendCliRspAck(void);
void HW_IPCC_LLDTESTS_ReceiveM0Cmd(void);
void HW_IPCC_LLDTESTS_SendM0CmdAck(void);


void HW_IPCC_LLD_BLE_Init(void);
void HW_IPCC_LLD_BLE_SendCliCmd(void);
void HW_IPCC_LLD_BLE_ReceiveCliRsp(void);
void HW_IPCC_LLD_BLE_SendCliRspAck(void);
void HW_IPCC_LLD_BLE_ReceiveM0Cmd(void);
void HW_IPCC_LLD_BLE_SendM0CmdAck(void);
void HW_IPCC_LLD_BLE_SendCmd(void);
void HW_IPCC_LLD_BLE_ReceiveRsp(void);
void HW_IPCC_LLD_BLE_SendRspAck(void);


void HW_IPCC_TRACES_Init(void);
void HW_IPCC_TRACES_EvtNot(void);
/******************************************************************************
* HW IPCC
******************************************************************************/
void HW_IPCC_Enable( void );
void HW_IPCC_Init( void );

void HW_IPCC_BLE_Init( void );
void HW_IPCC_BLE_SendCmd( void );
void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) );
void HW_IPCC_BLE_RxEvtNot( void );
void HW_IPCC_BLE_SendAclData( void );
void HW_IPCC_BLE_AclDataAckNot( void );

void HW_IPCC_SYS_Init( void );
void HW_IPCC_SYS_SendCmd( void );
void HW_IPCC_SYS_CmdEvtNot( void );
void HW_IPCC_SYS_EvtNot( void );

void HW_IPCC_THREAD_Init( void );
void HW_IPCC_OT_SendCmd( void );
void HW_IPCC_CLI_SendCmd( void );
void HW_IPCC_THREAD_SendAck( void );
void HW_IPCC_OT_CmdEvtNot( void );
void HW_IPCC_CLI_CmdEvtNot( void );
void HW_IPCC_THREAD_EvtNot( void );
void HW_IPCC_THREAD_CliSendAck( void );
void HW_IPCC_THREAD_CliEvtNot( void );


void HW_IPCC_LLDTESTS_Init( void );
void HW_IPCC_LLDTESTS_SendCliCmd( void );
void HW_IPCC_LLDTESTS_ReceiveCliRsp( void );
void HW_IPCC_LLDTESTS_SendCliRspAck( void );
void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void );
void HW_IPCC_LLDTESTS_SendM0CmdAck( void );


void HW_IPCC_LLD_BLE_Init( void );
void HW_IPCC_LLD_BLE_SendCliCmd( void );
void HW_IPCC_LLD_BLE_ReceiveCliRsp( void );
void HW_IPCC_LLD_BLE_SendCliRspAck( void );
void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void );
void HW_IPCC_LLD_BLE_SendM0CmdAck( void );
void HW_IPCC_LLD_BLE_SendCmd( void );
void HW_IPCC_LLD_BLE_ReceiveRsp( void );
void HW_IPCC_LLD_BLE_SendRspAck( void );

void HW_IPCC_TRACES_Init( void );
void HW_IPCC_TRACES_EvtNot( void );

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit e1a92dd

Please sign in to comment.