Browse Source

made those ATmega644P code snippets also work for ATmega644

feature/2015
Christian Kroll 13 years ago
parent
commit
05bc860b25
  1. 4
      borg_hw/borg_hw_ancient.c
  2. 6
      borg_hw/borg_hw_andreborg.c
  3. 6
      borg_hw/borg_hw_borg16.c
  4. 6
      borg_hw/borg_hw_borg16_hgmod.c
  5. 6
      borg_hw/borg_hw_gigaborg.c
  6. 2
      util.c

4
borg_hw/borg_hw_ancient.c

@ -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

6
borg_hw/borg_hw_andreborg.c

@ -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

6
borg_hw/borg_hw_borg16.c

@ -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
@ -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

6
borg_hw/borg_hw_borg16_hgmod.c

@ -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

6
borg_hw/borg_hw_gigaborg.c

@ -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

2
util.c

@ -51,7 +51,7 @@ void wait(int ms){
}
#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

Loading…
Cancel
Save