ATtiny85 Template Code
Code snippets for the ATtiny85
|
#include <avr/io.h>
Go to the source code of this file.
Macros | |
#define | UART_ENABLED |
#define | SYSTICK_ENABLED |
#define | SOFTPWM_ENABLED |
#define | BAUD_RATE 57600 |
#define | UART_TX PINB5 |
#define | UART_RX PINB5 |
#define | UART_INTERRUPT |
#define | UART_BUFFER 4 |
#define | SPWM_COUNT 3 |
#define | SPWM_PIN0 PINB0 |
#define | SPWM_PIN1 PINB1 |
#define | SPWM_PIN2 PINB2 |
#define | SPWM_PIN3 PINB3 |
#define | LCD_MOSI PINB2 |
#define | LCD_SCK PINB4 |
#define | LCD_CD PINB1 |
#define | LCD_RESET PINB0 |
#define BAUD_RATE 57600 |
Baud rate to use
The implementation is optimised for higher baudrates - please don't use anything below 57600 on an 8MHz clock. It does work at up to 250000 baud but you may experience a small amount of dropped packets at that speed.
Definition at line 54 of file hardware.h.
#define LCD_CD PINB1 |
Definition at line 118 of file hardware.h.
#define LCD_MOSI PINB2 |
Definition at line 116 of file hardware.h.
#define LCD_RESET PINB0 |
Definition at line 119 of file hardware.h.
#define LCD_SCK PINB4 |
Definition at line 117 of file hardware.h.
#define SOFTPWM_ENABLED |
Software PWM
This enables the software PWM implementation which can generate PWM output at 100Hz on up to 4 output pins.
Definition at line 42 of file hardware.h.
#define SPWM_COUNT 3 |
Number of software PWM pins required
There can be up to 4 pins. For each pin you must define SPWM_PINn where n is SPWM number.
Definition at line 91 of file hardware.h.
#define SPWM_PIN0 PINB0 |
Pin associated with SPWM0
Definition at line 94 of file hardware.h.
#define SPWM_PIN1 PINB1 |
Pin associated with SPWM1
Definition at line 97 of file hardware.h.
#define SPWM_PIN2 PINB2 |
Pin associated with SPWM2
Definition at line 100 of file hardware.h.
#define SPWM_PIN3 PINB3 |
Pin associated with SPWM3
Definition at line 103 of file hardware.h.
#define SYSTICK_ENABLED |
System Ticks
Enable the system ticks implementation. This allows measurement of longer periods of time (up to 11 minutes) with a 0.01 second precision.
Definition at line 35 of file hardware.h.
#define UART_BUFFER 4 |
Size of input buffer
Only available in interrupt driven mode. This sets the size of the receive buffer (max 256 bytes).
Definition at line 80 of file hardware.h.
#define UART_ENABLED |
Software UART
This feature provides a software implementation of a UART allowing you to perform serial communications. It supports speeds of up to 250Kbps, can be configured to use a single IO pin and has an option to be interrupt driven.
Definition at line 28 of file hardware.h.
#define UART_INTERRUPT |
Enable interrupt driven mode
Only valid in two pin configuration. If this is defined and you are using two pins for the UART then received data will be read and buffered as it arrives.
Definition at line 73 of file hardware.h.
#define UART_RX PINB5 |
Define the pin to use for receiving
If this pin is the same as the TX pin the code for the single pin UART implementation is compiled. This means no buffering and no interrupts.
Definition at line 65 of file hardware.h.
#define UART_TX PINB5 |
Define the pin to use for transmission
Definition at line 58 of file hardware.h.