11 #include "../Common.h" 12 #include "../LUFA/Drivers/USB/USB.h" 14 #include "CommandLine.h" 16 #define TERMINAL_VBUS_PORT PORTD 17 #define TERMINAL_VBUS_MASK PIN5_bm 19 #define TERMINAL_BUFFER_SIZE 512 22 TERMINAL_UNINITIALIZED,
23 TERMINAL_INITIALIZING,
28 extern uint8_t TerminalBuffer[TERMINAL_BUFFER_SIZE];
29 extern uint16_t TerminalBufferIdx;
30 extern USB_ClassInfo_CDC_Device_t TerminalHandle;
31 extern TerminalStateEnum TerminalState;
33 void TerminalInit(
void);
34 void TerminalTask(
void);
35 void TerminalTick(
void);
38 INLINE
void TerminalSendByte(uint8_t Byte);
39 INLINE
void TerminalFlushBuffer(
void);
40 void TerminalSendBlock(
const void *Buffer, uint16_t ByteCount);
42 INLINE
void TerminalSendChar(
char c);
43 void TerminalSendString(
const char *s);
44 void TerminalSendStringP(
const char *s);
46 void EVENT_USB_Device_Connect(
void);
47 void EVENT_USB_Device_Disconnect(
void);
48 void EVENT_USB_Device_ConfigurationChanged(
void);
49 void EVENT_USB_Device_ControlRequest(
void);
51 INLINE
void TerminalSendChar(
char c) { CDC_Device_SendByte(&TerminalHandle, c); }
52 INLINE
void TerminalSendByte(uint8_t Byte) { CDC_Device_SendByte(&TerminalHandle, Byte); }
54 INLINE
void TerminalFlushBuffer(
void) {
55 CDC_Device_Flush(&TerminalHandle);
56 TerminalBufferIdx = 0;
57 TerminalBuffer[TerminalBufferIdx] =
'\0';