File tree 1 file changed +4
-13
lines changed
cores/arduino/stm32/usb/cdc
1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 23
23
/* Includes ------------------------------------------------------------------*/
24
24
#include "usbd_desc.h"
25
25
#include "usbd_cdc_if.h"
26
+ #include "backup.h"
26
27
27
28
#ifdef USE_USB_HS
28
29
#define CDC_MAX_PACKET_SIZE USB_OTG_HS_MAX_PACKET_SIZE
@@ -229,19 +230,9 @@ static int8_t USBD_CDC_Receive(uint8_t *Buf, uint32_t *Len)
229
230
*/
230
231
if (dtr_toggling > 3 ) {
231
232
if ((Buf [0 ] == '1' ) && (Buf [1 ] == 'E' ) && (Buf [2 ] == 'A' ) && (Buf [3 ] == 'F' )) {
232
- #if defined (HIDBL_F1 )
233
- RTC_HandleTypeDef hrtc ;
234
- __HAL_RCC_PWR_CLK_ENABLE ();
235
- __HAL_RCC_BKP_CLK_ENABLE ();
236
- HAL_PWR_EnableBkUpAccess ();
237
- HAL_RTCEx_BKUPWrite (& hrtc , RTC_BKP_DR10 , 0x424C ); //Write the magic number 0x424C
238
-
239
- #elif defined (HIDBL_F4 )
240
- __HAL_RCC_PWR_CLK_ENABLE ();
241
- HAL_PWR_EnableBkUpAccess ();
242
- __BKPSRAM_CLK_ENABLE ();
243
- * (__IO uint32_t * )(BKPSRAM_BASE ) = 0x424C ; //Write the magic number 0x424C at Backup SRAM address 0x40024000
244
-
233
+ #if defined (HIDBL_F1 ) || defined (HIDBL_F4 )
234
+ enableBackupRegister ();
235
+ setBackupRegister (LL_RTC_BKP_DR10 , 0x424C );
245
236
#endif
246
237
HAL_NVIC_SystemReset ();
247
238
}
You can’t perform that action at this time.
0 commit comments