it talks
This commit is contained in:
parent
043fbba67e
commit
a75570e67b
16
fw/main.c
16
fw/main.c
@ -1,8 +1,11 @@
|
|||||||
#include <ch32fun.h>
|
#include <ch32fun.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fsusb.h>
|
#include <fsusb.h>
|
||||||
|
|
||||||
|
#define PIN_LED PA4
|
||||||
|
uint8_t pin = 0;
|
||||||
|
|
||||||
// this callback is mandatory when FUNCONF_USE_USBPRINTF is defined,
|
// this callback is mandatory when FUNCONF_USE_USBPRINTF is defined,
|
||||||
// can be empty though
|
// can be empty though
|
||||||
@ -25,12 +28,19 @@ __attribute__((noreturn)) int main(void)
|
|||||||
{
|
{
|
||||||
SystemInit();
|
SystemInit();
|
||||||
funGpioInitAll();
|
funGpioInitAll();
|
||||||
|
funPinMode(PIN_LED, GPIO_CFGLR_OUT_10Mhz_PP);
|
||||||
USBFSSetup();
|
USBFSSetup();
|
||||||
|
Delay_Ms(500);
|
||||||
|
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
while (1) {
|
|
||||||
|
for (uint32_t x = 0; true ; x++) {
|
||||||
poll_input(); // usb
|
poll_input(); // usb
|
||||||
printf("[%d]: Hello From CH32X035\n", count++);
|
if ((x % 100) == 0) {
|
||||||
Delay_Ms(100);
|
printf("[%d]: Hello From CH32X035\n", count++);
|
||||||
|
funDigitalWrite(PIN_LED, pin);
|
||||||
|
pin = !pin;
|
||||||
|
}
|
||||||
|
Delay_Ms(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,16 +7,16 @@
|
|||||||
// Endpoint numbers, at least one (EP0)
|
// Endpoint numbers, at least one (EP0)
|
||||||
#define FUSB_CONFIG_EPS 4
|
#define FUSB_CONFIG_EPS 4
|
||||||
// Endpoint configuration for CDC TTY
|
// Endpoint configuration for CDC TTY
|
||||||
#define FUSB_EP1_MODE USBFS_EP_TX // TX (IN), CDC Interrupt Endpoint
|
#define FUSB_EP1_MODE 1 // TX (IN), CDC Interrupt Endpoint
|
||||||
#define FUSB_EP2_MODE USBFS_EP_RX // RX (OUT), CDC Data OUT
|
#define FUSB_EP2_MODE -1 // RX (OUT), CDC Data OUT
|
||||||
#define FUSB_EP3_MODE USBFS_EP_TX // TX (IN), CDC Data IN
|
#define FUSB_EP3_MODE 1 // TX (IN), CDC Data IN
|
||||||
// Other hardware configuration
|
// Other hardware configuration
|
||||||
#define FUSB_SUPPORTS_SLEEP 0
|
#define FUSB_SUPPORTS_SLEEP 0
|
||||||
#define FUSB_HID_INTERFACES 0
|
#define FUSB_HID_INTERFACES 0
|
||||||
#define FUSB_CURSED_TURBO_DMA 0 // Hacky, but seems fine, shaves 2.5us off filling 64-byte buffers.
|
#define FUSB_CURSED_TURBO_DMA 0 // Hacky, but seems fine, shaves 2.5us off filling 64-byte buffers.
|
||||||
#define FUSB_HID_USER_REPORTS 0
|
#define FUSB_HID_USER_REPORTS 0
|
||||||
#define FUSB_IO_PROFILE 0
|
#define FUSB_IO_PROFILE 0
|
||||||
//#define FUSB_USE_HPE FUNCONF_ENABLE_HPE
|
#define FUSB_USE_HPE FUNCONF_ENABLE_HPE
|
||||||
#define FUSB_USER_HANDLERS 1
|
#define FUSB_USER_HANDLERS 1
|
||||||
#define FUSB_USE_DMA7_COPY 0
|
#define FUSB_USE_DMA7_COPY 0
|
||||||
#define FUSB_VDD_5V 0 // 3.3V
|
#define FUSB_VDD_5V 0 // 3.3V
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user