Last change
on this file since 136 was 136, checked in by ertl-honda, 8 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
861 bytes
|
Rev | Line | |
---|
[136] | 1 | #ifndef _SERCOM_UART_CLASS
|
---|
| 2 | #define _SERCOM_UART_CLASS
|
---|
| 3 |
|
---|
| 4 | #include "HardwareSerial.h"
|
---|
| 5 | #include "SERCOM.h"
|
---|
| 6 | #include "RingBuffer.h"
|
---|
| 7 |
|
---|
| 8 | #include <cstddef>
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | class Uart : public HardwareSerial
|
---|
| 12 | {
|
---|
| 13 | public:
|
---|
| 14 | Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX);
|
---|
| 15 | void begin(unsigned long baudRate);
|
---|
| 16 | void begin(unsigned long baudrate, uint8_t config);
|
---|
| 17 | void end();
|
---|
| 18 | int available();
|
---|
| 19 | int peek();
|
---|
| 20 | int read();
|
---|
| 21 | void flush();
|
---|
| 22 | size_t write(const uint8_t data);
|
---|
| 23 | size_t write(const char * data);
|
---|
| 24 |
|
---|
| 25 | void IrqHandler();
|
---|
| 26 |
|
---|
| 27 | operator bool() { return true; }
|
---|
| 28 |
|
---|
| 29 | private:
|
---|
| 30 | SERCOM *sercom;
|
---|
| 31 | RingBuffer rxBuffer;
|
---|
| 32 |
|
---|
| 33 | uint8_t uc_pinRX;
|
---|
| 34 | uint8_t uc_pinTX;
|
---|
| 35 |
|
---|
| 36 | SercomNumberStopBit extractNbStopBit(uint8_t config);
|
---|
| 37 | SercomUartCharSize extractCharSize(uint8_t config);
|
---|
| 38 | SercomParityMode extractParity(uint8_t config);
|
---|
| 39 | };
|
---|
| 40 |
|
---|
| 41 | extern Uart Serial;
|
---|
| 42 | extern Uart Serial5;
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.