53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
/**
|
|
* @mainpage
|
|
* Peripherals
|
|
*
|
|
* @brief Peripheral initialization functions and interrupt handling routines.
|
|
*
|
|
*
|
|
* Contains the ISRs to handle the USART RX interrupt and the display timer interrupt.
|
|
*/
|
|
|
|
|
|
#ifndef PERIPH_H_
|
|
#define PERIPH_H_
|
|
|
|
#include "main.h"
|
|
|
|
|
|
#define USART_BAUDRATE 9600 //! USART baudrate, change this to set it.
|
|
#define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1)
|
|
|
|
#define BUTTONS_DDR DDRD
|
|
#define BUTTONS_LEFT_DDR DDRA
|
|
#define BUTTONS_RIGHT_DDR DDRA
|
|
#define BUTTONS_PLAYPAUSE_DDR DDRB
|
|
#define BUTTONS_LEFT_PORT PORTA
|
|
#define BUTTONS_RIGHT_PORT PORTA
|
|
#define BUTTONS_PLAYPAUSE_PORT PORTB
|
|
#define BUTTONS_LEFT_PIN PINA
|
|
#define BUTTONS_RIGHT_PIN PINA
|
|
#define BUTTONS_PLAYPAUSE_PIN PINB
|
|
#define BUTTONS_LEFT 0
|
|
#define BUTTONS_RIGHT 1
|
|
#define BUTTONS_PLAYPAUSE 2
|
|
|
|
|
|
/** @brief Sets up various GPIO functions
|
|
*
|
|
* First enables buttons as inputs.
|
|
*/
|
|
void gpio_init();
|
|
|
|
/** @brief Initialises timer for updating display
|
|
*
|
|
* Sets up timer0 in
|
|
*/
|
|
void timer_init();
|
|
|
|
/** @brief Sets up USART for TX and RX with a baud rate of USART_BAUDRATE
|
|
*/
|
|
void usart_init();
|
|
|
|
|
|
#endif |