updated to have helper function

This commit is contained in:
Jake Goodwin 2024-08-04 12:10:36 -07:00
parent cdaa4270d3
commit 804e09b80b
2 changed files with 34 additions and 8 deletions

View File

@ -7,12 +7,30 @@
* @file module_name.h
*/
#include "timer.h"
// Used during testing and for the LSP
#ifndef __AVR_ATtiny404__
#define __AVR_ATtiny404__
#endif
// dumb test function
int add_two(int a)
#include "timer.h"
#include "avr/io.h"
void Timer_SelectClock(void)
{
int b = a;
b += 2;
return b;
//set the timer to divde the clock by 256
//Check datasheet page: 189
TCA0.SINGLE.CTRLA |= 0x6;
}
void Timer_Enable(void)
{
TCA0.SINGLE.CTRLA |= (1<<0);
}
void Timer_Period(void)
{
TCA0.SINGLE.PER = 10000;
}

View File

@ -10,10 +10,18 @@
#ifndef TIMER
#define TIMER
#include "inttypes.h"
/**
* A function that adds two to a number
*
* @param a The first argument
*/
int add_two(int a);
/**
* The timer select clock function sets the divider to 256 assuming a
* default clock diver of 6 is applied to the 20MHz crystal. This gives a
* 13020.8333 Hz or approximatly 13.02Khz tick rate.
*/
void Timer_SelectClock(void);
#endif // TIMER