48 lines
914 B
C
48 lines
914 B
C
/*
|
|
* 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
|
|
*/
|
|
#define FOSC 1000000
|
|
#define BLE_BAUD 9600
|
|
#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);
|
|
|