minor cleanup and moves prior to adding USB support

This commit is contained in:
true
2024-11-06 19:15:40 -08:00
parent 50ab3fd036
commit a903464666
17 changed files with 96 additions and 51 deletions

View File

@@ -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);
}

View File

@@ -12,7 +12,6 @@
#ifndef __CH32V20x_IT_H
#define __CH32V20x_IT_H
#include "debug.h"
#endif /* __CH32V20x_IT_H */

View File

@@ -12,12 +12,12 @@
#include <ch32v20x.h>
#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();

View File

@@ -9,7 +9,7 @@
#include <ch32v20x.h>
#include <stdint.h>
#include "adc.h"
#include "periph/adc.h"

View File

@@ -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_ */

View File

@@ -8,7 +8,7 @@
#include <ch32v20x.h>
#include "btn.h"
#include "periph/btn.h"

View File

@@ -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_ */

View File

@@ -6,7 +6,7 @@
*/
#include "gat_gpio.h"
#include "periph/gat_gpio.h"

View File

@@ -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_ */

View File

@@ -8,7 +8,8 @@
#include <ch32v20x.h>
#include "port_pwr.h"
#include "periph/port_pwr.h"

View File

@@ -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_ */

View File

@@ -13,10 +13,9 @@
#include <ch32v20x.h>
#include <stdint.h>
#include "btn.h"
#include "port_pwr.h"
#include "rtc.h"
#include "periph/btn.h"
#include "periph/port_pwr.h"
#include "periph/rtc.h"

View File

@@ -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_ */

View File

@@ -9,7 +9,7 @@
#include <ch32v20x.h>
#include <stdint.h>
#include "rtc.h"
#include "periph/rtc.h"

View File

@@ -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 <stdint.h>
@@ -53,4 +53,4 @@ int8_t rtc_set_clock(struct RTClock *c);
#endif /* USER_SRC_RTC_H_ */
#endif /* USER_PERIPH_RTC_H_ */

View File

@@ -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 */