-
Notifications
You must be signed in to change notification settings - Fork 7
/
utils.h
59 lines (56 loc) · 2.39 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This software, known as CarbOnBal is
// Copyright, 2017 L.L.M. (Dennis) Meulensteen. [email protected]
//
// This file is part of CarbOnBal. A combination of software and hardware.
// I hope it may be of some help to you in balancing your carburetors and throttle bodies.
// Always be careful when working on a vehicle or electronic project like this.
// Your life and health are your sole responsibility, use wisely.
//
// CarbOnBal hardware is covered by the Cern Open Hardware License v1.2
// a copy of the text is incuded with the source code.
//
// CarbOnBal is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// CarbOnBal is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with CarbOnBal. If not, see <http://www.gnu.org/licenses/>.
#ifndef UTILS_H_INCLUDED
#define UTILS_H_INCLUDED
#include <Arduino.h>
#include "globals.h"
void setInterrupt(bool enabled);
void resetAverages();
float convertToPreferredUnits(int value, int ambient);
float differenceToPreferredUnits(int value);
float convertToMillibar(int value);
float differenceToMillibar(int value);
float convertToCmHg(int value);
float differenceToCmHg(int value);
float convertToInHg(int value);
float differenceToInHg(int value);
const char* unitsAsText();
void createWaitKeyPressChar();
void displayKeyPressPrompt();
settings_t fetchFactoryDefaultSettings();
int buttonPressed();
void waitForAnyKey();
void setInputActiveLow(int i);
void setOutputHigh(int i);
int intExponentialMovingAverage(int shift, int factor,int average, int input);
long longExponentialMovingAverage(int factor, long average, int input);
long mulExponentialMovingAverage( long average, int input);
unsigned long crawlingAverage(unsigned int factor, unsigned long average, unsigned int input);
float floatExponentialMovingAverage(float weight, float average, int input);
int delta(int first, int second);
unsigned int maxVal( unsigned int value[]);
unsigned int minVal( unsigned int value[]);
int freeMemory();
unsigned long getBaud(int index);
#endif