Compare commits

..

No commits in common. "8d4fee5c7e7ac030cc2cced0e929bebe072e2f5b" and "6feec2b706fa5ebf82643c95bfd171b050417233" have entirely different histories.

2 changed files with 32 additions and 9 deletions

View file

@ -11,13 +11,18 @@
#include "avr_usart.h" #include "avr_usart.h"
//############################# //#############################
//Globals //Globals
//############################# //#############################
int demo() { int main() {
led_blink();
led_blink();
led_blink();
_delay_ms(1000);
init_usart0(); init_usart0();
//enable even parity //enable even parity
@ -31,6 +36,7 @@ int demo() {
uint8_t data_cmd_len = 2; uint8_t data_cmd_len = 2;
while(1) { while(1) {
led_blink();
serial0_write(data, data_len); serial0_write(data, data_len);
@ -225,3 +231,22 @@ void serial0_set_baud(uint8_t baud) {
UBRR0H |= (uint8_t) (baud>>8); UBRR0H |= (uint8_t) (baud>>8);
UBRR0L |= (uint8_t) baud; 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 * Author: Jake Goodwin
* Date: 2023 * Date: 2023
* Description: A USART library for the atmega series of chips * Description: AT-09 Bluetooth module library for AVR micro crontrollers.
* Filename: avr_usart.h * Filename: avr_at-09.h
*/ */
//#define __AVR_ATmega328P__ //#define __AVR_ATmega328P__
#include <inttypes.h> #include <inttypes.h>
@ -51,15 +51,13 @@
#define CARRIAGE_RETURN 1 #define CARRIAGE_RETURN 1
#define LINE_FEED 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 //FUNCTION PROTOTYPES
//############################# //#############################
static void led_blink(void);
void init_usart0(void); void init_usart0(void);
void tx_usart0(unsigned char data); void tx_usart0(unsigned char data);
unsigned char rx_usart0(void); unsigned char rx_usart0(void);