diff --git a/gat_stand_fw/.cproject b/gat_stand_fw/.cproject index 8c2015e..ae0dcd8 100644 --- a/gat_stand_fw/.cproject +++ b/gat_stand_fw/.cproject @@ -112,11 +112,53 @@ - - - + + + + - + @@ -138,4 +180,9 @@ + + + + + diff --git a/gat_stand_fw/user/ch32v20x_it.c b/gat_stand_fw/user/ch32v20x_it.c index 13c75eb..dbdc8c2 100644 --- a/gat_stand_fw/user/ch32v20x_it.c +++ b/gat_stand_fw/user/ch32v20x_it.c @@ -23,9 +23,7 @@ void HardFault_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast"))); */ void NMI_Handler(void) { - while (1) - { - } + while (1); } /********************************************************************* @@ -37,9 +35,7 @@ void NMI_Handler(void) */ void HardFault_Handler(void) { - while (1) - { - } + while (1); } diff --git a/gat_stand_fw/user/ch32v20x_it.h b/gat_stand_fw/user/ch32v20x_it.h index f68b203..93ef8b2 100644 --- a/gat_stand_fw/user/ch32v20x_it.h +++ b/gat_stand_fw/user/ch32v20x_it.h @@ -12,7 +12,6 @@ #ifndef __CH32V20x_IT_H #define __CH32V20x_IT_H -#include "debug.h" #endif /* __CH32V20x_IT_H */ diff --git a/gat_stand_fw/user/main.c b/gat_stand_fw/user/main.c index 45f0ce0..d949c29 100644 --- a/gat_stand_fw/user/main.c +++ b/gat_stand_fw/user/main.c @@ -12,12 +12,12 @@ #include -#include "src/adc.h" -#include "src/btn.h" -#include "src/gat_gpio.h" -#include "src/port_pwr.h" -#include "src/rgbled.h" -#include "src/rtc.h" +#include "periph/adc.h" +#include "periph/btn.h" +#include "periph/gat_gpio.h" +#include "periph/port_pwr.h" +#include "periph/rgbled.h" +#include "periph/rtc.h" @@ -169,9 +169,11 @@ int main(void) // initialize light sense stuff adc_init(); - // finally, get the system tick interrupt going + // get the system tick interrupt going systick_init(); + // initialize USB device for console shell + // let's do this while (1) { __WFI(); diff --git a/gat_stand_fw/user/src/adc.c b/gat_stand_fw/user/periph/adc.c similarity index 99% rename from gat_stand_fw/user/src/adc.c rename to gat_stand_fw/user/periph/adc.c index 16cf873..fd4b950 100644 --- a/gat_stand_fw/user/src/adc.c +++ b/gat_stand_fw/user/periph/adc.c @@ -9,7 +9,7 @@ #include #include -#include "adc.h" +#include "periph/adc.h" diff --git a/gat_stand_fw/user/src/adc.h b/gat_stand_fw/user/periph/adc.h similarity index 92% rename from gat_stand_fw/user/src/adc.h rename to gat_stand_fw/user/periph/adc.h index 3ae244f..4403f43 100644 --- a/gat_stand_fw/user/src/adc.h +++ b/gat_stand_fw/user/periph/adc.h @@ -5,8 +5,8 @@ * Author: true */ -#ifndef USER_SRC_ADC_H_ -#define USER_SRC_ADC_H_ +#ifndef USER_PERIPH_ADC_H_ +#define USER_PERIPH_ADC_H_ @@ -49,4 +49,4 @@ uint8_t adc_get_lsens_coarse(); -#endif /* USER_SRC_ADC_H_ */ +#endif /* USER_PERIPH_ADC_H_ */ diff --git a/gat_stand_fw/user/src/btn.c b/gat_stand_fw/user/periph/btn.c similarity index 99% rename from gat_stand_fw/user/src/btn.c rename to gat_stand_fw/user/periph/btn.c index 3a4fed0..82763eb 100644 --- a/gat_stand_fw/user/src/btn.c +++ b/gat_stand_fw/user/periph/btn.c @@ -8,7 +8,7 @@ #include -#include "btn.h" +#include "periph/btn.h" diff --git a/gat_stand_fw/user/src/btn.h b/gat_stand_fw/user/periph/btn.h similarity index 92% rename from gat_stand_fw/user/src/btn.h rename to gat_stand_fw/user/periph/btn.h index 1078158..0a29f3d 100644 --- a/gat_stand_fw/user/src/btn.h +++ b/gat_stand_fw/user/periph/btn.h @@ -2,8 +2,8 @@ * btn.h */ -#ifndef USER_SRC_BTN_H_ -#define USER_SRC_BTN_H_ +#ifndef USER_PERIPH_BTN_H_ +#define USER_PERIPH_BTN_H_ @@ -60,4 +60,4 @@ void btn_poll(); -#endif /* USER_SRC_BTN_H_ */ +#endif /* USER_PERIPH_BTN_H_ */ diff --git a/gat_stand_fw/user/src/gat_gpio.c b/gat_stand_fw/user/periph/gat_gpio.c similarity index 92% rename from gat_stand_fw/user/src/gat_gpio.c rename to gat_stand_fw/user/periph/gat_gpio.c index a03da4a..438a166 100644 --- a/gat_stand_fw/user/src/gat_gpio.c +++ b/gat_stand_fw/user/periph/gat_gpio.c @@ -6,7 +6,7 @@ */ -#include "gat_gpio.h" +#include "periph/gat_gpio.h" diff --git a/gat_stand_fw/user/src/gat_gpio.h b/gat_stand_fw/user/periph/gat_gpio.h similarity index 69% rename from gat_stand_fw/user/src/gat_gpio.h rename to gat_stand_fw/user/periph/gat_gpio.h index 5560bb6..41b9e2c 100644 --- a/gat_stand_fw/user/src/gat_gpio.h +++ b/gat_stand_fw/user/periph/gat_gpio.h @@ -5,8 +5,8 @@ * Author: true */ -#ifndef USER_SRC_GAT_GPIO_H_ -#define USER_SRC_GAT_GPIO_H_ +#ifndef USER_PERIPH_GAT_GPIO_H_ +#define USER_PERIPH_GAT_GPIO_H_ @@ -25,4 +25,4 @@ void gat_gpio_init(); -#endif /* USER_SRC_GAT_GPIO_H_ */ +#endif /* USER_PERIPH_GAT_GPIO_H_ */ diff --git a/gat_stand_fw/user/src/port_pwr.c b/gat_stand_fw/user/periph/port_pwr.c similarity index 98% rename from gat_stand_fw/user/src/port_pwr.c rename to gat_stand_fw/user/periph/port_pwr.c index e34ad0e..c2f6787 100644 --- a/gat_stand_fw/user/src/port_pwr.c +++ b/gat_stand_fw/user/periph/port_pwr.c @@ -8,7 +8,8 @@ #include -#include "port_pwr.h" + +#include "periph/port_pwr.h" diff --git a/gat_stand_fw/user/src/port_pwr.h b/gat_stand_fw/user/periph/port_pwr.h similarity index 84% rename from gat_stand_fw/user/src/port_pwr.h rename to gat_stand_fw/user/periph/port_pwr.h index f407a28..27f1f33 100644 --- a/gat_stand_fw/user/src/port_pwr.h +++ b/gat_stand_fw/user/periph/port_pwr.h @@ -5,8 +5,8 @@ * Author: true */ -#ifndef USER_SRC_PORT_PWR_H_ -#define USER_SRC_PORT_PWR_H_ +#ifndef USER_PERIPH_PORT_PWR_H_ +#define USER_PERIPH_PORT_PWR_H_ @@ -43,4 +43,4 @@ uint8_t usb2_pwr_state(); -#endif /* USER_SRC_PORT_PWR_H_ */ +#endif /* USER_PERIPH_PORT_PWR_H_ */ diff --git a/gat_stand_fw/user/src/rgbled.c b/gat_stand_fw/user/periph/rgbled.c similarity index 97% rename from gat_stand_fw/user/src/rgbled.c rename to gat_stand_fw/user/periph/rgbled.c index 5ab8f5c..b97cd2b 100644 --- a/gat_stand_fw/user/src/rgbled.c +++ b/gat_stand_fw/user/periph/rgbled.c @@ -13,10 +13,9 @@ #include #include -#include "btn.h" -#include "port_pwr.h" -#include "rtc.h" - +#include "periph/btn.h" +#include "periph/port_pwr.h" +#include "periph/rtc.h" diff --git a/gat_stand_fw/user/src/rgbled.h b/gat_stand_fw/user/periph/rgbled.h similarity index 73% rename from gat_stand_fw/user/src/rgbled.h rename to gat_stand_fw/user/periph/rgbled.h index ca7481f..09da88f 100644 --- a/gat_stand_fw/user/src/rgbled.h +++ b/gat_stand_fw/user/periph/rgbled.h @@ -5,8 +5,8 @@ * Author: true */ -#ifndef USER_SRC_RGBLED_H_ -#define USER_SRC_RGBLED_H_ +#ifndef USER_PERIPH_RGBLED_H_ +#define USER_PERIPH_RGBLED_H_ @@ -22,4 +22,4 @@ void rgbled_update(); -#endif /* USER_SRC_RGBLED_H_ */ +#endif /* USER_PERIPH_RGBLED_H_ */ diff --git a/gat_stand_fw/user/src/rtc.c b/gat_stand_fw/user/periph/rtc.c similarity index 99% rename from gat_stand_fw/user/src/rtc.c rename to gat_stand_fw/user/periph/rtc.c index 732d44f..410f2d0 100644 --- a/gat_stand_fw/user/src/rtc.c +++ b/gat_stand_fw/user/periph/rtc.c @@ -9,7 +9,7 @@ #include #include -#include "rtc.h" +#include "periph/rtc.h" diff --git a/gat_stand_fw/user/src/rtc.h b/gat_stand_fw/user/periph/rtc.h similarity index 91% rename from gat_stand_fw/user/src/rtc.h rename to gat_stand_fw/user/periph/rtc.h index cf85959..2bb31da 100644 --- a/gat_stand_fw/user/src/rtc.h +++ b/gat_stand_fw/user/periph/rtc.h @@ -5,8 +5,8 @@ * Author: true */ -#ifndef USER_SRC_RTC_H_ -#define USER_SRC_RTC_H_ +#ifndef USER_PERIPH_RTC_H_ +#define USER_PERIPH_RTC_H_ #include @@ -53,4 +53,4 @@ int8_t rtc_set_clock(struct RTClock *c); -#endif /* USER_SRC_RTC_H_ */ +#endif /* USER_PERIPH_RTC_H_ */ diff --git a/gat_stand_fw/user/system_ch32v20x.h b/gat_stand_fw/user/system_ch32v20x.h index 9c8a3f7..db17a7f 100644 --- a/gat_stand_fw/user/system_ch32v20x.h +++ b/gat_stand_fw/user/system_ch32v20x.h @@ -9,24 +9,25 @@ * Attention: This software (modified or not) and binary are used for * microcontroller manufactured by Nanjing Qinheng Microelectronics. *******************************************************************************/ -#ifndef __SYSTEM_ch32v20x_H -#define __SYSTEM_ch32v20x_H +#ifndef __SYSTEM_CH32V20x_H +#define __SYSTEM_CH32V20x_H #ifdef __cplusplus extern "C" { #endif + + extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */ /* System_Exported_Functions */ extern void SystemInit(void); extern void SystemCoreClockUpdate(void); + + #ifdef __cplusplus } #endif -#endif /*__CH32V20x_SYSTEM_H */ - - - +#endif /* __SYSTEM_CH32V20x_H */