2011-09-09 19:15:21 +02:00
|
|
|
#ifndef _UART_CLASS_
|
|
|
|
#define _UART_CLASS_
|
2011-06-01 01:54:47 +02:00
|
|
|
|
2011-07-11 01:51:24 +02:00
|
|
|
// UART.cpp need this class to be predefined
|
2011-09-09 19:15:21 +02:00
|
|
|
//class UARTClass ;
|
2011-07-11 01:51:24 +02:00
|
|
|
|
2011-09-09 19:15:21 +02:00
|
|
|
#include "Arduino.h"
|
2011-06-01 01:54:47 +02:00
|
|
|
|
|
|
|
class UARTClass : public HardwareSerial
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
Uart* _pUart ;
|
|
|
|
IRQn_Type _dwIrq ;
|
|
|
|
uint32_t _dwId ;
|
|
|
|
|
|
|
|
public:
|
2011-09-09 19:15:21 +02:00
|
|
|
UARTClass( Uart* pUart, IRQn_Type dwIrq, uint32_t dwId, RingBuffer* pRx_buffer, RingBuffer* pTx_buffer ) ;
|
2011-06-01 01:54:47 +02:00
|
|
|
|
|
|
|
void begin( const uint32_t dwBaudRate ) ;
|
|
|
|
void end( void ) ;
|
|
|
|
int available( void ) ;
|
|
|
|
int peek( void ) ;
|
|
|
|
int read( void ) ;
|
|
|
|
void flush( void ) ;
|
|
|
|
void write( const uint8_t c ) ;
|
|
|
|
|
|
|
|
void IrqHandler( void ) ;
|
|
|
|
|
2011-09-10 23:54:56 +02:00
|
|
|
#if defined __GNUC__ /* GCC CS3 */
|
|
|
|
using Print::write ; // pull in write(str) and write(buf, size) from Print
|
|
|
|
#elif defined __ICCARM__ /* IAR Ewarm 5.41+ */
|
2011-09-06 21:05:41 +02:00
|
|
|
virtual void write( const char *str ) ;
|
|
|
|
virtual void write( const uint8_t *buffer, size_t size ) ;
|
2011-09-10 23:54:56 +02:00
|
|
|
#endif
|
2011-06-01 01:54:47 +02:00
|
|
|
};
|
|
|
|
|
2011-09-09 19:15:21 +02:00
|
|
|
#endif // _UART_CLASS_
|