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

View File

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

View File

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

View File

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

View File

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

16
util.c
View File

@ -26,15 +26,15 @@ void wait(int ms){
1 0 0 clk/64
1 0 1 clk/128
1 1 0 clk/256
1 1 1 clk/1024
1 1 1 clk/1024
*/
//TCCR2 = 0x0D; //CTC Mode, clk/128
//OCR2 = (F_CPU/128000); //1000Hz
//OCR2 = (F_CPU/128000); //1000Hz
TCCR1B = (1<<WGM12) | 4;//CTC Mode, clk/256
OCR1A = (F_CPU/256000); //1000Hz
OCR1A = (F_CPU/256000); //1000Hz
for(;ms>0;ms--){
#ifdef CAN_SUPPORT
@ -44,14 +44,14 @@ void wait(int ms){
#ifdef JOYSTICK_SUPPORT
if (waitForFire) {
//PORTJOYGND &= ~(1<<BITJOY0);
//PORTJOYGND &= ~(1<<BITJOY1);
//PORTJOYGND &= ~(1<<BITJOY1);
if (JOYISFIRE) {
longjmp(newmode_jmpbuf, 43);
}
}
#endif
#ifdef __AVR_ATmega644P__
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
while(!(TIFR1&(1<<OCF1A))); //wait for compare match flag
TIFR1=(1<<OCF1A); //reset flag
#else