diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..531f621
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,38 @@
+---
+BasedOnStyle: Microsoft
+Language: Cpp
+
+###################################
+# indent conf
+###################################
+
+UseTab: Never
+IndentWidth: 4
+TabWidth: 4
+ColumnLimit: 0
+AccessModifierOffset: -4
+NamespaceIndentation: All
+FixNamespaceComments: false
+BreakBeforeBraces: Allman
+
+###################################
+# other styles
+###################################
+
+#
+# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+#
+
+AllowShortIfStatementsOnASingleLine: true
+
+AllowShortLoopsOnASingleLine: true
+
+AllowShortBlocksOnASingleLine: true
+
+IndentCaseLabels: true
+
+SortIncludes: false
+
+AlignConsecutiveMacros: AcrossEmptyLines
+
+AlignConsecutiveAssignments: Consecutive
diff --git a/.cproject b/.cproject
index 4541c80..61dd5ee 100644
--- a/.cproject
+++ b/.cproject
@@ -14,7 +14,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -56,8 +56,8 @@
@@ -115,7 +116,9 @@
-
+
+
+
@@ -139,7 +142,7 @@
-
+
@@ -161,5 +164,5 @@
-
+
diff --git a/.project b/.project
index 622fa7e..d7d4c38 100644
--- a/.project
+++ b/.project
@@ -1,7 +1,7 @@
-
+
BLE_TYQ_CH592F
-
+
@@ -23,42 +23,10 @@
org.eclipse.cdt.managedbuilder.core.managedBuildNature
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
-
-
- HAL
- 2
- PARENT-1-PROJECT_LOC/HAL
-
-
- LIB
- 2
- PARENT-1-PROJECT_LOC/LIB
-
-
- Ld
- 2
- PARENT-2-PROJECT_LOC/SRC/Ld
-
-
- RVMSIS
- 2
- PARENT-2-PROJECT_LOC/SRC/RVMSIS
-
-
- Startup
- 2
- PARENT-2-PROJECT_LOC/SRC/Startup
-
-
- StdPeriphDriver
- 2
- PARENT-2-PROJECT_LOC/SRC/StdPeriphDriver
-
-
1602468250279
-
+
22
org.eclipse.ui.ide.multiFilter
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
new file mode 100644
index 0000000..5a29351
--- /dev/null
+++ b/.settings/language.settings.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APP/peripheral.c b/APP/peripheral.c
index 896a3cb..2b1c990 100644
--- a/APP/peripheral.c
+++ b/APP/peripheral.c
@@ -7,7 +7,7 @@
* ÇëÇó¸üÐÂÁ¬½Ó²ÎÊý£¬Í¨¹ý×Ô¶¨Òå·þÎñ´«ÊäÊý¾Ý
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
+ * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
@@ -40,23 +40,23 @@
#define SBP_PHY_UPDATE_DELAY 2400
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
-#define DEFAULT_ADVERTISING_INTERVAL 80
+#define DEFAULT_ADVERTISING_INTERVAL (160 * 10)
// Limited discoverable mode advertises for 30.72s, and then stops
// General discoverable mode advertises indefinitely
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL
// Minimum connection interval (units of 1.25ms, 6=7.5ms)
-#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6
+#define DEFAULT_DESIRED_MIN_CONN_INTERVAL (100)
// Maximum connection interval (units of 1.25ms, 100=125ms)
-#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 100
+#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 400
// Slave latency to use parameter update
-#define DEFAULT_DESIRED_SLAVE_LATENCY 0
+#define DEFAULT_DESIRED_SLAVE_LATENCY 5
// Supervision timeout value (units of 10ms, 100=1s)
-#define DEFAULT_DESIRED_CONN_TIMEOUT 100
+#define DEFAULT_DESIRED_CONN_TIMEOUT 200
// Company Identifier: WCH
#define WCH_COMPANY_ID 0x07D7
@@ -365,7 +365,7 @@ uint16_t Peripheral_ProcessEvent(uint8_t task_id, uint16_t events)
if(events & SBP_PHY_UPDATE_EVT)
{
// start phy update
- PRINT("PHY Update %x...\n", GAPRole_UpdatePHY(peripheralConnList.connHandle, 0,
+ PRINT("PHY Update %x...\n", GAPRole_UpdatePHY(peripheralConnList.connHandle, 0,
GAP_PHY_BIT_LE_2M, GAP_PHY_BIT_LE_2M, 0));
return (events ^ SBP_PHY_UPDATE_EVT);
diff --git a/APP/peripheral_main.c b/APP/peripheral_main.c
index 0f60de4..9f96617 100644
--- a/APP/peripheral_main.c
+++ b/APP/peripheral_main.c
@@ -6,7 +6,7 @@
* Description : ÍâÉè´Ó»úÓ¦ÓÃÖ÷º¯Êý¼°ÈÎÎñϵͳ³õʼ»¯
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
+ * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
@@ -60,10 +60,37 @@ int main(void)
GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
#endif
+
+ // 12V_EN
+ GPIOA_ResetBits(GPIO_Pin_13);
+ GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
+
+ // EMV_CTRL
+ GPIOB_ResetBits(GPIO_Pin_13);
+ GPIOB_ModeCfg(GPIO_Pin_13, GPIO_ModeIN_PD);
+
+ // LED
+ GPIOA_ResetBits(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15);
+ GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15, GPIO_ModeIN_PD);
+
+ // KEY
+ GPIOB_SetBits(GPIO_Pin_14);
+// ÓÉÍⲿÉÏÀµç×èÁË
+ GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
+
+ // ADC_VBAT
+ // GPIOAGPPCfg(ENABLE, RB_PIN_PA4_15_DIS);
+ // R16_PIN_ANALOG_IE != RB_PIN_PA4_15_DIS;
+
+ // R32_PIN_CONFIG2
+
+ // GPIOA_ResetBits(GPIO_Pin_1);
+ GPIOA_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
+
#ifdef DEBUG
- GPIOA_SetBits(bTXD1);
- GPIOA_ModeCfg(bTXD1, GPIO_ModeOut_PP_5mA);
- UART1_DefInit();
+ GPIOB_SetBits(bTXD0);
+ GPIOB_ModeCfg(bTXD0, GPIO_ModeOut_PP_5mA);
+ UART0_DefInit();
#endif
PRINT("%s\n", VER_LIB);
CH59x_BLEInit();
diff --git a/BSP/inc/bsp_tim.h b/BSP/inc/bsp_tim.h
new file mode 100644
index 0000000..75f8f5d
--- /dev/null
+++ b/BSP/inc/bsp_tim.h
@@ -0,0 +1,21 @@
+#ifndef __BSP_TIM_H__
+#define __BSP_TIM_H__
+
+
+#include "CH59x_common.h"
+
+
+
+uint32_t BSP_Get_Tick(void);
+
+
+
+
+
+
+
+
+
+
+#endif //!@__BSP_TIM_H__
+
diff --git a/BSP/inc/bsp_uart.h b/BSP/inc/bsp_uart.h
new file mode 100644
index 0000000..5685e34
--- /dev/null
+++ b/BSP/inc/bsp_uart.h
@@ -0,0 +1,37 @@
+#ifndef __BSP_UART_H__
+#define __BSP_UART_H__
+
+
+#include "CH585SFR.h"
+
+
+#define UART3_RX_PIN GPIO_Pin_20 //PB20 ÈÕÖ¾´òÓ¡
+#define UART3_TX_PIN GPIO_Pin_21 // PB21
+
+
+void BSP_UART1_Init(void);
+unsigned int BSP_Uart1_Receive_Data(void *buf, unsigned int len);
+unsigned int BSP_Uart1_Send_Data(const void *buf, unsigned int len);
+
+void BSP_UART3_Init(void);
+unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len);
+unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len);
+void BSP_Shell_Loop(void);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif
+
diff --git a/BSP/src/bsp_tim.c b/BSP/src/bsp_tim.c
new file mode 100644
index 0000000..f5ecc06
--- /dev/null
+++ b/BSP/src/bsp_tim.c
@@ -0,0 +1,27 @@
+#include "bsp_tim.h"
+
+// tick_1ms_cntÔÚSysTick_Handler()ÖÐ1ms +1
+volatile uint32_t tick_1ms_cnt = 0;
+
+/**
+ * @description: ÒÔSysTick£¨1ms£©Îª»ù´¡
+ * @return {uint32_t}
+ */
+uint32_t BSP_Get_Tick(void)
+{
+ /* Platform implementation */
+ return tick_1ms_cnt;
+}
+
+// SysTickÖжϺ¯Êý
+__INTERRUPT
+__HIGH_CODE
+void SysTick_Handler()
+{
+ static uint8_t cnt_ms = 0;
+
+ SysTick->SR = 0; // Çå³ýÖжϱêÖ¾
+ tick_1ms_cnt++;
+
+ cnt_ms++;
+}
diff --git a/BSP/src/bsp_uart.c b/BSP/src/bsp_uart.c
new file mode 100644
index 0000000..6f0a054
--- /dev/null
+++ b/BSP/src/bsp_uart.c
@@ -0,0 +1,228 @@
+#include "bsp_uart.h"
+#include "bsp_ml307r.h"
+#include "lwrb.h"
+#include "CH58x_uart.h"
+#include "shell_port.h"
+
+
+
+
+#define UART1_RX_BUFFER_LENGTH 512U
+#define UART1_TX_BUFFER_LENGTH 512U
+
+#define UART3_RX_BUFFER_LENGTH 1024U
+#define UART3_TX_BUFFER_LENGTH 1024U
+
+
+lwrb_t uart1_rx_t;
+lwrb_t uart1_tx_t;
+uint8_t uart1_tx_buf[UART1_TX_BUFFER_LENGTH] = {0};
+uint8_t uart1_rx_buf[UART1_RX_BUFFER_LENGTH] = {0};
+
+lwrb_t uart3_rx_t;
+lwrb_t uart3_tx_t;
+uint8_t uart3_tx_buf[UART3_TX_BUFFER_LENGTH] = {0};
+uint8_t uart3_rx_buf[UART3_RX_BUFFER_LENGTH] = {0};
+
+
+//´®¿Ú½ÓÊÕ
+unsigned int BSP_Uart1_Receive_Data(void *buf, unsigned int len)
+{
+ return lwrb_read(&uart1_rx_t, buf, len);
+}
+
+//´®¿Ú·¢ËÍÊý¾Ý
+unsigned int BSP_Uart1_Send_Data(const void *buf, unsigned int len)
+{
+ unsigned int ret;
+
+ ret = lwrb_write(&uart1_tx_t, buf, len);
+ UART1_INTCfg(ENABLE, RB_IER_THR_EMPTY);
+ return ret;
+}
+
+//´®¿Ú½ÓÊÕ
+unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len)
+{
+ return lwrb_write(&uart3_rx_t, buf, len);
+}
+
+//´®¿Ú·¢ËÍÊý¾Ý
+unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len)
+{
+ unsigned int ret;
+
+ ret = lwrb_write(&uart3_tx_t, buf, len);
+ UART3_INTCfg(ENABLE, RB_IER_THR_EMPTY);
+ return ret;
+}
+
+
+/**
+ * \brief Buffer event function
+ */
+static void Uart1_evt_fn(struct lwrb* buff, lwrb_evt_type_t evt, lwrb_sz_t bp)
+{
+ switch (evt)
+ {
+ case LWRB_EVT_RESET:
+ printf("[EVT] Buffer reset event!\r\n");
+ break;
+ case LWRB_EVT_READ:
+ printf("[EVT] Buffer read event: %d byte(s)!\r\n", (int)bp);
+ break;
+ case LWRB_EVT_WRITE:
+ printf("[EVT] Buffer write event: %d byte(s)!\r\n", (int)bp);
+ break;
+ default: break;
+ }
+}
+
+void UART1_FifoInit(void)
+{
+ lwrb_init(&uart1_tx_t, uart1_tx_buf, sizeof(uart1_tx_buf));
+ lwrb_init(&uart1_rx_t, uart1_rx_buf, sizeof(uart1_rx_buf));
+
+// lwrb_set_evt_fn(&uart1_rx_t, Uart1_evt_fn);
+}
+
+void UART3_FifoInit(void)
+{
+ lwrb_init(&uart3_tx_t, uart3_tx_buf, sizeof(uart3_tx_buf));
+ lwrb_init(&uart3_rx_t, uart3_rx_buf, sizeof(uart3_rx_buf));
+
+ lwrb_set_evt_fn(&uart1_rx_t, Uart1_evt_fn);
+}
+
+/*4G½Ó¿Ú*/
+void BSP_UART1_Init(void)
+{
+ GPIOPinRemap(ENABLE, RB_PIN_UART1);
+
+ /* ÅäÖô®¿Ú1£ºÏÈÅäÖÃIO¿Úģʽ£¬ÔÙÅäÖô®¿Ú */
+ GPIOB_SetBits(ML307_UART_RX_PIN);
+ GPIOB_ModeCfg(ML307_UART_RX_PIN, GPIO_ModeIN_PU); // RXD-ÅäÖÃÉÏÀÊäÈë
+ GPIOB_ModeCfg(ML307_UART_TX_PIN, GPIO_ModeOut_PP_5mA); // TXD-ÅäÖÃÍÆÍìÊä³ö£¬×¢ÒâÏÈÈÃIO¿ÚÊä³ö¸ßµçƽ
+ UART1_DefInit();
+ UART1_ByteTrigCfg(UART_1BYTE_TRIG);
+ // ÖжϷ½Ê½½ÓÊÕÊý¾Ý
+ UART1_INTCfg(ENABLE, RB_IER_LINE_STAT | RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
+ PFIC_EnableIRQ(UART1_IRQn);
+
+ UART1_FifoInit();
+}
+
+
+
+/*µ÷ÊÔ½Ó¿Ú*/
+void BSP_UART3_Init(void)
+{
+ GPIOPinRemap(ENABLE, RB_PIN_UART3);
+ /* ÅäÖô®¿Ú3£ºÏÈÅäÖÃIO¿Úģʽ£¬ÔÙÅäÖô®¿Ú */
+ GPIOB_SetBits(UART3_TX_PIN);
+ GPIOB_ModeCfg(UART3_RX_PIN, GPIO_ModeIN_PU); // RXD-ÅäÖÃÉÏÀÊäÈë
+ GPIOB_ModeCfg(UART3_TX_PIN, GPIO_ModeOut_PP_5mA); // TXD-ÅäÖÃÍÆÍìÊä³ö£¬×¢ÒâÏÈÈÃIO¿ÚÊä³ö¸ßµçƽ
+ UART3_DefInit();
+ UART3_BaudRateCfg(460800);
+ UART3_ByteTrigCfg(UART_1BYTE_TRIG);
+ // ÖжϷ½Ê½½ÓÊÕÊý¾Ý
+ UART3_INTCfg(ENABLE, RB_IER_LINE_STAT | RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
+ PFIC_EnableIRQ(UART3_IRQn);
+
+ UART3_FifoInit();
+ userShellInit();
+
+}
+
+/*********************************************************************
+ * @fn UART1_IRQHandler
+ *
+ * @brief UART1ÖжϺ¯Êý
+ *
+ * @return none
+ */
+__INTERRUPT
+__HIGH_CODE
+void UART1_IRQHandler(void)
+{
+ uint8_t data;
+ switch(UART1_GetITFlag())
+ {
+ case UART_II_LINE_STAT: // Ïß·״̬´íÎó
+ {
+// UART1_GetLinSTA();
+ break;
+ }
+ case UART_II_RECV_RDY:
+ data = UART1_RecvByte();
+ lwrb_write(&uart1_rx_t, &data, 1);
+ break;
+ case UART_II_RECV_TOUT: // ½ÓÊÕÊý¾Ý
+ break;
+
+ case UART_II_THR_EMPTY: // ·¢ËÍ»º´æÇø¿Õ£¬¿É¼ÌÐø·¢ËÍ
+ if(lwrb_read(&uart1_tx_t, &data, 1))
+ {
+ UART1_SendByte(data);
+ }
+ else
+ {
+ UART1_INTCfg(DISABLE, RB_IER_THR_EMPTY);
+ }
+
+ break;
+
+ case UART_II_MODEM_CHG: // Ö»Ö§³Ö´®¿Ú0
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*********************************************************************
+ * @fn UART3_IRQHandler
+ *
+ * @brief UART1ÖжϺ¯Êý
+ *
+ * @return none
+ */
+__INTERRUPT
+__HIGH_CODE
+void UART3_IRQHandler(void)
+{
+ uint8_t data;
+ switch(UART3_GetITFlag())
+ {
+ case UART_II_LINE_STAT: // Ïß·״̬´íÎó
+ {
+// UART1_GetLinSTA();
+ break;
+ }
+ case UART_II_RECV_RDY:
+ case UART_II_RECV_TOUT: //½ÓÊÕ³¬Ê±
+ while(R8_UART3_RFC)
+ {
+ shellHandler(&shell, R8_UART3_RBR);
+ }
+ break;
+ case UART_II_THR_EMPTY: // ·¢ËÍ»º´æÇø¿Õ£¬¿É¼ÌÐø·¢ËÍ
+ if(lwrb_get_full(&uart3_tx_t))
+ {
+ lwrb_read(&uart3_tx_t, &data, 1);
+ UART3_SendByte(data);
+ }
+ else
+ {
+ UART3_INTCfg(DISABLE, RB_IER_THR_EMPTY);
+ }
+
+ break;
+
+ case UART_II_MODEM_CHG: // Ö»Ö§³Ö´®¿Ú0
+ break;
+
+ default:
+ break;
+ }
+}
diff --git a/HAL/SLEEP.c b/HAL/SLEEP.c
index 92c9d42..f33267e 100644
--- a/HAL/SLEEP.c
+++ b/HAL/SLEEP.c
@@ -6,7 +6,7 @@
* Description : ˯ÃßÅäÖü°Æä³õʼ»¯
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
+ * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
@@ -25,49 +25,61 @@
*/
uint32_t CH59x_LowPower(uint32_t time)
{
-#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
+#if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
volatile uint32_t i;
uint32_t time_sleep, time_curr;
unsigned long irq_status;
-
+
// Ìáǰ»½ÐÑ
- if (time <= WAKE_UP_RTC_MAX_TIME) {
+ if (time <= WAKE_UP_RTC_MAX_TIME)
+ {
time = time + (RTC_MAX_COUNT - WAKE_UP_RTC_MAX_TIME);
- } else {
+ }
+ else
+ {
time = time - WAKE_UP_RTC_MAX_TIME;
}
SYS_DisableAllIrq(&irq_status);
time_curr = RTC_GetCycle32k();
// ¼ì²â˯Ãßʱ¼ä
- if (time < time_curr) {
+ if (time < time_curr)
+ {
time_sleep = time + (RTC_MAX_COUNT - time_curr);
- } else {
+ }
+ else
+ {
time_sleep = time - time_curr;
}
-
+
// Èô˯Ãßʱ¼äСÓÚ×îС˯Ãßʱ¼ä»ò´óÓÚ×î´ó˯Ãßʱ¼ä£¬Ôò²»Ë¯Ãß
- if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
- (time_sleep > SLEEP_RTC_MAX_TIME)) {
+ if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
+ (time_sleep > SLEEP_RTC_MAX_TIME))
+ {
SYS_RecoverIrq(irq_status);
return 2;
}
RTC_SetTignTime(time);
SYS_RecoverIrq(irq_status);
- #if(DEBUG == Debug_UART1) // ʹÓÃÆäËû´®¿ÚÊä³ö´òÓ¡ÐÅÏ¢ÐèÒªÐÞ¸ÄÕâÐдúÂë
- while((R8_UART1_LSR & RB_LSR_TX_ALL_EMP) == 0)
+#if (DEBUG == Debug_UART0) // ʹÓÃÆäËû´®¿ÚÊä³ö´òÓ¡ÐÅÏ¢ÐèÒªÐÞ¸ÄÕâÐдúÂë
+ while ((R8_UART0_LSR & RB_LSR_TX_ALL_EMP) == 0)
{
__nop();
}
- #endif
- // LOW POWER-sleepģʽ
- if(!RTCTigFlag)
+#elif (DEBUG == Debug_UART1) // ʹÓÃÆäËû´®¿ÚÊä³ö´òÓ¡ÐÅÏ¢ÐèÒªÐÞ¸ÄÕâÐдúÂë
+ while ((R8_UART1_LSR & RB_LSR_TX_ALL_EMP) == 0)
{
- LowPower_Sleep(RB_PWR_RAM2K | RB_PWR_RAM24K | RB_PWR_EXTEND | RB_XT_PRE_EN );
+ __nop();
+ }
+#endif
+ // LOW POWER-sleepģʽ
+ if (!RTCTigFlag)
+ {
+ LowPower_Sleep(RB_PWR_RAM2K | RB_PWR_RAM24K | RB_PWR_EXTEND | RB_XT_PRE_EN);
HSECFG_Current(HSE_RCur_100); // ½µÎª¶î¶¨µçÁ÷(µÍ¹¦ºÄº¯ÊýÖÐÌáÉýÁËHSEÆ«ÖõçÁ÷)
i = RTC_GetCycle32k();
- while(i == RTC_GetCycle32k());
+ while (i == RTC_GetCycle32k());
return 0;
}
#endif
@@ -85,12 +97,12 @@ uint32_t CH59x_LowPower(uint32_t time)
*/
void HAL_SleepInit(void)
{
-#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
+#if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
sys_safe_access_enable();
R8_SLP_WAKE_CTRL |= RB_SLP_RTC_WAKE; // RTC»½ÐÑ
sys_safe_access_disable();
sys_safe_access_enable();
- R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // ´¥·¢Ä£Ê½
+ R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // ´¥·¢Ä£Ê½
sys_safe_access_disable();
PFIC_EnableIRQ(RTC_IRQn);
#endif
diff --git a/HAL/include/CONFIG.h b/HAL/include/CONFIG.h
index c42e9d9..ad8508c 100644
--- a/HAL/include/CONFIG.h
+++ b/HAL/include/CONFIG.h
@@ -6,7 +6,7 @@
* Description : ÅäÖÃ˵Ã÷¼°Ä¬ÈÏÖµ£¬½¨ÒéÔÚ¹¤³ÌÅäÖÃÀïµÄÔ¤´¦ÀíÖÐÐ޸ĵ±Ç°Öµ
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
+ * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
@@ -43,11 +43,11 @@
¿ÕÏÐģʽ - 5
¡¾TEMPERATION¡¿
TEM_SAMPLE - ÊÇ·ñ´ò¿ª¸ù¾Ýζȱ仯У׼µÄ¹¦ÄÜ£¬µ¥´ÎУ׼ºÄʱСÓÚ10ms( ĬÈÏ:TRUE )
-
+
¡¾CALIBRATION¡¿
BLE_CALIBRATION_ENABLE - ÊÇ·ñ´ò¿ª¶¨Ê±Ð£×¼µÄ¹¦ÄÜ£¬µ¥´ÎУ׼ºÄʱСÓÚ10ms( ĬÈÏ:TRUE )
BLE_CALIBRATION_PERIOD - ¶¨Ê±Ð£×¼µÄÖÜÆÚ£¬µ¥Î»ms( ĬÈÏ:120000 )
-
+
¡¾SNV¡¿
BLE_SNV - ÊÇ·ñ¿ªÆôSNV¹¦ÄÜ£¬ÓÃÓÚ´¢´æ°ó¶¨ÐÅÏ¢( ĬÈÏ:TRUE )
BLE_SNV_ADDR - SNVÐÅÏ¢±£´æµØÖ·£¬Ê¹ÓÃdata flash×îºó512×Ö½Ú( ĬÈÏ:0x77E00 )
@@ -65,7 +65,7 @@
BLE_BUFF_NUM - ¿ØÖÆÆ÷»º´æµÄ°üÊýÁ¿( ĬÈÏ:5 )
BLE_TX_NUM_EVENT - µ¥¸öÁ¬½Óʼþ×î¶à¿ÉÒÔ·¢¶àÉÙ¸öÊý¾Ý°ü( ĬÈÏ:1 )
BLE_TX_POWER - ·¢É书ÂÊ( ĬÈÏ:LL_TX_POWEER_0_DBM (0dBm) )
-
+
¡¾MULTICONN¡¿
PERIPHERAL_MAX_CONNECTION - ×î¶à¿Éͬʱ×ö¶àÉÙ´Ó»ú½ÇÉ«( ĬÈÏ:1 )
CENTRAL_MAX_CONNECTION - ×î¶à¿Éͬʱ×ö¶àÉÙÖ÷»ú½ÇÉ«( ĬÈÏ:3 )
@@ -79,15 +79,15 @@
#define BLE_MAC FALSE
#endif
#ifndef DCDC_ENABLE
-#define DCDC_ENABLE FALSE
+#define DCDC_ENABLE TRUE
#endif
#ifndef HAL_SLEEP
-#define HAL_SLEEP FALSE
+#define HAL_SLEEP TRUE
#endif
-#ifndef SLEEP_RTC_MIN_TIME
+#ifndef SLEEP_RTC_MIN_TIME
#define SLEEP_RTC_MIN_TIME US_TO_RTC(1000)
#endif
-#ifndef SLEEP_RTC_MAX_TIME
+#ifndef SLEEP_RTC_MAX_TIME
#define SLEEP_RTC_MAX_TIME (RTC_MAX_COUNT - 1000 * 1000 * 30)
#endif
#ifndef WAKE_UP_RTC_MAX_TIME
diff --git a/StdPeriphDriver/CH59x_uart0.c b/StdPeriphDriver/CH59x_uart0.c
index 72610ce..8a67359 100644
--- a/StdPeriphDriver/CH59x_uart0.c
+++ b/StdPeriphDriver/CH59x_uart0.c
@@ -6,7 +6,7 @@
* Description
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
+ * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
@@ -23,7 +23,7 @@
*/
void UART0_DefInit(void)
{
- UART0_BaudRateCfg(115200);
+ UART0_BaudRateCfg(460800);
R8_UART0_FCR = (2 << 6) | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN; // FIFO´ò¿ª£¬´¥·¢µã4×Ö½Ú
R8_UART0_LCR = RB_LCR_WORD_SZ;
R8_UART0_IER = RB_IER_TXD_EN;