Skip to content

Commit c39a13d

Browse files
committed
STM32Cube_FW_WB_V1.4.0 - template part
1 parent b4f3b07 commit c39a13d

File tree

8 files changed

+605
-173
lines changed

8 files changed

+605
-173
lines changed

targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/app_common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
******************************************************************************
2+
******************************************************************************
33
* File Name : app_common.h
4-
* Description : App Common application configuration file for BLE
5-
* middleWare.
6-
******************************************************************************
4+
* Description : App Common application configuration file for STM32WPAN Middleware.
5+
*
6+
******************************************************************************
77
* @attention
88
*
99
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.

targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/app_conf.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "hw.h"
2626
#include "hw_conf.h"
27+
#include "hw_if.h"
2728

2829
/******************************************************************************
2930
* Transparent Mode Config
@@ -431,6 +432,13 @@ typedef enum
431432
CFG_LPM_APP,
432433
} CFG_LPM_Id_t;
433434

434-
#endif /*__APP_CONFIG_H */
435+
/******************************************************************************
436+
* OTP manager
437+
******************************************************************************/
438+
#define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE
439+
440+
#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR
441+
442+
#endif /*APP_CONF_H */
435443

436444
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/hw_conf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* USER CODE BEGIN Header */
22
/**
3-
******************************************************************************
3+
******************************************************************************
44
* File Name : hw_conf.h
55
* Description : Hardware configuration file for BLE
66
* middleWare.
77
******************************************************************************
88
* @attention
99
*
10-
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10+
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
1111
* All rights reserved.</center></h2>
1212
*
1313
* This software component is licensed by ST under BSD 3-Clause license,
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file hw_if.h
5+
* @author MCD Application Team
6+
* @brief Hardware Interface
7+
******************************************************************************
8+
* @attention
9+
*
10+
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
11+
* All rights reserved.</center></h2>
12+
*
13+
* This software component is licensed by ST under Ultimate Liberty license
14+
* SLA0044, the "License"; You may not use this file except in compliance with
15+
* the License. You may obtain a copy of the License at:
16+
* www.st.com/SLA0044
17+
*
18+
******************************************************************************
19+
*/
20+
/* USER CODE END Header */
21+
22+
/* Define to prevent recursive inclusion -------------------------------------*/
23+
#ifndef HW_IF_H
24+
#define HW_IF_H
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/* Includes ------------------------------------------------------------------*/
31+
#include "stm32wbxx.h"
32+
#include "stm32wbxx_ll_exti.h"
33+
#include "stm32wbxx_ll_system.h"
34+
#include "stm32wbxx_ll_rcc.h"
35+
#include "stm32wbxx_ll_ipcc.h"
36+
#include "stm32wbxx_ll_bus.h"
37+
#include "stm32wbxx_ll_pwr.h"
38+
#include "stm32wbxx_ll_cortex.h"
39+
#include "stm32wbxx_ll_utils.h"
40+
#include "stm32wbxx_ll_hsem.h"
41+
#include "stm32wbxx_ll_gpio.h"
42+
#include "stm32wbxx_ll_rtc.h"
43+
44+
#ifdef USE_STM32WBXX_USB_DONGLE
45+
#include "stm32wbxx_usb_dongle.h"
46+
#endif
47+
#ifdef USE_STM32WBXX_NUCLEO
48+
#include "stm32wbxx_nucleo.h"
49+
#endif
50+
#ifdef USE_X_NUCLEO_EPD
51+
#include "x_nucleo_epd.h"
52+
#endif
53+
54+
/* Private includes ----------------------------------------------------------*/
55+
/* USER CODE BEGIN Includes */
56+
57+
/* USER CODE END Includes */
58+
59+
/******************************************************************************
60+
* HW UART
61+
******************************************************************************/
62+
typedef enum
63+
{
64+
hw_uart1,
65+
hw_uart2,
66+
hw_lpuart1,
67+
} hw_uart_id_t;
68+
69+
typedef enum
70+
{
71+
hw_uart_ok,
72+
hw_uart_error,
73+
hw_uart_busy,
74+
hw_uart_to,
75+
} hw_status_t;
76+
77+
void HW_UART_Init(hw_uart_id_t hw_uart_id);
78+
void HW_UART_Receive_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void));
79+
void HW_UART_Transmit_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void));
80+
hw_status_t HW_UART_Transmit(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, uint32_t timeout);
81+
hw_status_t HW_UART_Transmit_DMA(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, void (*Callback)(void));
82+
void HW_UART_Interrupt_Handler(hw_uart_id_t hw_uart_id);
83+
void HW_UART_DMA_Interrupt_Handler(hw_uart_id_t hw_uart_id);
84+
85+
/******************************************************************************
86+
* HW TimerServer
87+
******************************************************************************/
88+
/* Exported types ------------------------------------------------------------*/
89+
/**
90+
* This setting is used when standby mode is supported.
91+
* hw_ts_InitMode_Limited should be used when the device restarts from Standby Mode. In that case, the Timer Server does
92+
* not re-initialized its context. Only the Hardware register which content has been lost is reconfigured
93+
* Otherwise, hw_ts_InitMode_Full should be requested (Start from Power ON) and everything is re-initialized.
94+
*/
95+
typedef enum
96+
{
97+
hw_ts_InitMode_Full,
98+
hw_ts_InitMode_Limited,
99+
} HW_TS_InitMode_t;
100+
101+
/**
102+
* When a Timer is created as a SingleShot timer, it is not automatically restarted when the timeout occurs. However,
103+
* the timer is kept reserved in the list and could be restarted at anytime with HW_TS_Start()
104+
*
105+
* When a Timer is created as a Repeated timer, it is automatically restarted when the timeout occurs.
106+
*/
107+
typedef enum
108+
{
109+
hw_ts_SingleShot,
110+
hw_ts_Repeated
111+
} HW_TS_Mode_t;
112+
113+
/**
114+
* hw_ts_Successful is returned when a Timer has been successfully created with HW_TS_Create(). Otherwise, hw_ts_Failed
115+
* is returned. When hw_ts_Failed is returned, that means there are not enough free slots in the list to create a
116+
* Timer. In that case, CFG_HW_TS_MAX_NBR_CONCURRENT_TIMER should be increased
117+
*/
118+
typedef enum
119+
{
120+
hw_ts_Successful,
121+
hw_ts_Failed,
122+
}HW_TS_ReturnStatus_t;
123+
124+
typedef void (*HW_TS_pTimerCb_t)(void);
125+
126+
/**
127+
* @brief Initialize the timer server
128+
* This API shall be called by the application before any timer is requested to the timer server. It
129+
* configures the RTC module to be connected to the LSI input clock.
130+
*
131+
* @param TimerInitMode: When the device restarts from Standby, it should request hw_ts_InitMode_Limited so that the
132+
* Timer context is not re-initialized. Otherwise, hw_ts_InitMode_Full should be requested
133+
* @param hrtc: RTC Handle
134+
* @retval None
135+
*/
136+
void HW_TS_Init(HW_TS_InitMode_t TimerInitMode, RTC_HandleTypeDef *hrtc);
137+
138+
/**
139+
* @brief Interface to create a virtual timer
140+
* The user shall call this API to create a timer. Once created, the timer is reserved to the module until it
141+
* has been deleted. When creating a timer, the user shall specify the mode (single shot or repeated), the
142+
* callback to be notified when the timer expires and a module ID to identify in the timer interrupt handler
143+
* which module is concerned. In return, the user gets a timer ID to handle it.
144+
*
145+
* @param TimerProcessID: This is an identifier provided by the user and returned in the callback to allow
146+
* identification of the requester
147+
* @param pTimerId: Timer Id returned to the user to request operation (start, stop, delete)
148+
* @param TimerMode: Mode of the virtual timer (Single shot or repeated)
149+
* @param pTimerCallBack: Callback when the virtual timer expires
150+
* @retval HW_TS_ReturnStatus_t: Return whether the creation is sucessfull or not
151+
*/
152+
HW_TS_ReturnStatus_t HW_TS_Create(uint32_t TimerProcessID, uint8_t *pTimerId, HW_TS_Mode_t TimerMode, HW_TS_pTimerCb_t pTimerCallBack);
153+
154+
/**
155+
* @brief Stop a virtual timer
156+
* This API may be used to stop a running timer. A timer which is stopped is move to the pending state.
157+
* A pending timer may be restarted at any time with a different timeout value but the mode cannot be changed.
158+
* Nothing is done when it is called to stop a timer which has been already stopped
159+
*
160+
* @param TimerID: Id of the timer to stop
161+
* @retval None
162+
*/
163+
void HW_TS_Stop(uint8_t TimerID);
164+
165+
/**
166+
* @brief Start a virtual timer
167+
* This API shall be used to start a timer. The timeout value is specified and may be different each time.
168+
* When the timer is in the single shot mode, it will move to the pending state when it expires. The user may
169+
* restart it at any time with a different timeout value. When the timer is in the repeated mode, it always
170+
* stay in the running state. When the timer expires, it will be restarted with the same timeout value.
171+
* This API shall not be called on a running timer.
172+
*
173+
* @param TimerID: The ID Id of the timer to start
174+
* @param timeout_ticks: Number of ticks of the virtual timer (Maximum value is (0xFFFFFFFF-0xFFFF = 0xFFFF0000)
175+
* @retval None
176+
*/
177+
void HW_TS_Start(uint8_t TimerID, uint32_t timeout_ticks);
178+
179+
/**
180+
* @brief Delete a virtual timer from the list
181+
* This API should be used when a timer is not needed anymore by the user. A deleted timer is removed from
182+
* the timer list managed by the timer server. It cannot be restarted again. The user has to go with the
183+
* creation of a new timer if required and may get a different timer id
184+
*
185+
* @param TimerID: The ID of the timer to remove from the list
186+
* @retval None
187+
*/
188+
void HW_TS_Delete(uint8_t TimerID);
189+
190+
/**
191+
* @brief Schedule the timer list on the timer interrupt handler
192+
* This interrupt handler shall be called by the application in the RTC interrupt handler. This handler takes
193+
* care of clearing all status flag required in the RTC and EXTI peripherals
194+
*
195+
* @param None
196+
* @retval None
197+
*/
198+
void HW_TS_RTC_Wakeup_Handler(void);
199+
200+
/**
201+
* @brief Return the number of ticks to count before the interrupt
202+
* This API returns the number of ticks left to be counted before an interrupt is generated by the
203+
* Timer Server. This API may be used by the application for power management optimization. When the system
204+
* enters low power mode, the mode selection is a tradeoff between the wakeup time where the CPU is running
205+
* and the time while the CPU will be kept in low power mode before next wakeup. The deeper is the
206+
* low power mode used, the longer is the wakeup time. The low power mode management considering wakeup time
207+
* versus time in low power mode is implementation specific
208+
* When the timer is disabled (No timer in the list), it returns 0xFFFF
209+
*
210+
* @param None
211+
* @retval The number of ticks left to count
212+
*/
213+
uint16_t HW_TS_RTC_ReadLeftTicksToCount(void);
214+
215+
/**
216+
* @brief Notify the application that a registered timer has expired
217+
* This API shall be implemented by the user application.
218+
* This API notifies the application that a timer expires. This API is running in the RTC Wakeup interrupt
219+
* context. The application may implement an Operating System to change the context priority where the timer
220+
* callback may be handled. This API provides the module ID to identify which module is concerned and to allow
221+
* sending the information to the correct task
222+
*
223+
* @param TimerProcessID: The TimerProcessId associated with the timer when it has been created
224+
* @param TimerID: The TimerID of the expired timer
225+
* @param pTimerCallBack: The Callback associated with the timer when it has been created
226+
* @retval None
227+
*/
228+
void HW_TS_RTC_Int_AppNot(uint32_t TimerProcessID, uint8_t TimerID, HW_TS_pTimerCb_t pTimerCallBack);
229+
230+
/**
231+
* @brief Notify the application that the wakeupcounter has been updated
232+
* This API should be implemented by the user application
233+
* This API notifies the application that the counter has been updated. This is expected to be used along
234+
* with the HW_TS_RTC_ReadLeftTicksToCount () API. It could be that the counter has been updated since the
235+
* last call of HW_TS_RTC_ReadLeftTicksToCount () and before entering low power mode. This notification
236+
* provides a way to the application to solve that race condition to reevaluate the counter value before
237+
* entering low power mode
238+
*
239+
* @param None
240+
* @retval None
241+
*/
242+
void HW_TS_RTC_CountUpdated_AppNot(void);
243+
244+
#ifdef __cplusplus
245+
}
246+
#endif
247+
248+
#endif /*HW_IF_H */
249+
250+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)