mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
sam: refined UART/USART class inheritance
Let Usart inherit all methods from Uart.
This commit is contained in:
@ -48,18 +48,13 @@ class UARTClass : public HardwareSerial
|
|||||||
int read(void);
|
int read(void);
|
||||||
void flush(void);
|
void flush(void);
|
||||||
size_t write(const uint8_t c);
|
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);
|
void setInterruptPriority(uint32_t priority);
|
||||||
uint32_t getInterruptPriority();
|
uint32_t getInterruptPriority();
|
||||||
|
|
||||||
void IrqHandler(void);
|
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; }; // UART always active
|
operator bool() { return true; }; // UART always active
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,33 +32,8 @@ USARTClass::USARTClass( Usart* pUsart, IRQn_Type dwIrq, uint32_t dwId, RingBuffe
|
|||||||
|
|
||||||
// Public Methods //////////////////////////////////////////////////////////////
|
// Public Methods //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void USARTClass::begin( const uint32_t dwBaudRate )
|
|
||||||
{
|
|
||||||
begin( dwBaudRate, SERIAL_8N1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void USARTClass::begin( const uint32_t dwBaudRate, const uint32_t config )
|
void USARTClass::begin( const uint32_t dwBaudRate, const uint32_t config )
|
||||||
{
|
{
|
||||||
UARTClass::begin(dwBaudRate, 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:
|
public:
|
||||||
USARTClass( Usart* pUsart, IRQn_Type dwIrq, uint32_t dwId, RingBuffer* pRx_buffer, RingBuffer* pTx_buffer );
|
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 begin( const uint32_t dwBaudRate , const uint32_t config );
|
||||||
void end( void );
|
using UARTClass::begin; // Needed only for polymorphic methods
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _USART_CLASS_
|
#endif // _USART_CLASS_
|
||||||
|
Reference in New Issue
Block a user