-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
236205b
commit e799c44
Showing
8 changed files
with
382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | ||
<storageModule moduleId="org.eclipse.cdt.core.settings"> | ||
<cconfiguration id="de.innot.avreclipse.configuration.app.debug.480103021"> | ||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.debug.480103021" moduleId="org.eclipse.cdt.core.settings" name="Debug"> | ||
<externalSettings/> | ||
<extensions> | ||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | ||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
</extensions> | ||
</storageModule> | ||
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" id="de.innot.avreclipse.configuration.app.debug.480103021" name="Debug" parent="de.innot.avreclipse.configuration.app.debug"> | ||
<folderInfo id="de.innot.avreclipse.configuration.app.debug.480103021." name="/" resourcePath=""> | ||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.debug.40370098" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.debug"> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug.1373641949" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug.1648512729" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug.349859717" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.1611775689" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.7531204" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/> | ||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.279136119" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/> | ||
<builder buildPath="${workspace_loc:/Timer 1}/Debug" id="de.innot.avreclipse.target.builder.winavr.app.debug.1255716588" managedBuildOn="true" name="AVR GNU Make Builder.Debug" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.1003491382" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug"> | ||
<option id="de.innot.avreclipse.assembler.option.debug.level.1673452522" superClass="de.innot.avreclipse.assembler.option.debug.level"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.588349178" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug"> | ||
<option id="de.innot.avreclipse.compiler.option.debug.level.179583033" superClass="de.innot.avreclipse.compiler.option.debug.level"/> | ||
<option id="de.innot.avreclipse.compiler.option.optimize.619374659" superClass="de.innot.avreclipse.compiler.option.optimize"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.2049122931" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug"> | ||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.1499182409" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/> | ||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1387085459" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.546342903" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.1439043146" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.2002813622" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/> | ||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.818711277" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.605991320" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug.179418901" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.size.winavr.app.debug.1867814035" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.debug"/> | ||
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.293082262" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/> | ||
</toolChain> | ||
</folderInfo> | ||
</configuration> | ||
</storageModule> | ||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | ||
</cconfiguration> | ||
<cconfiguration id="de.innot.avreclipse.configuration.app.release.1584033700"> | ||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.release.1584033700" moduleId="org.eclipse.cdt.core.settings" name="Release"> | ||
<externalSettings/> | ||
<extensions> | ||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | ||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||
</extensions> | ||
</storageModule> | ||
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1584033700" name="Release" parent="de.innot.avreclipse.configuration.app.release"> | ||
<folderInfo id="de.innot.avreclipse.configuration.app.release.1584033700." name="/" resourcePath=""> | ||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.296726848" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.release"> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.169603616" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release.1887413405" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release.1075917458" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.743174070" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/> | ||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1938922110" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/> | ||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.318802398" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/> | ||
<builder buildPath="${workspace_loc:/Timer 1}/Release" id="de.innot.avreclipse.target.builder.winavr.app.release.367508001" managedBuildOn="true" name="AVR GNU Make Builder.Release" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1463593445" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release"> | ||
<option id="de.innot.avreclipse.assembler.option.debug.level.525226572" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/> | ||
<inputType id="de.innot.avreclipse.tool.assembler.input.397757194" superClass="de.innot.avreclipse.tool.assembler.input"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.2083658172" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release"> | ||
<option id="de.innot.avreclipse.compiler.option.debug.level.1580573206" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/> | ||
<option id="de.innot.avreclipse.compiler.option.optimize.848245929" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/> | ||
<inputType id="de.innot.avreclipse.compiler.winavr.input.2096158778" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.1202421362" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release"> | ||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.1468879744" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/> | ||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.59017949" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.693517006" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release"> | ||
<inputType id="de.innot.avreclipse.tool.linker.input.1388220953" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input"> | ||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | ||
<additionalInput kind="additionalinput" paths="$(LIBS)"/> | ||
</inputType> | ||
</tool> | ||
<tool id="de.innot.avreclipse.tool.cpplinker.app.release.1738090434" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.2075204803" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/> | ||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.release.415722148" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release.799362720" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release.931740981" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.size.winavr.app.release.976224031" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.release"/> | ||
<tool id="de.innot.avreclipse.tool.avrdude.app.release.1728301692" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.release"/> | ||
</toolChain> | ||
</folderInfo> | ||
</configuration> | ||
</storageModule> | ||
</cconfiguration> | ||
</storageModule> | ||
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||
<project id="Timer 1.de.innot.avreclipse.project.winavr.elf_2.1.0.480014960" name="AVR Cross Target Application" projectType="de.innot.avreclipse.project.winavr.elf_2.1.0"/> | ||
</storageModule> | ||
<storageModule moduleId="scannerConfiguration"> | ||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | ||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.1584033700;de.innot.avreclipse.configuration.app.release.1584033700.;de.innot.avreclipse.tool.compiler.winavr.app.release.2083658172;de.innot.avreclipse.compiler.winavr.input.2096158778"> | ||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> | ||
</scannerConfigBuildInfo> | ||
</storageModule> | ||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | ||
</cproject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Timer 1</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | ||
<triggers>clean,full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | ||
<triggers>full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.cdt.core.cnature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | ||
<nature>de.innot.avreclipse.core.avrnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
avrtarget/ClockFrequency=1000000 | ||
avrtarget/ExtRAMSize=0 | ||
avrtarget/ExtendedRAM=false | ||
avrtarget/MCUType=atmega32 | ||
avrtarget/UseEEPROM=false | ||
avrtarget/UseExtendedRAMforHeap=true | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/****************************************************************************** | ||
* | ||
* Module: Common - Macros | ||
* File Name: Common_Macros.h | ||
* Description: Commonly used Macros | ||
* Author: Ibrahim Mohamed | ||
* | ||
*******************************************************************************/ | ||
|
||
#ifndef COMMON_MACROS | ||
#define COMMON_MACROS | ||
|
||
/* Set a certain bit in any register */ | ||
#define SET_BIT(REG,BIT) (REG|=(1<<BIT)) | ||
|
||
/* Clear a certain bit in any register */ | ||
#define CLEAR_BIT(REG,BIT) (REG&=(~(1<<BIT))) | ||
|
||
/* Toggle a certain bit in any register */ | ||
#define TOGGLE_BIT(REG,BIT) (REG^=(1<<BIT)) | ||
|
||
/* Rotate right the register value with specific number of rotates */ | ||
#define ROR(REG,num) ( REG= (REG>>num) | (REG<<(8-num)) ) | ||
|
||
/* Rotate left the register value with specific number of rotates */ | ||
#define ROL(REG,num) ( REG= (REG<<num) | (REG>>(8-num)) ) | ||
|
||
/* Check if a specific bit is set in any register and return true if yes */ | ||
#define BIT_IS_SET(REG,BIT) ( REG & (1<<BIT) ) | ||
|
||
/* Check if a specific bit is cleared in any register and return true if yes */ | ||
#define BIT_IS_CLEAR(REG,BIT) ( !(REG & (1<<BIT)) ) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/****************************************************************************** | ||
* | ||
* Module: Common - Platform Types Abstraction | ||
* File Name: std_types.h | ||
* Description: types for AVR | ||
* Author: Ibrahim Mohamed | ||
* | ||
*******************************************************************************/ | ||
|
||
#ifndef STD_TYPES_H_ | ||
#define STD_TYPES_H_ | ||
|
||
/* Boolean Data Type */ | ||
typedef unsigned char boolean; | ||
|
||
/* Boolean Values */ | ||
#ifndef FALSE | ||
#define FALSE (0u) | ||
#endif | ||
#ifndef TRUE | ||
#define TRUE (1u) | ||
#endif | ||
|
||
#define LOGIC_HIGH (1u) | ||
#define LOGIC_LOW (0u) | ||
|
||
#define NULL_PTR ((void*)0) | ||
|
||
typedef unsigned char uint8; /* 0 .. 255 */ | ||
typedef signed char sint8; /* -128 .. +127 */ | ||
typedef unsigned short uint16; /* 0 .. 65535 */ | ||
typedef signed short sint16; /* -32768 .. +32767 */ | ||
typedef unsigned long uint32; /* 0 .. 4294967295 */ | ||
typedef signed long sint32; /* -2147483648 .. +2147483647 */ | ||
typedef unsigned long long uint64; /* 0 .. 18446744073709551615 */ | ||
typedef signed long long sint64; /* -9223372036854775808 .. 9223372036854775807 */ | ||
typedef float float32; | ||
typedef double float64; | ||
|
||
#endif /* STD_TYPE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/****************************************************************************** | ||
* | ||
* Module: Timer1 | ||
* File Name: Timer1.c | ||
* Description: source file for the Timer1 driver | ||
* Author: Ibrahim Mohamed | ||
* | ||
*******************************************************************************/ | ||
|
||
|
||
#include"timer1.h" | ||
#include<avr/io.h> | ||
#include<avr/interrupt.h> | ||
#include "common_macros.h" /* To use the macros like SET_BIT */ | ||
#include "std_types.h" | ||
|
||
|
||
/******************************************************************************* | ||
* Global Variables * | ||
*******************************************************************************/ | ||
|
||
/* variable to hold the address of the call back function */ | ||
static volatile void (*g_callBackPtr)(void) = NULL_PTR; | ||
|
||
/******************************************************************************* | ||
* Functions Definitions * | ||
*******************************************************************************/ | ||
|
||
|
||
/* Timer 1 Compare Mode Interrupt ISR */ | ||
ISR(TIMER1_COMPA_vect) | ||
{ | ||
/*Increment the ticks of the program*/ | ||
if(g_callBackPtr != NULL_PTR){ | ||
(*g_callBackPtr)(); | ||
} | ||
} | ||
|
||
|
||
/* Timer 1 Normal Mode Interrupt ISR */ | ||
ISR(TIMER1_OVF_vect) | ||
{ | ||
|
||
/*Increment the ticks of the program*/ | ||
(*g_callBackPtr)(); | ||
|
||
} | ||
|
||
|
||
/* Timer 1 Initialization Function */ | ||
void Timer1_init(const Timer1_ConfigType * Config_Ptr) | ||
{ | ||
/* initial value from the configuration pointer*/ | ||
TCNT1=Config_Ptr->initial_value; | ||
|
||
|
||
if(Config_Ptr->mode==COMPARE) | ||
{ | ||
/* if the mode is compare mode, then put the compare value to one | ||
* coming form the configuration pointer */ | ||
OCR1A=Config_Ptr->compare_value; | ||
} | ||
|
||
/* Module (Timer 1) Interrupt enable */ | ||
TIMSK |= (1<<OCIE1A); | ||
|
||
/* select mode */ | ||
TCCR1A = (1 << FOC1A) | ((TCCR1A & 0xFC) | (Config_Ptr->mode & 0x03)); | ||
|
||
/* WGM12: | ||
* NORMAL = 0 | ||
* COMPARE =1 | ||
* */ | ||
TCCR1B = ((TCCR1B & 0xF8) | (Config_Ptr->prescaler & 0x07)) | ((TCCR1B & 0xE7) | | ||
((Config_Ptr->mode & 0x0C)<<1)); | ||
} | ||
|
||
|
||
/* Timer 1 Disable Function */ | ||
void Timer1_deInit(void) | ||
{ | ||
/* disable the timer by turning off the clock */ | ||
TCCR1A=0; | ||
TCCR1B=0; | ||
TIMSK &= ~(1 << OCIE1A); | ||
} | ||
|
||
|
||
/* Function to set the Call Back function address for timer 1 */ | ||
void Timer1_setCallBack(void(*a_ptr)(void)) | ||
{ | ||
/* Save the address of the function in a variable */ | ||
g_callBackPtr = a_ptr; | ||
} | ||
|
Oops, something went wrong.