made those ATmega644P code snippets also work for ATmega644

This commit is contained in:
Christian Kroll 2012-02-12 20:47:55 +00:00
parent a3f7e211a0
commit 05bc860b25
6 changed files with 23 additions and 23 deletions

View File

@ -62,7 +62,7 @@ void timer0_off(){
COLPORT = 0; COLPORT = 0;
ROWPORT = 0; ROWPORT = 0;
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x00; TCCR0A = 0x00;
TCCR0B = 0x00; TCCR0B = 0x00;
TIMSK0 = 0; TIMSK0 = 0;
@ -86,7 +86,7 @@ static void timer0_on(){
*/ */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x02; // CTC Mode TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x03; // clk/64 TCCR0B = 0x03; // clk/64
TCNT0 = 0x00; // reset timer TCNT0 = 0x00; // reset timer

View File

@ -34,7 +34,7 @@
#define COLDDR2 DDR(COLPORT2) #define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT) #define ROWDDR DDR(ROWPORT)
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
/* more ifdef magic :-( */ /* more ifdef magic :-( */
#define OCR0 OCR0A #define OCR0 OCR0A
#define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A #define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A
@ -120,7 +120,7 @@ void timer0_off() {
COLPORT2 = 0; COLPORT2 = 0;
ROWPORT = 0; ROWPORT = 0;
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x00; TCCR0A = 0x00;
TCCR0B = 0x00; TCCR0B = 0x00;
#else #else
@ -141,7 +141,7 @@ static void timer0_on() {
1 0 1 clk/1024 1 0 1 clk/1024
*/ */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x02; // CTC Mode TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x03; // clk/64 TCCR0B = 0x03; // clk/64
TCNT0 = 0; // reset timer TCNT0 = 0; // reset timer

View File

@ -33,7 +33,7 @@
#define COLDDR2 DDR(COLPORT2) #define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT) #define ROWDDR DDR(ROWPORT)
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
/* more ifdef magic :-( */ /* more ifdef magic :-( */
#define OCR0 OCR0A #define OCR0 OCR0A
#define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A #define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A
@ -155,7 +155,7 @@ void timer0_off() {
COLPORT2 = 0; COLPORT2 = 0;
ROWPORT = 0; ROWPORT = 0;
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x00; TCCR0A = 0x00;
TCCR0B = 0x00; TCCR0B = 0x00;
#else #else
@ -177,7 +177,7 @@ static void timer0_on() {
1 0 1 clk/1024 1 0 1 clk/1024
*/ */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x02; // CTC Mode TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256 TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer TCNT0 = 0; // reset timer

View File

@ -33,7 +33,7 @@
} }
/* more ifdef magic :-( */ /* more ifdef magic :-( */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#define OCR0 OCR0A #define OCR0 OCR0A
#define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A #define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A
#endif #endif
@ -170,7 +170,7 @@ void timer0_off() {
TLCPORT = 0; TLCPORT = 0;
ROWPORT = 0; ROWPORT = 0;
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x00; TCCR0A = 0x00;
TCCR0B = 0x00; TCCR0B = 0x00;
#else #else
@ -196,7 +196,7 @@ static void timer0_on() {
* 1 0 1 clk/1024 * 1 0 1 clk/1024
*/ */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x02; // CTC Mode TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256 TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer TCNT0 = 0; // reset timer

View File

@ -33,7 +33,7 @@
#define COLDDR2 DDR(COLPORT2) #define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT) #define ROWDDR DDR(ROWPORT)
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
/* more ifdef magic :-( */ /* more ifdef magic :-( */
#define OCR0 OCR0A #define OCR0 OCR0A
#define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A #define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A
@ -62,7 +62,7 @@ void timer0_off() {
COLPORT2 = 0; COLPORT2 = 0;
ROWPORT = 0; ROWPORT = 0;
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x00; TCCR0A = 0x00;
TCCR0B = 0x00; TCCR0B = 0x00;
#else #else
@ -83,7 +83,7 @@ void timer0_on() {
1 0 0 clk/256 1 0 0 clk/256
1 0 1 clk/1024 1 0 1 clk/1024
*/ */
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
TCCR0A = 0x02; // CTC Mode TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256 TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer TCNT0 = 0; // reset timer

2
util.c
View File

@ -51,7 +51,7 @@ void wait(int ms){
} }
#endif #endif
#ifdef __AVR_ATmega644P__ #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
while(!(TIFR1&(1<<OCF1A))); //wait for compare match flag while(!(TIFR1&(1<<OCF1A))); //wait for compare match flag
TIFR1=(1<<OCF1A); //reset flag TIFR1=(1<<OCF1A); //reset flag
#else #else