This commit is contained in:
Alessandro Mauri 2026-04-09 20:51:44 +02:00
parent 043fbba67e
commit a75570e67b
2 changed files with 17 additions and 7 deletions

View file

@ -1,8 +1,11 @@
#include <ch32fun.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <fsusb.h>
#define PIN_LED PA4
uint8_t pin = 0;
// this callback is mandatory when FUNCONF_USE_USBPRINTF is defined,
// can be empty though
@ -25,12 +28,19 @@ __attribute__((noreturn)) int main(void)
{
SystemInit();
funGpioInitAll();
funPinMode(PIN_LED, GPIO_CFGLR_OUT_10Mhz_PP);
USBFSSetup();
Delay_Ms(500);
unsigned int count = 0;
while (1) {
for (uint32_t x = 0; true ; x++) {
poll_input(); // usb
printf("[%d]: Hello From CH32X035\n", count++);
Delay_Ms(100);
if ((x % 100) == 0) {
printf("[%d]: Hello From CH32X035\n", count++);
funDigitalWrite(PIN_LED, pin);
pin = !pin;
}
Delay_Ms(1);
}
}