USART
Simple usart using pooling method, with basic functions used for debug purpose.
Summary
| Members | Descriptions | 
|---|---|
| define USART_BAUD | |
| define MYUBRR | |
| define USART_HAS_DATA | |
| define USART_READY | |
| public inline void usart_send_char(char data) | sends a char through serial | 
| public inline char usart_receive_char(void) | gets data from serial. But BEWARE - it freezes until receive something | 
| public inline void usart_send_string(const char * s) | sends a char array roght serial. The strings are limited in 255 chars and MUST terminate with ‘\0’. | 
| public inline void usart_send_int8(int8_t num) | |
| public inline void usart_send_uint8(uint8_t num) | sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 6 because 2^16 have its maximum ascii size represented with 5 chars + ‘\0’ in the end. | 
| public inline void usart_send_int16(int16_t num) | |
| public inline void usart_send_uint16(uint16_t num) | sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 6 because 2^16 have its maximum ascii size represented with 5 chars + ‘\0’ in the end. | 
| public inline void usart_send_int32(int32_t num) | |
| public inline void usart_send_uint32(uint32_t num) | sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 11 because 2^32 have its maximum ascii size represented with 10 chars + ‘\0’ in the end. | 
| public inline void usart_send_buffer(uint8_t * b,uint8_t lenght) | sends a buffer through serial. Max lenght is 255. | 
| public inline void usart_init(uint16_t ubrr,uint8_t rx,uint8_t tx) | starts the usart. | 
| public inline void usart_send_float(float num) | sends a float number in ascii trough serial. | 
Members
  define USART_BAUD
  define MYUBRR
  define USART_HAS_DATA
  define USART_READY
  public inline void usart_send_char(char data)
sends a char through serial
Parameters
- datawill be sent trough serial
  public inline char usart_receive_char(void)
gets data from serial. But BEWARE - it freezes until receive something
  public inline void usart_send_string(const char * s)
sends a char array roght serial. The strings are limited in 255 chars and MUST terminate with ‘\0’.
  public inline void usart_send_int8(int8_t num)
  public inline void usart_send_uint8(uint8_t num)
sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 6 because 2^16 have its maximum ascii size represented with 5 chars + ‘\0’ in the end.
  public inline void usart_send_int16(int16_t num)
  public inline void usart_send_uint16(uint16_t num)
sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 6 because 2^16 have its maximum ascii size represented with 5 chars + ‘\0’ in the end.
  public inline void usart_send_int32(int32_t num)
  public inline void usart_send_uint32(uint32_t num)
sends a number in ascii trough serial. The number could be represent with left-filled with a defined FILL char in a defined BASE. Note that the LEN is 11 because 2^32 have its maximum ascii size represented with 10 chars + ‘\0’ in the end.
  public inline void usart_send_buffer(uint8_t * b,uint8_t lenght)
sends a buffer through serial. Max lenght is 255.
  public inline void usart_init(uint16_t ubrr,uint8_t rx,uint8_t tx)
starts the usart.
Parameters
- ubrris the baudrate
- rxenables the receive
- txenables the transmit it is recommended to use the following defines:- #define USART_BAUD 9600 #define MYUBRR F_CPU/16/USART_BAUD-1 usart_init(MYUBRR,1,1);
  public inline void usart_send_float(float num)
sends a float number in ascii trough serial.