2023-01-14 05:13:45 +00:00
|
|
|
/*
|
|
|
|
* Author: Jake Goodwin
|
|
|
|
* Date: 2023
|
|
|
|
* Description: AT-09 Bluetooth module library for AVR micro crontrollers.
|
|
|
|
* Filename: avr_at-09.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//#############################
|
|
|
|
//PIN DEFINES AND CONSTS
|
|
|
|
//#############################
|
|
|
|
|
|
|
|
/*
|
|
|
|
* AVR D0 --> AT-09 TX
|
|
|
|
* AVR D1 --> AT-09 RX
|
|
|
|
* AVR D2 --> AT-09 State
|
|
|
|
*/
|
2023-01-14 06:48:19 +00:00
|
|
|
#define FOSC 8000000
|
|
|
|
#define BLE_BAUD 9600
|
2023-01-14 05:13:45 +00:00
|
|
|
#define BT_UBRR FOSC/16/BLE_BAUD - 1
|
|
|
|
|
|
|
|
#define TX_PIN PIND0
|
|
|
|
#define TX_DDR DDD0
|
|
|
|
|
|
|
|
#define RX_PIN PIND1
|
|
|
|
#define RX_DDR DDD1
|
|
|
|
|
|
|
|
#define AT_PORT PORTD
|
|
|
|
|
|
|
|
//LED PIN for indicator and debug.
|
|
|
|
#define LED_PIN PINC0
|
|
|
|
#define LED_DDR DDC0
|
|
|
|
|
|
|
|
|
|
|
|
//#############################
|
|
|
|
//TYPES
|
|
|
|
//#############################
|
|
|
|
|
|
|
|
//#############################
|
|
|
|
//FUNCTION PROTOTYPES
|
|
|
|
//#############################
|
|
|
|
static void led_blink(void);
|
|
|
|
|
|
|
|
void init_usart0(void);
|
|
|
|
void tx_usart0(unsigned char data);
|
|
|
|
unsigned char rx_usart0(void);
|
|
|
|
|