kopia lustrzana https://github.com/skuep/AIOC
Added functionality to send back linestate reports to host. This is currently not working correctly
rodzic
43cd92f3bb
commit
122c8dd21b
|
@ -251,3 +251,32 @@ void USB_SerialTask(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
bool USB_SerialSendLineState(uint8_t lineState)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
/* TODO: This causes issues with the stack if its being called before CDC was initialized? Crashes on terminal connect */
|
||||||
|
uint8_t const rhport = 0;
|
||||||
|
static uint8_t notification[10] = {
|
||||||
|
/* bmRequestType */ 0xA1,
|
||||||
|
/* bNotification */ 0x20,
|
||||||
|
/* wValue */ 0x00, 0x00,
|
||||||
|
/* wIndex */ ITF_NUM_CDC_0, 0x00,
|
||||||
|
/* wLength */ 0x02, 0x00,
|
||||||
|
/* Data */ 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
notification[8] = lineState;
|
||||||
|
notification[9] = 0x00;
|
||||||
|
|
||||||
|
// claim endpoint
|
||||||
|
TU_VERIFY( usbd_edpt_claim(rhport, EPNUM_CDC_0_NOTIF) );
|
||||||
|
|
||||||
|
return usbd_edpt_xfer(rhport, EPNUM_CDC_0_NOTIF, notification, sizeof(notification));
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef USB_SERIAL_H_
|
#ifndef USB_SERIAL_H_
|
||||||
#define USB_SERIAL_H_
|
#define USB_SERIAL_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define USB_SERIAL_UART USART1
|
#define USB_SERIAL_UART USART1
|
||||||
#define USB_SERIAL_UART_IRQ USART1_IRQHandler
|
#define USB_SERIAL_UART_IRQ USART1_IRQHandler
|
||||||
#define USB_SERIAL_UART_PERIPHCLK RCC_PERIPHCLK_USART1
|
#define USB_SERIAL_UART_PERIPHCLK RCC_PERIPHCLK_USART1
|
||||||
|
@ -10,7 +13,14 @@
|
||||||
#define USB_SERIAL_UART_PIN_TX GPIO_PIN_9
|
#define USB_SERIAL_UART_PIN_TX GPIO_PIN_9
|
||||||
#define USB_SERIAL_UART_PIN_RX GPIO_PIN_10
|
#define USB_SERIAL_UART_PIN_RX GPIO_PIN_10
|
||||||
|
|
||||||
|
#define USB_SERIAL_LINESTATE_DCD 0x01
|
||||||
|
#define USB_SERIAL_LINESTATE_DSR 0x02
|
||||||
|
#define USB_SERIAL_LINESTATE_BREAK 0x04
|
||||||
|
#define USB_SERIAL_LINESTATE_RI 0x08
|
||||||
|
|
||||||
void USB_SerialInit(void);
|
void USB_SerialInit(void);
|
||||||
void USB_SerialTask(void);
|
void USB_SerialTask(void);
|
||||||
|
|
||||||
|
bool USB_SerialSendLineState(uint8_t lineState);
|
||||||
|
|
||||||
#endif /* USB_SERIAL_H_ */
|
#endif /* USB_SERIAL_H_ */
|
||||||
|
|
Ładowanie…
Reference in New Issue