Refactor the Makefile into pieces. This commit inspired by AncientGeek, my hatred...
[freeems-vanilla.git] / src / main / inc / utils.h
blob72be7e180506cd72da87e8b3519f32f0c379cd53
1 /* FreeEMS - the open source engine management system
3 * Copyright 2008-2012 Fred Cooke
5 * This file is part of the FreeEMS project.
7 * FreeEMS software is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * FreeEMS software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 * We ask that if you make any changes to this file you email them upstream to
21 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 * Thank you for choosing FreeEMS to run your engine!
27 /** @file
29 * @ingroup allHeaders
33 /* Header file multiple inclusion protection courtesy eclipse Header Template */
34 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
35 #ifndef FILE_UTILS_H_SEEN
36 #define FILE_UTILS_H_SEEN
39 #ifdef EXTERN
40 #warning "EXTERN already defined by another header, please sort it out!"
41 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */
42 #endif
45 #ifdef UTILS_C
46 #define EXTERN
47 #else
48 #define EXTERN extern
49 #endif
51 unsigned short safeAdd(unsigned short, unsigned short);
52 unsigned short safeTrim(unsigned short, signed short);
53 unsigned short safeScale(unsigned short, unsigned short, unsigned short);
55 void sleep(unsigned short) FPAGE_FE;
56 void sleepMicro(unsigned short) FPAGE_FE;
58 void adjustPWM(void) FPAGE_FE;
59 void setupPagedRAM(unsigned char) FPAGE_F8;
61 void sampleEachADC(ADCBuffer*) FPAGE_F8;
62 void sampleLoopADC(ADCBuffer*) FPAGE_F8;
63 //void sampleBlockADC(ADCBuffer*) FPAGE_F8; broken, do not use
65 unsigned char checksum(unsigned char *, unsigned short) FPAGE_F8;
66 unsigned short stringCopy(unsigned char*, unsigned char*) FPAGE_F8;
67 unsigned short compare(unsigned char*, unsigned char*, unsigned short); // In unpaged flash as it needs to compare paged flash with unpaged things
70 #undef EXTERN
73 #else
74 /* let us know if we are being untidy with headers */
75 #warning "Header file UTILS_H seen before, sort it out!"
76 /* end of the wrapper ifdef from the very top */
77 #endif