HardwareSerial - availableForWrite() support (#1226)
* HardwareSerial - availableForWrite() support * fix indentation errors (tab vs space)
This commit is contained in:
parent
149190fe11
commit
aa1288aa6e
@ -62,6 +62,10 @@ int HardwareSerial::available(void)
|
||||
{
|
||||
return uartAvailable(_uart);
|
||||
}
|
||||
int HardwareSerial::availableForWrite(void)
|
||||
{
|
||||
return uartAvailableForWrite(_uart);
|
||||
}
|
||||
|
||||
int HardwareSerial::peek(void)
|
||||
{
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void begin(unsigned long baud, uint32_t config=SERIAL_8N1, int8_t rxPin=-1, int8_t txPin=-1, bool invert=false);
|
||||
void end();
|
||||
int available(void);
|
||||
int availableForWrite(void);
|
||||
int peek(void);
|
||||
int read(void);
|
||||
void flush(void);
|
||||
|
@ -248,6 +248,14 @@ uint32_t uartAvailable(uart_t* uart)
|
||||
return uxQueueMessagesWaiting(uart->queue);
|
||||
}
|
||||
|
||||
uint32_t uartAvailableForWrite(uart_t* uart)
|
||||
{
|
||||
if(uart == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return 0x7f - uart->dev->status.txfifo_cnt;
|
||||
}
|
||||
|
||||
uint8_t uartRead(uart_t* uart)
|
||||
{
|
||||
if(uart == NULL || uart->queue == NULL) {
|
||||
|
@ -55,6 +55,7 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
|
||||
void uartEnd(uart_t* uart);
|
||||
|
||||
uint32_t uartAvailable(uart_t* uart);
|
||||
uint32_t uartAvailableForWrite(uart_t* uart);
|
||||
uint8_t uartRead(uart_t* uart);
|
||||
uint8_t uartPeek(uart_t* uart);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user