aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usart.h
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/usart.h')
-rw-r--r--libmaple/usart.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/libmaple/usart.h b/libmaple/usart.h
index 2bc472f..593fb8f 100644
--- a/libmaple/usart.h
+++ b/libmaple/usart.h
@@ -1,4 +1,4 @@
-/* *****************************************************************************
+/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
@@ -20,10 +20,10 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
- * ****************************************************************************/
+ *****************************************************************************/
/**
- * @brief USART definitions and prototypes
+ * @brief USART definitions and prototypes
*/
#ifndef _USART_H_
@@ -39,11 +39,11 @@ extern "C"{
/* usart device numbers */
enum {
- USART1,
- USART2,
- USART3,
- UART4,
- UART5,
+ USART1,
+ USART2,
+ USART3,
+ UART4,
+ UART5,
};
/* peripheral register struct */
@@ -59,16 +59,15 @@ typedef struct usart_port {
/* usart descriptor */
struct usart_dev {
- usart_port *base;
- ring_buffer rb;
- uint8 rx_buf[64];
- const uint8 rcc_dev_num;
- const uint8 nvic_dev_num;
+ usart_port *base;
+ ring_buffer rb;
+ uint8 rx_buf[64];
+ const uint8 rcc_dev_num;
+ const uint8 nvic_dev_num;
};
extern struct usart_dev usart_dev_table[];
-
/**
* @brief send one character on a usart
* @param usart_num usart to send on
@@ -84,7 +83,6 @@ static inline void usart_putc(uint8 usart_num, uint8 byte) {
;
}
-
/**
* @brief read one character from a usart
* @param usart_num usart to read from
@@ -94,7 +92,6 @@ static inline uint8 usart_getc(uint8 usart_num) {
return rb_remove(&usart_dev_table[usart_num].rb);
}
-
/**
* @brief return the amount of data available in the rx buffer
* @param usart_num which usart to check
@@ -104,7 +101,6 @@ static inline uint32 usart_data_available(uint8 usart_num) {
return rb_full_count(&usart_dev_table[usart_num].rb);
}
-
/**
* @brief removes the contents of the rx fifo
* @param usart_num which usart to reset
@@ -123,6 +119,4 @@ void usart_putudec(uint8 usart_num, uint32 val);
} // extern "C"
#endif
-
-#endif
-
+#endif // _USART_H_