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 * @file module_name.h
*/ */
#include "timer.h" // Used during testing and for the LSP
#ifndef __AVR_ATtiny404__
#define __AVR_ATtiny404__
#endif
// dumb test function #include "timer.h"
int add_two(int a) #include "avr/io.h"
void Timer_SelectClock(void)
{ {
int b = a; //set the timer to divde the clock by 256
b += 2; //Check datasheet page: 189
return b; 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 #ifndef TIMER
#define TIMER #define TIMER
#include "inttypes.h"
/** /**
* A function that adds two to a number *
* @param a The first argument * @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 #endif // TIMER