From 56d9bdd39ed36c36e9a61411b86c76d5228b2133 Mon Sep 17 00:00:00 2001 From: sicarius Date: Sun, 11 Feb 2007 18:32:03 +0000 Subject: Added lot's of code-files used during work --- source/qFix/qfix.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 source/qFix/qfix.h (limited to 'source/qFix/qfix.h') diff --git a/source/qFix/qfix.h b/source/qFix/qfix.h new file mode 100644 index 0000000..0a5d039 --- /dev/null +++ b/source/qFix/qfix.h @@ -0,0 +1,96 @@ +//------------------------------------------------------------------ +// 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 + -- cgit v1.2.3