have example program running

This commit is contained in:
jakeg00dwin 2024-08-05 15:37:50 -07:00
parent 2eb2253571
commit 6f878791e8
1 changed files with 41 additions and 12 deletions

View File

@ -9,6 +9,7 @@
* extracted into separate source files and headers for configuration.
*/
#include <stdio.h>
#define F_CPU 3333333UL
// This can prevent issues with utils/delay.h library with the gcc toolchain
@ -22,28 +23,56 @@
#include <avr/io.h>
#include <util/delay.h>
/*
char msg[] = "Attiny404:\n\r";
char maketime_msg[] = "Make Time(10Khz):";
char breaktime_msg[] = "Break Time(10Khz):";
*/
//char msg[] = "Attiny404:\n\r";
char maketime_msg[] = "\r\nMake Time(10Khz):";
char hi_msg[] = " Hi byte: ";
char lo_msg[] = " Lo byte: ";
char overflow_count_msg[] = " Overflows: ";
//char breaktime_msg[] = "Break Time(10Khz):";
char hex_msg[3];
//Set the function pointer for the delay func
void (*Delay_MicroSeconds)(double us) = _delay_us;
void delay_period()
{
Timer_Enable();
Timer_BlockingWait();
Timer_Disable();
}
int main(int argc, char **argv)
{
//USART0_Init();
//Timer_Setup();
//Uart_Setup();
USART0_Init();
//Timer_SelectClock();
//Timer_Period();
PORTA.DIR |= (1<<7);
uint16_t cnt = 0;
uint8_t hi, lo;
while(true){
_delay_ms(500);
PORTA.OUT ^= (1<<7);
_delay_ms(500);
PORTA.OUT ^= (1<<7);
Timer_Start();
_delay_ms(250);
Timer_Disable();
cnt = Timer_GetOverflowCount();
USART0_sendString(maketime_msg);
hi = (uint8_t)(cnt >> 8);
lo = (uint8_t) (cnt & 0x00FF);
USART0_sendString(hi_msg);
USART0_sendChar(hi);
//USART0_sendString(hex_msg);
USART0_sendString(lo_msg);
USART0_sendChar(lo);
/*
USART0_sendString(msg);
USART0_sendString(maketime_msg);