Speeduino
Loading...
Searching...
No Matches
utilities.h
Go to the documentation of this file.
1/*
2These are some utility functions and variables used through the main code
3*/
4#ifndef UTILS_H
5#define UTILS_H
6
7#include <Arduino.h>
8
9#define CONCATS(s1, s2) (s1" " s2) //needed for some reason. not defined correctly because of utils.h file of speeduino (same name as one in arduino core)
10
11#define COMPARATOR_EQUAL 0
12#define COMPARATOR_NOT_EQUAL 1
13#define COMPARATOR_GREATER 2
14#define COMPARATOR_GREATER_EQUAL 3
15#define COMPARATOR_LESS 4
16#define COMPARATOR_LESS_EQUAL 5
17#define COMPARATOR_AND 6
18#define COMPARATOR_XOR 7
19
20#define BITWISE_DISABLED 0
21#define BITWISE_AND 1
22#define BITWISE_OR 2
23#define BITWISE_XOR 3
24
25#define REUSE_RULES 240
26
29extern uint8_t pinIsValid;
31//uint8_t outputPin[sizeof(configPage13.outputPin)];
32
34byte pinTranslate(byte rawPin);
35byte pinTranslateAnalog(byte rawPin);
37void checkProgrammableIO(void);
39
40#if !defined(UNUSED)
41#define UNUSED(x) (void)(x)
42#endif
43
44#define _countof(x) (sizeof(x) / sizeof (x[0]))
45#define _end_range_address(array) (array + _countof(array))
46#define _end_range_byte_address(array) (((byte*)array) + sizeof(array))
47
48// Pre-processor arithmetic increment (pulled from Boost.Preprocessor)
49#define PP_INC(x) PP_INC_I(x)
50#define PP_INC_I(x) PP_INC_ ## x
51
52#define PP_INC_0 1
53#define PP_INC_1 2
54#define PP_INC_2 3
55#define PP_INC_3 4
56#define PP_INC_4 5
57#define PP_INC_5 6
58#define PP_INC_6 7
59#define PP_INC_7 8
60#define PP_INC_8 9
61#define PP_INC_9 10
62#define PP_INC_10 11
63#define PP_INC_11 12
64#define PP_INC_12 13
65
66#endif // UTILS_H
struct config13 configPage13
Definition globals.cpp:242
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
uint8_t outputPin[8]
Disable(0) or enable (set to valid pin number) Programmable Pin (output/target pin to set)
Definition globals.h:1385
uint8_t ioDelay[sizeof(configPage13.outputPin)]
Definition utilities.cpp:20
byte pinTranslateAnalog(byte rawPin)
Definition utilities.cpp:42
int16_t ProgrammableIOGetData(uint16_t index)
Definition utilities.cpp:262
void checkProgrammableIO(void)
Definition utilities.cpp:155
uint8_t ioOutDelay[sizeof(configPage13.outputPin)]
Definition utilities.cpp:21
uint8_t pinIsValid
Definition utilities.cpp:22
void setResetControlPinState(void)
Definition utilities.cpp:94
byte pinTranslate(byte rawPin)
Definition utilities.cpp:32
uint8_t currentRuleStatus
Definition utilities.cpp:23
void initialiseProgrammableIO(void)
Definition utilities.cpp:124