test.h

Go to the documentation of this file.
00001 #define F_CPU  11059200UL
00002 #include <avr/io.h>
00003 #include <avr/delay.h>
00004 #include <avr/interrupt.h>
00005 
00006 #include "Controller.h"
00007 
00008 #define TEST_MODE 1
00009 
00010 
00011 void msDelay (int n) {
00012 
00013      double maxDelay = (262.14 / (F_CPU / 1000000));
00014 
00015      for (int i=0; i< (n/maxDelay); i++) {
00016           _delay_ms (maxDelay);
00017      }
00018 }
00019 
00020 
00021 void powerOnLED(unsigned char _ledID, bool _status) {
00022 
00023      if (_status == true) {
00024           PORTA &= ~(1<<_ledID);
00025      } else {
00026           PORTA |= (1<<_ledID);
00027      }
00028 }
00029 
00030 void debugTestProgramm () { 
00031 
00032         Controller c;
00033      c.init();
00034 
00035      //c.blinkLED((1<<LED_WALK)|(1<<LED_LEARN)|(1<<LED_EXPLORATION), 100, 500);
00036 
00037      // Datenflussregister auf PortA
00038      DDRA = 0x0F;
00039      PORTA |= (1<<PA4) | (1<<PA5) | (1<<PA6) | (1<<PA7);
00040 
00041 
00042      while (1) {
00043 /*
00044           powerOnLED(0x00, 0);
00045           powerOnLED(0x01, 1);
00046           powerOnLED(0x02, 1);
00047           powerOnLED(0x03, 0);
00048           msDelay(500);
00049           powerOnLED(0x00, 1);
00050           powerOnLED(0x01, 0);
00051           powerOnLED(0x02, 0);
00052           powerOnLED(0x03, 1);
00053           msDelay(500);
00054 */
00055 
00056           c.powerOnLED(0x00, 0);
00057           c.powerOnLED(0x01, 1);
00058           c.powerOnLED(0x02, 1);
00059           c.powerOnLED(0x03, 0);
00060           c.msDelay(500);
00061           c.powerOnLED(0x00, 1);
00062           c.powerOnLED(0x01, 0);
00063           c.powerOnLED(0x02, 0);
00064           c.powerOnLED(0x03, 1);
00065           c.msDelay(500);
00066 
00067 
00068      }
00069 }
00070 

Generated on Wed Mar 25 12:58:40 2009 for Crawling Robot Microcontroller Software by  doxygen 1.5.5