AVRly - AVR Development Resources
|
Driver file providing core USART communication between the target MCU and your PC. This file was adapted from Elliot Williams' Github repo hexagon5un. (link in the see also section below). More...
Go to the source code of this file.
Functions | |
void | init_usart (void) |
Takes the defined BAUD and F_CPU, calculates the bit-clock multiplier, configures the hardware USART ready for use. More... | |
void | usart_print_string (const char myString[]) |
Utility function to transmit a string. More... | |
void | usart_read_string (char myString[], uint8_t maxLength) |
Define a string variable, pass it to this function. More... | |
void | usart_print_byte (uint8_t byte) |
Prints a byte out as its 3-digit ascii equivalent. More... | |
void | usart_print_decimal_digit (uint8_t byte) |
Prints a byte out as its 1-digit ascii equivalent. More... | |
void | usart_print_char (char byte) |
Prints a byte out as its 1-character ascii equivalent. More... | |
void | usart_print_word (uint16_t word) |
Prints a word (16-bits) out as its 5-digit ascii equivalent. More... | |
void | usart_print_binary_byte (uint8_t byte) |
Prints a byte out in 1s and 0s. More... | |
char | usart_nibble_to_hex_character (uint8_t nibble) |
Convert a nibble to a hex character. More... | |
void | usart_print_hex_byte (uint8_t byte) |
Prints a byte out in hexadecimal format. More... | |
uint8_t | usart_get_number (void) |
Takes in up to three ascii digits, converts them to a byte when press enter. More... | |
Driver file providing core USART communication between the target MCU and your PC. This file was adapted from Elliot Williams' Github repo hexagon5un. (link in the see also section below).
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
Definition in file usart.c.
void init_usart | ( | void | ) |
Takes the defined BAUD and F_CPU, calculates the bit-clock multiplier, configures the hardware USART ready for use.
Takes the defined BAUD and F_CPU, calculates the bit-clock multiplier, configures the hardware USART.
Definition at line 50 of file usart.c.
void usart_print_string | ( | const char | my_string[] | ) |
void usart_read_string | ( | char | my_string[], |
uint8_t | max_length | ||
) |
Define a string variable, pass it to this function.
The string will contain. whatever you typed over serial.
my_string | is a pointer to the first element in the character array you'd like to store the received message in. |
max_length | is the maximum number of characters expected. |
Definition at line 92 of file usart.c.
void usart_print_byte | ( | uint8_t | byte | ) |
Prints a byte out as its 3-digit ascii equivalent.
byte | is the 8 bits of data to be sent, must be unsigned. |
Definition at line 121 of file usart.c.
void usart_print_decimal_digit | ( | uint8_t | byte | ) |
void usart_print_char | ( | char | byte | ) |
void usart_print_word | ( | uint16_t | word | ) |
Prints a word (16-bits) out as its 5-digit ascii equivalent.
word | is the 16 bits of data to be sent, must be unsigned. |
Definition at line 161 of file usart.c.
void usart_print_binary_byte | ( | uint8_t | byte | ) |
Prints a byte out in 1s and 0s.
byte | is the 8 bits of data to be sent, must be unsigned. |
Definition at line 175 of file usart.c.
char usart_nibble_to_hex_character | ( | uint8_t | nibble | ) |
void usart_print_hex_byte | ( | uint8_t | byte | ) |
Prints a byte out in hexadecimal format.
byte | is the 8 bits of data to be sent, must be unsigned. |
Definition at line 213 of file usart.c.
uint8_t usart_get_number | ( | void | ) |
Takes in up to three ascii digits, converts them to a byte when press enter.
Definition at line 227 of file usart.c.