Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
15 | mjames | 1 | #pragma once |
2 | #include <stdint.h> |
||
3 | #if defined __cplusplus |
||
4 | extern "C" |
||
5 | { |
||
6 | #endif |
||
7 | |||
8 | |||
9 | ///@brief returns the number of characters in the recieve buffer |
||
10 | ///@param instance Pointer to usart_ctl structure |
||
11 | ///@return Number of characters |
||
12 | extern uint16_t SerialCharsReceived(struct usart_ctl *instance); |
||
13 | |||
14 | ///@brief Get the amount of free space in the transmit buffer. |
||
15 | ///@param instance Pointer to usart_ctl structure |
||
16 | ///@return Free space at time of checking |
||
17 | extern uint16_t SerialTransmitSpace(struct usart_ctl *instance); |
||
18 | |||
19 | /// @brief Return 1 if there are any characters in the receive buffer |
||
20 | /// @param instance Pointer to usart_ctl structure |
||
21 | /// @return 1 if any characters |
||
22 | extern uint8_t PollSerial(struct usart_ctl *instance); |
||
23 | |||
24 | /// @brief return the next character in the Serial input buffer |
||
25 | /// This function will wait until a character arrives. |
||
26 | /// Use PollSerial() or SerialCharsReceived() if you want |
||
27 | /// to ensure you do not block here. |
||
28 | /// @param instance Pointer to usart_ctl structure |
||
29 | /// @return next character |
||
30 | extern uint8_t GetCharSerial(struct usart_ctl *instance); |
||
31 | |||
32 | /// @brief Enable the receive interrupt |
||
33 | /// @param instance |
||
34 | extern void EnableSerialRxInterrupt(struct usart_ctl *instance); |
||
35 | |||
36 | /// @brief Send a character |
||
37 | /// @param instance Pointer to usart_ctl structure |
||
38 | /// @param c character to send |
||
39 | extern void PutCharSerial(struct usart_ctl *instance, uint8_t c); |
||
40 | |||
41 | /// @brief Reset transmit buffer |
||
42 | /// @param instance Pointer to usart_ctl structure |
||
43 | extern void ResetTxBuffer(struct usart_ctl *instance); |
||
44 | |||
45 | /// @brief Reset receive buffer |
||
46 | /// @param instance Pointer to usart_ctl structure |
||
47 | extern void ResetRxBuffer(struct usart_ctl *instance); |
||
48 | |||
49 | /// @brief Reset both transmit and receive buffers |
||
50 | /// @param instance Pointer to usart_ctl structure |
||
51 | extern void FlushSerial(struct usart_ctl *instance); |
||
52 | |||
53 | /// @brief Check if the transmitter buffer is empty |
||
54 | /// @param instance Pointer to usart_ctl structure |
||
55 | /// @return 1 if the buffer is empty |
||
56 | extern uint8_t TxBufferEmpty(struct usart_ctl *instance); |
||
57 | |||
58 | ///@brief wait until the USART buffer is empty and all characters are sent |
||
59 | /// @param instance Pointer to usart_ctl structure |
||
60 | extern void TxWaitEmpty(struct usart_ctl *instance); |
||
61 | |||
62 | |||
63 | /// @brief Set the baud rate on this instance |
||
64 | /// @param instance Pointer to usart_ctl structure |
||
65 | /// @param baud Baud rate in bits per second |
||
66 | extern void setBaud(struct usart_ctl *instance, uint32_t baud); |
||
67 | |||
68 | |||
69 | |||
70 | #if defined __cplusplus |
||
71 | } |
||
72 | #endif |