mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-23 21:29:17 +00:00
[fix] fix adc/usb/spi/i2s demo
This commit is contained in:
parent
d98495bbb4
commit
ca849b3ed8
24 changed files with 673 additions and 116 deletions
|
@ -37,7 +37,7 @@
|
|||
|
||||
USB_DESC_SECTION const uint8_t cdc_descriptor[] =
|
||||
{
|
||||
USB_DEVICE_DESCRIPTOR_INIT(USB_2_0,USBD_VID,USBD_PID,0x0100,0x01),
|
||||
USB_DEVICE_DESCRIPTOR_INIT(USB_2_0,0x02,0x02,0x01,USBD_VID,USBD_PID,0x0100,0x01),
|
||||
USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE,0x02,0x01,USB_CONFIG_BUS_POWERED,USBD_MAX_POWER),
|
||||
CDC_ACM_DESCRIPTOR_INIT(0x00,CDC_INT_EP,CDC_OUT_EP,CDC_IN_EP,0x02),
|
||||
///////////////////////////////////////
|
||||
|
@ -122,7 +122,6 @@ uint8_t out_buffer[4096];
|
|||
void usbd_cdc_acm_bulk_out(uint8_t ep)
|
||||
{
|
||||
uint32_t actual_read_length = 0;
|
||||
|
||||
if (usbd_ep_read(ep, &out_buffer[rx_pos], 64, &actual_read_length) < 0)
|
||||
{
|
||||
USBD_LOG_DBG("Read DATA Packet failed\r\n");
|
||||
|
@ -184,6 +183,8 @@ usbd_endpoint_t cdc_in_ep =
|
|||
.ep_cb = usbd_cdc_acm_bulk_in
|
||||
};
|
||||
|
||||
#define USING_POLL_RTX
|
||||
|
||||
struct device *usb_fs;
|
||||
|
||||
extern struct device* usb_dc_init(void);
|
||||
|
@ -195,16 +196,25 @@ int main(void)
|
|||
|
||||
usbd_cdc_add_acm_interface(&cdc_class,&cdc_cmd_intf);
|
||||
usbd_cdc_add_acm_interface(&cdc_class,&cdc_data_intf);
|
||||
usbd_cdc_add_endpoint(&cdc_data_intf,&cdc_out_ep);
|
||||
usbd_cdc_add_endpoint(&cdc_data_intf,&cdc_in_ep);
|
||||
usbd_interface_add_endpoint(&cdc_data_intf,&cdc_out_ep);
|
||||
usbd_interface_add_endpoint(&cdc_data_intf,&cdc_in_ep);
|
||||
|
||||
usb_fs = usb_dc_init();
|
||||
if (usb_fs)
|
||||
{
|
||||
#ifndef USING_POLL_RTX
|
||||
device_control(usb_fs, DEVICE_CTRL_SET_INT, (void *)(USB_EP1_DATA_OUT_IT|USB_EP2_DATA_IN_IT));
|
||||
#endif
|
||||
}
|
||||
|
||||
while(!usb_device_is_configured());
|
||||
while (1)
|
||||
{
|
||||
#ifdef USING_POLL_RTX
|
||||
if(usb_device_is_configured())
|
||||
{
|
||||
device_read(usb_fs,0x01,out_buffer,64);
|
||||
device_write(usb_fs,0x82,out_buffer,64);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue