//------------------------------------------------------------------ // qfix.h // // This file contains general includes and definitions for the // family of qfix boards. // // Copyright 2004-2006 by KTB mechatronics GmbH // Author: Stefan Enderle //------------------------------------------------------------------ #ifndef qfix_h #define qfix_h #include #include #include /* defines for compatibility */ #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif #ifndef BV #define BV _BV #endif /** Returns the absolute value of a */ inline int abs(int a) { if (a>=0) return a; else return -a; } /** Sleeps for sec seconds. (Note: this is tuned for * an Atmel ATmega32 running with 8 MHz.) */ inline void sleep(int sec) { for (int s=0; s=10000 || showZero) { str[i++]=(n/10000)+'0'; n=n % 10000; showZero=true; } if (n>=1000 || showZero) { str[i++]=(n/1000) +'0'; n=n % 1000; showZero=true; } if (n>=100 || showZero) { str[i++]=(n/100) +'0'; n=n % 100; showZero=true; } if (n>=10 || showZero) { str[i++]=(n/10) +'0'; n=n % 10; showZero=true; } str[i++]=n +'0'; // last digit str[i++]=0; // ending 0 } #endif