mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
sam: refined UART/USART class inheritance
Let Usart inherit all methods from Uart.
This commit is contained in:
parent
16d836108f
commit
37ea166e19
@ -48,17 +48,12 @@ class UARTClass : public HardwareSerial
|
||||
int read(void);
|
||||
void flush(void);
|
||||
size_t write(const uint8_t c);
|
||||
using Print::write; // pull in write(str) and write(buf, size) from Print
|
||||
|
||||
void setInterruptPriority(uint32_t priority);
|
||||
uint32_t getInterruptPriority();
|
||||
|
||||
void IrqHandler( void );
|
||||
|
||||
#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+ */
|
||||
// virtual void write( const char *str );
|
||||
// virtual void write( const uint8_t *buffer, size_t size );
|
||||
#endif
|
||||
void IrqHandler(void);
|
||||
|
||||
operator bool() { return true; }; // UART always active
|
||||
};
|
||||
|
@ -32,33 +32,8 @@ USARTClass::USARTClass( Usart* pUsart, IRQn_Type dwIrq, uint32_t dwId, RingBuffe
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
void USARTClass::begin( const uint32_t dwBaudRate )
|
||||
{
|
||||
begin( dwBaudRate, SERIAL_8N1 );
|
||||
}
|
||||
|
||||
void USARTClass::begin( const uint32_t dwBaudRate, const uint32_t config )
|
||||
{
|
||||
UARTClass::begin(dwBaudRate, config);
|
||||
}
|
||||
|
||||
void USARTClass::end( void )
|
||||
{
|
||||
UARTClass::end();
|
||||
}
|
||||
|
||||
void USARTClass::flush( void )
|
||||
{
|
||||
UARTClass::flush();
|
||||
}
|
||||
|
||||
size_t USARTClass::write( const uint8_t uc_data )
|
||||
{
|
||||
return UARTClass::write(uc_data);
|
||||
}
|
||||
|
||||
void USARTClass::IrqHandler( void )
|
||||
{
|
||||
UARTClass::IrqHandler();
|
||||
}
|
||||
|
||||
|
@ -64,22 +64,8 @@ class USARTClass : public UARTClass
|
||||
public:
|
||||
USARTClass( Usart* pUsart, IRQn_Type dwIrq, uint32_t dwId, RingBuffer* pRx_buffer, RingBuffer* pTx_buffer );
|
||||
|
||||
void begin( const uint32_t dwBaudRate );
|
||||
void begin( const uint32_t dwBaudRate , const uint32_t config );
|
||||
void end( void );
|
||||
void flush( void );
|
||||
size_t write( const uint8_t c );
|
||||
|
||||
void IrqHandler( void );
|
||||
|
||||
#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+ */
|
||||
// virtual void write( const char *str );
|
||||
// virtual void write( const uint8_t *buffer, size_t size );
|
||||
#endif
|
||||
|
||||
operator bool() { return true; }; // USART always active
|
||||
using UARTClass::begin; // Needed only for polymorphic methods
|
||||
};
|
||||
|
||||
#endif // _USART_CLASS_
|
||||
|
Loading…
x
Reference in New Issue
Block a user