|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
-
-
- #pragma once
-
- #include "usb_desc.h"
-
- #if defined(SEREMU_INTERFACE) && !defined(CDC_STATUS_INTERFACE) && !defined(CDC_DATA_INTERFACE)
-
- #include <stdint.h>
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
- void usb_seremu_reset(void);
- void usb_seremu_configure(void);
- int usb_seremu_getchar(void);
- int usb_seremu_peekchar(void);
- int usb_seremu_available(void);
- void usb_seremu_flush_input(void);
- int usb_seremu_putchar(uint8_t c);
- int usb_seremu_write(const void *buffer, uint32_t size);
- int usb_seremu_write_buffer_free(void);
- void usb_seremu_flush_output(void);
- extern volatile uint8_t usb_configuration;
- #ifdef __cplusplus
- }
- #endif
-
-
- #ifdef __cplusplus
- #include "Stream.h"
- class usb_seremu_class : public Stream
- {
- public:
- constexpr usb_seremu_class() {}
- void begin(long) { };
- void end() { };
- virtual int available() { return usb_seremu_available(); }
- virtual int read() { return usb_seremu_getchar(); }
- virtual int peek() { return usb_seremu_peekchar(); }
- virtual void flush() { usb_seremu_flush_output(); }
- virtual size_t write(uint8_t c) { return usb_seremu_putchar(c); }
- virtual size_t write(const uint8_t *buffer, size_t size) { return usb_seremu_write(buffer, size); }
- size_t write(unsigned long n) { return write((uint8_t)n); }
- size_t write(long n) { return write((uint8_t)n); }
- size_t write(unsigned int n) { return write((uint8_t)n); }
- size_t write(int n) { return write((uint8_t)n); }
- virtual int availableForWrite() { return usb_seremu_write_buffer_free(); }
- using Print::write;
- void send_now(void) { usb_seremu_flush_output(); };
- uint32_t baud(void) { return 9600; }
- uint8_t stopbits(void) { return 1; }
- uint8_t paritytype(void) { return 0; }
- uint8_t numbits(void) { return 8; }
- uint8_t dtr(void) { return 1; }
- uint8_t rts(void) { return 1; }
- operator bool() { return usb_configuration; }
- };
- extern usb_seremu_class Serial;
- extern void serialEvent(void);
- #endif
-
-
- #if 0
-
- #ifdef __cplusplus
- #include "Stream.h"
- class usb_seremu_class : public Stream
- {
- public:
- constexpr usb_seremu_class() {}
- void begin(long) { };
- void end() { };
- virtual int available() { return 0; }
- virtual int read() { return -1; }
- virtual int peek() { return -1; }
- virtual void flush() { }
- virtual size_t write(uint8_t c) { return 1; }
- virtual size_t write(const uint8_t *buffer, size_t size) { return size; }
- size_t write(unsigned long n) { return 1; }
- size_t write(long n) { return 1; }
- size_t write(unsigned int n) { return 1; }
- size_t write(int n) { return 1; }
- int availableForWrite() { return 0; }
- using Print::write;
- void send_now(void) { }
- uint32_t baud(void) { return 0; }
- uint8_t stopbits(void) { return 1; }
- uint8_t paritytype(void) { return 0; }
- uint8_t numbits(void) { return 8; }
- uint8_t dtr(void) { return 1; }
- uint8_t rts(void) { return 1; }
- operator bool() { return true; }
- };
-
- extern usb_seremu_class Serial;
- extern void serialEvent(void);
- #endif
- #endif
-
-
- #endif
|