|
ATtiny85 Template Code
Code snippets for the ATtiny85
|
#include <stdint.h>#include <avr/pgmspace.h>

Go to the source code of this file.
Macros | |
| #define | PRINT(msg) |
| #define | PRINTF(fmt,...) |
Functions | |
| void | uartInit () |
| void | uartSend (char ch) |
| uint8_t | uartAvail () |
| char | uartRecv () |
| void | uartPrint (const char *cszString) |
| void | uartPrintP (const char *cszString) |
| void | uartInt (uint16_t value) |
| void | uartHex (uint16_t value) |
| void | uartFormat (const char *cszString,...) |
| void | uartFormatP (const char *cszString,...) |
| #define PRINT | ( | msg | ) |
Definition at line 153 of file softuart.h.
| #define PRINTF | ( | fmt, | |
| ... | |||
| ) |
Definition at line 154 of file softuart.h.
| uint8_t uartAvail | ( | ) |
Determine if characters are available
Check the number of characters available for immediate reading. If this function returns a non-zero value the next call to uartRecv() will be guaranteed to return immediately with a value. This function is only valid if you are using the interrupt driven version of the UART.
Definition at line 51 of file uart_recv.c.
| void uartFormat | ( | const char * | cszString, |
| ... | |||
| ) |
Print a formatted string from RAM
Prints a formatted string from RAM to the serial port. This function supports a subset of the 'printf' string formatting syntax. Allowable insertion types are:
%% - Display a % character. There should be no entry in the variable argument list for this entry. u - Display an unsigned integer in decimal. The matching argument may be any 16 bit value. x - Display an unsigned integer in hexadecimal. The matching argument may be any 16 bit value. c - Display a single ASCII character. The matching argument may be any 8 bit value. s - Display a NUL terminated string from RAM. The matching argument must be a pointer to a RAM location. S - Display a NUL terminated string from PROGMEM. The matching argument must be a pointer to a PROGMEM location.
| cszString | pointer to a nul terminated format string in RAM. |
Definition at line 82 of file uart_format.c.
| void uartFormatP | ( | const char * | cszString, |
| ... | |||
| ) |
Print a formatted string from PROGMEM
Prints a formatted string from PROGMEM to the serial port. This function supports a subset of the 'printf' string formatting syntax. Allowable insertion types are:
%% - Display a % character. There should be no entry in the variable argument list for this entry. u - Display an unsigned integer in decimal. The matching argument may be any 16 bit value. x - Display an unsigned integer in hexadecimal. The matching argument may be any 16 bit value. c - Display a single ASCII character. The matching argument may be any 8 bit value. s - Display a NUL terminated string from RAM. The matching argument must be a pointer to a RAM location. S - Display a NUL terminated string from PROGMEM. The matching argument must be a pointer to a PROGMEM location.
| cszString | pointer to a nul terminated format string in PROGMEM. |
Definition at line 119 of file uart_format.c.
| void uartHex | ( | uint16_t | value | ) |
Print an unsigned 16 bit value in hexadecimal
Print the given value in hexadecimal format to the UART.
| value | the value to print. |
Definition at line 74 of file uart_print.c.

| void uartInit | ( | ) |
Initialise the UART
Definition at line 30 of file uart_send.c.
| void uartInt | ( | uint16_t | value | ) |
Print an unsigned 16 bit value in decimal
Print the given value in decimal format to the UART.
| value | the value to print. |
Definition at line 50 of file uart_print.c.

| void uartPrint | ( | const char * | cszString | ) |
Print a string from RAM
This function simply prints the nul terminated string from RAM to the serial port.
| cszString | pointer to a character array in RAM. |
Definition at line 22 of file uart_print.c.

| void uartPrintP | ( | const char * | cszString | ) |
Print a string from PROGMEM
This function simply prints the nul terminated string from PROGMEM to the serial port.
| cszString | pointer to a character array in PROGMEM. |
Definition at line 36 of file uart_print.c.

| char uartRecv | ( | ) |
Receive a single character
Wait for a single character on the UART and return it. If data is not immediately available this function will block until data has been received.
Receive a single character
Wait for a single character on the UART and return it.
Definition at line 65 of file uart_recv.c.
| void uartSend | ( | char | ch | ) |
Write a single character
Send a single character on the UART.
| ch | the character to send. |
Definition at line 52 of file uart_send.c.
