Compare commits
No commits in common. "8d4fee5c7e7ac030cc2cced0e929bebe072e2f5b" and "6feec2b706fa5ebf82643c95bfd171b050417233" have entirely different histories.
8d4fee5c7e
...
6feec2b706
2 changed files with 32 additions and 9 deletions
|
@ -11,13 +11,18 @@
|
|||
#include "avr_usart.h"
|
||||
|
||||
|
||||
|
||||
//#############################
|
||||
//Globals
|
||||
//#############################
|
||||
|
||||
|
||||
int demo() {
|
||||
int main() {
|
||||
|
||||
led_blink();
|
||||
led_blink();
|
||||
led_blink();
|
||||
_delay_ms(1000);
|
||||
|
||||
init_usart0();
|
||||
|
||||
//enable even parity
|
||||
|
@ -31,6 +36,7 @@ int demo() {
|
|||
uint8_t data_cmd_len = 2;
|
||||
|
||||
while(1) {
|
||||
led_blink();
|
||||
|
||||
serial0_write(data, data_len);
|
||||
|
||||
|
@ -225,3 +231,22 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Author: Jake Goodwin
|
||||
* Date: 2023
|
||||
* Description: A USART library for the atmega series of chips
|
||||
* Filename: avr_usart.h
|
||||
* Description: AT-09 Bluetooth module library for AVR micro crontrollers.
|
||||
* Filename: avr_at-09.h
|
||||
*/
|
||||
//#define __AVR_ATmega328P__
|
||||
#include <inttypes.h>
|
||||
|
@ -51,15 +51,13 @@
|
|||
#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);
|
||||
|
|
Loading…
Add table
Reference in a new issue