removed LED debuging in favor of serial. Also moved macro into header

This commit is contained in:
Jake Goodwin 2023-02-24 14:31:18 -08:00
parent 1d40f91885
commit 8d4fee5c7e
2 changed files with 8 additions and 38 deletions

View File

@ -11,25 +11,13 @@
#include "avr_usart.h"
#if DEBUG == 1
#define debug(data, data_len) serial0_write(data, data_len)
#else
#define debug_led(data, data_len)
#endif
//#############################
//Globals
//#############################
int main() {
led_blink();
led_blink();
led_blink();
_delay_ms(1000);
int demo() {
init_usart0();
//enable even parity
@ -43,7 +31,6 @@ int main() {
uint8_t data_cmd_len = 2;
while(1) {
led_blink();
serial0_write(data, data_len);
@ -238,22 +225,3 @@ void serial0_set_baud(uint8_t baud) {
UBRR0H |= (uint8_t) (baud>>8);
UBRR0L |= (uint8_t) baud;
}
/*
* Input: None
* Output: None
* Description: Toggles the pin for the LED indicator.
*/
static void led_blink(void) {
//Set the DDR for output.
DDRC |= (1<<LED_PIN);
PORTC ^= (1<<LED_PIN);
_delay_ms(250);
PORTC ^= (1<<LED_PIN);
_delay_ms(250);
}

View File

@ -1,8 +1,8 @@
/*
* Author: Jake Goodwin
* Date: 2023
* Description: AT-09 Bluetooth module library for AVR micro crontrollers.
* Filename: avr_at-09.h
* Description: A USART library for the atmega series of chips
* Filename: avr_usart.h
*/
//#define __AVR_ATmega328P__
#include <inttypes.h>
@ -51,13 +51,15 @@
#define CARRIAGE_RETURN 1
#define LINE_FEED 1
#if DEBUG == 1
#define debug(data, data_len) serial0_write(data, data_len)
#else
#define debug(data, data_len)
#endif
//#############################
//FUNCTION PROTOTYPES
//#############################
static void led_blink(void);
void init_usart0(void);
void tx_usart0(unsigned char data);
unsigned char rx_usart0(void);