From 171eebc4fb5ded65637d056c24efe1bcd382a589 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 16 Aug 2011 04:12:47 -0400 Subject: HardwareSerial: trivial code reordering --- wirish/comm/HardwareSerial.cpp | 30 +++++++++++++++++++----------- wirish/comm/HardwareSerial.h | 4 ++++ 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'wirish') diff --git a/wirish/comm/HardwareSerial.cpp b/wirish/comm/HardwareSerial.cpp index 5ec9451..fba68fd 100644 --- a/wirish/comm/HardwareSerial.cpp +++ b/wirish/comm/HardwareSerial.cpp @@ -67,17 +67,9 @@ HardwareSerial::HardwareSerial(usart_dev *usart_device, this->rx_pin = rx_pin; } -uint8 HardwareSerial::read(void) { - return usart_getc(usart_device); -} - -uint32 HardwareSerial::available(void) { - return usart_data_available(usart_device); -} - -void HardwareSerial::write(unsigned char ch) { - usart_putc(usart_device, ch); -} +/* + * Set up/tear down + */ void HardwareSerial::begin(uint32 baud) { ASSERT(baud <= usart_device->max_baud); @@ -106,6 +98,22 @@ void HardwareSerial::end(void) { usart_disable(usart_device); } +/* + * I/O + */ + +uint8 HardwareSerial::read(void) { + return usart_getc(usart_device); +} + +uint32 HardwareSerial::available(void) { + return usart_data_available(usart_device); +} + +void HardwareSerial::write(unsigned char ch) { + usart_putc(usart_device, ch); +} + void HardwareSerial::flush(void) { usart_reset_rx(usart_device); } diff --git a/wirish/comm/HardwareSerial.h b/wirish/comm/HardwareSerial.h index 49d535d..a347051 100644 --- a/wirish/comm/HardwareSerial.h +++ b/wirish/comm/HardwareSerial.h @@ -56,8 +56,12 @@ public: uint8 tx_pin, uint8 rx_pin, uint32 clock_speed); + + /* Set up/tear down */ void begin(uint32 baud); void end(void); + + /* I/O */ uint32 available(void); uint8 read(void); void flush(void); -- cgit v1.2.3