Compare commits
5 Commits
e2f55b4284
...
7a288faddb
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a288faddb | |||
| 962ef3878d | |||
| a39486c0fc | |||
| e355efd233 | |||
| 2ea6ec2e03 |
254
io-helper.c
254
io-helper.c
@@ -1,11 +1,78 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
#include "io-helper.h"
|
#include "io-helper.h"
|
||||||
|
|
||||||
volatile uint8_t outStates[nrOfOutputs/8];
|
volatile uint8_t outStates[nrOfOutputs/8];
|
||||||
volatile uint8_t inStatesRaw[nrOfInputs/8];
|
volatile uint8_t inStatesRaw[nrOfInputs/8];
|
||||||
volatile uint8_t inStates[nrOfInputs/8];
|
volatile uint8_t inStates[nrOfInputs/8];
|
||||||
volatile uint8_t oldInstates[nrOfInputs/8];
|
|
||||||
|
|
||||||
|
volatile uint8_t outStatesBlinking[nrOfOutputs/8];
|
||||||
|
|
||||||
|
volatile uint8_t oldInstates[nrOfInputs/8];
|
||||||
|
volatile uint8_t inStatesBothEdges[nrOfInputs/8];
|
||||||
|
volatile uint8_t inStatesRisingEdge[nrOfInputs/8];
|
||||||
|
volatile uint8_t inStatesFallingEdge[nrOfInputs/8];
|
||||||
|
|
||||||
|
uint8_t read_Input(uint8_t nr, uint8_t type) {
|
||||||
|
uint8_t state = 0;
|
||||||
|
switch (type) {
|
||||||
|
case LEVEL:
|
||||||
|
state = ioHelperReadBit(inStates, nr);
|
||||||
|
break;
|
||||||
|
case EDGE:
|
||||||
|
state = ioHelperReadBit(inStatesBothEdges, nr);
|
||||||
|
ioHelperSetBit(inStatesBothEdges, nr, 0);
|
||||||
|
break;
|
||||||
|
case RISING:
|
||||||
|
state = ioHelperReadBit(inStatesRisingEdge, nr);
|
||||||
|
ioHelperSetBit(inStatesRisingEdge, nr, 0);
|
||||||
|
break;
|
||||||
|
case FALLING:
|
||||||
|
state = ioHelperReadBit(inStatesFallingEdge, nr);
|
||||||
|
ioHelperSetBit(inStatesFallingEdge, nr, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_Output(uint8_t nr, uint8_t state) {
|
||||||
|
switch (state) {
|
||||||
|
case BLINK:
|
||||||
|
ioHelperSetBit(outStatesBlinking, nr, ON);
|
||||||
|
break;
|
||||||
|
case TOGGLE:
|
||||||
|
ioHelperSetBit(outStatesBlinking, nr, OFF);
|
||||||
|
if (ioHelperReadBit(outStates, nr)) {
|
||||||
|
ioHelperSetBit(outStates, nr, OFF);
|
||||||
|
} else {
|
||||||
|
ioHelperSetBit(outStates, nr, ON);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ON:
|
||||||
|
ioHelperSetBit(outStates, nr, ON);
|
||||||
|
ioHelperSetBit(outStatesBlinking, nr, OFF);
|
||||||
|
break;
|
||||||
|
case OFF:
|
||||||
|
ioHelperSetBit(outStates, nr, OFF);
|
||||||
|
ioHelperSetBit(outStatesBlinking, nr, OFF);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ioHelperEdgeDetector(void){
|
||||||
|
for (uint8_t i = 0; i < nrOfInputs/8; i++){
|
||||||
|
inStatesBothEdges[i] = oldInstates[i] ^ inStates[i];
|
||||||
|
inStatesRisingEdge[i] = inStatesBothEdges[i] & inStates[i];
|
||||||
|
inStatesFallingEdge[i] = inStatesBothEdges[i] & oldInstates[i];
|
||||||
|
oldInstates[i] = inStates[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ioHelperBlinkOuts(){
|
||||||
|
for(uint8_t i=0; i<nrOfOutputs/8; i++)
|
||||||
|
outStates[i] ^= outStatesBlinking[i];
|
||||||
|
}
|
||||||
|
|
||||||
/* @brief: copies a single bit from one char to another char (or arrays thereof)
|
/* @brief: copies a single bit from one char to another char (or arrays thereof)
|
||||||
*
|
*
|
||||||
@@ -81,6 +148,7 @@ void ioHelperIoConf(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DDRA
|
#ifdef DDRA
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRA|=0
|
DDRA|=0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -107,11 +175,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRB
|
#ifdef DDRB
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRB|=0
|
DDRB|=0
|
||||||
#ifdef BitPB0
|
#ifdef BitPB0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -138,11 +207,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRC
|
#ifdef DDRC
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRC|=0
|
DDRC|=0
|
||||||
#ifdef BitPC0
|
#ifdef BitPC0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -169,11 +239,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRD
|
#ifdef DDRD
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRD|=0
|
DDRD|=0
|
||||||
#ifdef BitPD0
|
#ifdef BitPD0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -200,11 +271,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRE
|
#ifdef DDRE
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRE|=0
|
DDRE|=0
|
||||||
#ifdef BitPE0
|
#ifdef BitPE0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -231,11 +303,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRF
|
#ifdef DDRF
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRF|=0
|
DDRF|=0
|
||||||
#ifdef BitPF0
|
#ifdef BitPF0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -262,11 +335,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRG
|
#ifdef DDRG
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRG|=0
|
DDRG|=0
|
||||||
#ifdef BitPG0
|
#ifdef BitPG0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -293,11 +367,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRH
|
#ifdef DDRH
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRH|=0
|
DDRH|=0
|
||||||
#ifdef BitPH0
|
#ifdef BitPH0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -324,11 +399,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRI
|
#ifdef DDRI
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRI|=0
|
DDRI|=0
|
||||||
#ifdef BitPI0
|
#ifdef BitPI0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -355,11 +431,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRJ
|
#ifdef DDRJ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRJ|=0
|
DDRJ|=0
|
||||||
#ifdef BitPJ0
|
#ifdef BitPJ0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -386,11 +463,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRK
|
#ifdef DDRK
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRK|=0
|
DDRK|=0
|
||||||
#ifdef BitPK0
|
#ifdef BitPK0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -417,11 +495,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRL
|
#ifdef DDRL
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRL|=0
|
DDRL|=0
|
||||||
#ifdef BitPL0
|
#ifdef BitPL0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -448,11 +527,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRM
|
#ifdef DDRM
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRM|=0
|
DDRM|=0
|
||||||
#ifdef BitPM0
|
#ifdef BitPM0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -479,11 +559,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRN
|
#ifdef DDRN
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRN|=0
|
DDRN|=0
|
||||||
#ifdef BitPN0
|
#ifdef BitPN0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -510,11 +591,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRO
|
#ifdef DDRO
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRO|=0
|
DDRO|=0
|
||||||
#ifdef BitPO0
|
#ifdef BitPO0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -541,11 +623,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRP
|
#ifdef DDRP
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRP|=0
|
DDRP|=0
|
||||||
#ifdef BitPP0
|
#ifdef BitPP0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -572,11 +655,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRQ
|
#ifdef DDRQ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRQ|=0
|
DDRQ|=0
|
||||||
#ifdef BitPQ0
|
#ifdef BitPQ0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -603,11 +687,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRR
|
#ifdef DDRR
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRR|=0
|
DDRR|=0
|
||||||
#ifdef BitPR0
|
#ifdef BitPR0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -634,11 +719,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRS
|
#ifdef DDRS
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRS|=0
|
DDRS|=0
|
||||||
#ifdef BitPS0
|
#ifdef BitPS0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -665,11 +751,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRT
|
#ifdef DDRT
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRT|=0
|
DDRT|=0
|
||||||
#ifdef BitPT0
|
#ifdef BitPT0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -696,11 +783,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRU
|
#ifdef DDRU
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRU|=0
|
DDRU|=0
|
||||||
#ifdef BitPU0
|
#ifdef BitPU0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -727,11 +815,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRV
|
#ifdef DDRV
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRV|=0
|
DDRV|=0
|
||||||
#ifdef BitPV0
|
#ifdef BitPV0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -758,11 +847,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRW
|
#ifdef DDRW
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRW|=0
|
DDRW|=0
|
||||||
#ifdef BitPW0
|
#ifdef BitPW0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -789,11 +879,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRX
|
#ifdef DDRX
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRX|=0
|
DDRX|=0
|
||||||
#ifdef BitPX0
|
#ifdef BitPX0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -820,11 +911,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRY
|
#ifdef DDRY
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRY|=0
|
DDRY|=0
|
||||||
#ifdef BitPY0
|
#ifdef BitPY0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -851,11 +943,12 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDRZ
|
#ifdef DDRZ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRZ|=0
|
DDRZ|=0
|
||||||
#ifdef BitPZ0
|
#ifdef BitPZ0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -882,15 +975,14 @@ void ioHelperIoConf(void) {
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ioHelperSetOuts(void) {
|
void ioHelperSetOuts(void) {
|
||||||
#ifdef PORTA
|
#ifdef PORTA
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTA|=0
|
PORTA|=0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(getBit1(BitPA0)<<0)
|
|(getBit1(BitPA0)<<0)
|
||||||
@@ -917,7 +1009,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPA7)<<7)
|
|(getBit1(BitPA7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTA&=~(0
|
PORTA&=~(0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(getBit0(BitPA0)<<0)
|
|(getBit0(BitPA0)<<0)
|
||||||
@@ -944,11 +1038,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPA7)<<7)
|
|(getBit0(BitPA7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTB
|
#ifdef PORTB
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTB|=0
|
PORTB|=0
|
||||||
#ifdef BitPB0
|
#ifdef BitPB0
|
||||||
|(getBit1(BitPB0)<<0)
|
|(getBit1(BitPB0)<<0)
|
||||||
@@ -975,7 +1071,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPB7)<<7)
|
|(getBit1(BitPB7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTB&=~(0
|
PORTB&=~(0
|
||||||
#ifdef BitPB0
|
#ifdef BitPB0
|
||||||
|(getBit0(BitPB0)<<0)
|
|(getBit0(BitPB0)<<0)
|
||||||
@@ -1002,11 +1100,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPB7)<<7)
|
|(getBit0(BitPB7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTC
|
#ifdef PORTC
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTC|=0
|
PORTC|=0
|
||||||
#ifdef BitPC0
|
#ifdef BitPC0
|
||||||
|(getBit1(BitPC0)<<0)
|
|(getBit1(BitPC0)<<0)
|
||||||
@@ -1033,7 +1133,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPC7)<<7)
|
|(getBit1(BitPC7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTC&=~(0
|
PORTC&=~(0
|
||||||
#ifdef BitPC0
|
#ifdef BitPC0
|
||||||
|(getBit0(BitPC0)<<0)
|
|(getBit0(BitPC0)<<0)
|
||||||
@@ -1060,11 +1162,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPC7)<<7)
|
|(getBit0(BitPC7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTD
|
#ifdef PORTD
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTD|=0
|
PORTD|=0
|
||||||
#ifdef BitPD0
|
#ifdef BitPD0
|
||||||
|(getBit1(BitPD0)<<0)
|
|(getBit1(BitPD0)<<0)
|
||||||
@@ -1091,7 +1195,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPD7)<<7)
|
|(getBit1(BitPD7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTD&=~(0
|
PORTD&=~(0
|
||||||
#ifdef BitPD0
|
#ifdef BitPD0
|
||||||
|(getBit0(BitPD0)<<0)
|
|(getBit0(BitPD0)<<0)
|
||||||
@@ -1118,11 +1224,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPD7)<<7)
|
|(getBit0(BitPD7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTE
|
#ifdef PORTE
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTE|=0
|
PORTE|=0
|
||||||
#ifdef BitPE0
|
#ifdef BitPE0
|
||||||
|(getBit1(BitPE0)<<0)
|
|(getBit1(BitPE0)<<0)
|
||||||
@@ -1149,7 +1257,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPE7)<<7)
|
|(getBit1(BitPE7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTE&=~(0
|
PORTE&=~(0
|
||||||
#ifdef BitPE0
|
#ifdef BitPE0
|
||||||
|(getBit0(BitPE0)<<0)
|
|(getBit0(BitPE0)<<0)
|
||||||
@@ -1176,11 +1286,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPE7)<<7)
|
|(getBit0(BitPE7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTF
|
#ifdef PORTF
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTF|=0
|
PORTF|=0
|
||||||
#ifdef BitPF0
|
#ifdef BitPF0
|
||||||
|(getBit1(BitPF0)<<0)
|
|(getBit1(BitPF0)<<0)
|
||||||
@@ -1207,7 +1319,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPF7)<<7)
|
|(getBit1(BitPF7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTF&=~(0
|
PORTF&=~(0
|
||||||
#ifdef BitPF0
|
#ifdef BitPF0
|
||||||
|(getBit0(BitPF0)<<0)
|
|(getBit0(BitPF0)<<0)
|
||||||
@@ -1234,11 +1348,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPF7)<<7)
|
|(getBit0(BitPF7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTG
|
#ifdef PORTG
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTG|=0
|
PORTG|=0
|
||||||
#ifdef BitPG0
|
#ifdef BitPG0
|
||||||
|(getBit1(BitPG0)<<0)
|
|(getBit1(BitPG0)<<0)
|
||||||
@@ -1265,7 +1381,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPG7)<<7)
|
|(getBit1(BitPG7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTG&=~(0
|
PORTG&=~(0
|
||||||
#ifdef BitPG0
|
#ifdef BitPG0
|
||||||
|(getBit0(BitPG0)<<0)
|
|(getBit0(BitPG0)<<0)
|
||||||
@@ -1292,11 +1410,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPG7)<<7)
|
|(getBit0(BitPG7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTH
|
#ifdef PORTH
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTH|=0
|
PORTH|=0
|
||||||
#ifdef BitPH0
|
#ifdef BitPH0
|
||||||
|(getBit1(BitPH0)<<0)
|
|(getBit1(BitPH0)<<0)
|
||||||
@@ -1323,7 +1443,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPH7)<<7)
|
|(getBit1(BitPH7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTH&=~(0
|
PORTH&=~(0
|
||||||
#ifdef BitPH0
|
#ifdef BitPH0
|
||||||
|(getBit0(BitPH0)<<0)
|
|(getBit0(BitPH0)<<0)
|
||||||
@@ -1350,11 +1472,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPH7)<<7)
|
|(getBit0(BitPH7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTI
|
#ifdef PORTI
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTI|=0
|
PORTI|=0
|
||||||
#ifdef BitPI0
|
#ifdef BitPI0
|
||||||
|(getBit1(BitPI0)<<0)
|
|(getBit1(BitPI0)<<0)
|
||||||
@@ -1381,7 +1505,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPI7)<<7)
|
|(getBit1(BitPI7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTI&=~(0
|
PORTI&=~(0
|
||||||
#ifdef BitPI0
|
#ifdef BitPI0
|
||||||
|(getBit0(BitPI0)<<0)
|
|(getBit0(BitPI0)<<0)
|
||||||
@@ -1408,11 +1534,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPI7)<<7)
|
|(getBit0(BitPI7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTJ
|
#ifdef PORTJ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTJ|=0
|
PORTJ|=0
|
||||||
#ifdef BitPJ0
|
#ifdef BitPJ0
|
||||||
|(getBit1(BitPJ0)<<0)
|
|(getBit1(BitPJ0)<<0)
|
||||||
@@ -1439,7 +1567,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPJ7)<<7)
|
|(getBit1(BitPJ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTJ&=~(0
|
PORTJ&=~(0
|
||||||
#ifdef BitPJ0
|
#ifdef BitPJ0
|
||||||
|(getBit0(BitPJ0)<<0)
|
|(getBit0(BitPJ0)<<0)
|
||||||
@@ -1466,11 +1596,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPJ7)<<7)
|
|(getBit0(BitPJ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTK
|
#ifdef PORTK
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTK|=0
|
PORTK|=0
|
||||||
#ifdef BitPK0
|
#ifdef BitPK0
|
||||||
|(getBit1(BitPK0)<<0)
|
|(getBit1(BitPK0)<<0)
|
||||||
@@ -1497,7 +1629,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPK7)<<7)
|
|(getBit1(BitPK7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTK&=~(0
|
PORTK&=~(0
|
||||||
#ifdef BitPK0
|
#ifdef BitPK0
|
||||||
|(getBit0(BitPK0)<<0)
|
|(getBit0(BitPK0)<<0)
|
||||||
@@ -1524,11 +1658,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPK7)<<7)
|
|(getBit0(BitPK7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTL
|
#ifdef PORTL
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTL|=0
|
PORTL|=0
|
||||||
#ifdef BitPL0
|
#ifdef BitPL0
|
||||||
|(getBit1(BitPL0)<<0)
|
|(getBit1(BitPL0)<<0)
|
||||||
@@ -1555,7 +1691,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPL7)<<7)
|
|(getBit1(BitPL7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTL&=~(0
|
PORTL&=~(0
|
||||||
#ifdef BitPL0
|
#ifdef BitPL0
|
||||||
|(getBit0(BitPL0)<<0)
|
|(getBit0(BitPL0)<<0)
|
||||||
@@ -1582,11 +1720,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPL7)<<7)
|
|(getBit0(BitPL7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTM
|
#ifdef PORTM
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTM|=0
|
PORTM|=0
|
||||||
#ifdef BitPM0
|
#ifdef BitPM0
|
||||||
|(getBit1(BitPM0)<<0)
|
|(getBit1(BitPM0)<<0)
|
||||||
@@ -1613,7 +1753,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPM7)<<7)
|
|(getBit1(BitPM7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTM&=~(0
|
PORTM&=~(0
|
||||||
#ifdef BitPM0
|
#ifdef BitPM0
|
||||||
|(getBit0(BitPM0)<<0)
|
|(getBit0(BitPM0)<<0)
|
||||||
@@ -1640,11 +1782,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPM7)<<7)
|
|(getBit0(BitPM7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTN
|
#ifdef PORTN
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTN|=0
|
PORTN|=0
|
||||||
#ifdef BitPN0
|
#ifdef BitPN0
|
||||||
|(getBit1(BitPN0)<<0)
|
|(getBit1(BitPN0)<<0)
|
||||||
@@ -1671,7 +1815,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPN7)<<7)
|
|(getBit1(BitPN7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTN&=~(0
|
PORTN&=~(0
|
||||||
#ifdef BitPN0
|
#ifdef BitPN0
|
||||||
|(getBit0(BitPN0)<<0)
|
|(getBit0(BitPN0)<<0)
|
||||||
@@ -1698,11 +1844,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPN7)<<7)
|
|(getBit0(BitPN7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTO
|
#ifdef PORTO
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTO|=0
|
PORTO|=0
|
||||||
#ifdef BitPO0
|
#ifdef BitPO0
|
||||||
|(getBit1(BitPO0)<<0)
|
|(getBit1(BitPO0)<<0)
|
||||||
@@ -1729,7 +1877,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPO7)<<7)
|
|(getBit1(BitPO7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTO&=~(0
|
PORTO&=~(0
|
||||||
#ifdef BitPO0
|
#ifdef BitPO0
|
||||||
|(getBit0(BitPO0)<<0)
|
|(getBit0(BitPO0)<<0)
|
||||||
@@ -1756,11 +1906,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPO7)<<7)
|
|(getBit0(BitPO7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTP
|
#ifdef PORTP
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTP|=0
|
PORTP|=0
|
||||||
#ifdef BitPP0
|
#ifdef BitPP0
|
||||||
|(getBit1(BitPP0)<<0)
|
|(getBit1(BitPP0)<<0)
|
||||||
@@ -1787,7 +1939,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPP7)<<7)
|
|(getBit1(BitPP7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTP&=~(0
|
PORTP&=~(0
|
||||||
#ifdef BitPP0
|
#ifdef BitPP0
|
||||||
|(getBit0(BitPP0)<<0)
|
|(getBit0(BitPP0)<<0)
|
||||||
@@ -1814,11 +1968,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPP7)<<7)
|
|(getBit0(BitPP7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTQ
|
#ifdef PORTQ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTQ|=0
|
PORTQ|=0
|
||||||
#ifdef BitPQ0
|
#ifdef BitPQ0
|
||||||
|(getBit1(BitPQ0)<<0)
|
|(getBit1(BitPQ0)<<0)
|
||||||
@@ -1845,7 +2001,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPQ7)<<7)
|
|(getBit1(BitPQ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTQ&=~(0
|
PORTQ&=~(0
|
||||||
#ifdef BitPQ0
|
#ifdef BitPQ0
|
||||||
|(getBit0(BitPQ0)<<0)
|
|(getBit0(BitPQ0)<<0)
|
||||||
@@ -1872,11 +2030,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPQ7)<<7)
|
|(getBit0(BitPQ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTR
|
#ifdef PORTR
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTR|=0
|
PORTR|=0
|
||||||
#ifdef BitPR0
|
#ifdef BitPR0
|
||||||
|(getBit1(BitPR0)<<0)
|
|(getBit1(BitPR0)<<0)
|
||||||
@@ -1903,7 +2063,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPR7)<<7)
|
|(getBit1(BitPR7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTR&=~(0
|
PORTR&=~(0
|
||||||
#ifdef BitPR0
|
#ifdef BitPR0
|
||||||
|(getBit0(BitPR0)<<0)
|
|(getBit0(BitPR0)<<0)
|
||||||
@@ -1930,11 +2092,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPR7)<<7)
|
|(getBit0(BitPR7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTS
|
#ifdef PORTS
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTS|=0
|
PORTS|=0
|
||||||
#ifdef BitPS0
|
#ifdef BitPS0
|
||||||
|(getBit1(BitPS0)<<0)
|
|(getBit1(BitPS0)<<0)
|
||||||
@@ -1961,7 +2125,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPS7)<<7)
|
|(getBit1(BitPS7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTS&=~(0
|
PORTS&=~(0
|
||||||
#ifdef BitPS0
|
#ifdef BitPS0
|
||||||
|(getBit0(BitPS0)<<0)
|
|(getBit0(BitPS0)<<0)
|
||||||
@@ -1988,11 +2154,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPS7)<<7)
|
|(getBit0(BitPS7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTT
|
#ifdef PORTT
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTT|=0
|
PORTT|=0
|
||||||
#ifdef BitPT0
|
#ifdef BitPT0
|
||||||
|(getBit1(BitPT0)<<0)
|
|(getBit1(BitPT0)<<0)
|
||||||
@@ -2019,7 +2187,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPT7)<<7)
|
|(getBit1(BitPT7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTT&=~(0
|
PORTT&=~(0
|
||||||
#ifdef BitPT0
|
#ifdef BitPT0
|
||||||
|(getBit0(BitPT0)<<0)
|
|(getBit0(BitPT0)<<0)
|
||||||
@@ -2046,11 +2216,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPT7)<<7)
|
|(getBit0(BitPT7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTU
|
#ifdef PORTU
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTU|=0
|
PORTU|=0
|
||||||
#ifdef BitPU0
|
#ifdef BitPU0
|
||||||
|(getBit1(BitPU0)<<0)
|
|(getBit1(BitPU0)<<0)
|
||||||
@@ -2077,7 +2249,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPU7)<<7)
|
|(getBit1(BitPU7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTU&=~(0
|
PORTU&=~(0
|
||||||
#ifdef BitPU0
|
#ifdef BitPU0
|
||||||
|(getBit0(BitPU0)<<0)
|
|(getBit0(BitPU0)<<0)
|
||||||
@@ -2104,11 +2278,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPU7)<<7)
|
|(getBit0(BitPU7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTV
|
#ifdef PORTV
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTV|=0
|
PORTV|=0
|
||||||
#ifdef BitPV0
|
#ifdef BitPV0
|
||||||
|(getBit1(BitPV0)<<0)
|
|(getBit1(BitPV0)<<0)
|
||||||
@@ -2135,7 +2311,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPV7)<<7)
|
|(getBit1(BitPV7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTV&=~(0
|
PORTV&=~(0
|
||||||
#ifdef BitPV0
|
#ifdef BitPV0
|
||||||
|(getBit0(BitPV0)<<0)
|
|(getBit0(BitPV0)<<0)
|
||||||
@@ -2162,11 +2340,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPV7)<<7)
|
|(getBit0(BitPV7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTW
|
#ifdef PORTW
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTW|=0
|
PORTW|=0
|
||||||
#ifdef BitPW0
|
#ifdef BitPW0
|
||||||
|(getBit1(BitPW0)<<0)
|
|(getBit1(BitPW0)<<0)
|
||||||
@@ -2193,7 +2373,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPW7)<<7)
|
|(getBit1(BitPW7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTW&=~(0
|
PORTW&=~(0
|
||||||
#ifdef BitPW0
|
#ifdef BitPW0
|
||||||
|(getBit0(BitPW0)<<0)
|
|(getBit0(BitPW0)<<0)
|
||||||
@@ -2220,11 +2402,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPW7)<<7)
|
|(getBit0(BitPW7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTX
|
#ifdef PORTX
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTX|=0
|
PORTX|=0
|
||||||
#ifdef BitPX0
|
#ifdef BitPX0
|
||||||
|(getBit1(BitPX0)<<0)
|
|(getBit1(BitPX0)<<0)
|
||||||
@@ -2251,7 +2435,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPX7)<<7)
|
|(getBit1(BitPX7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTX&=~(0
|
PORTX&=~(0
|
||||||
#ifdef BitPX0
|
#ifdef BitPX0
|
||||||
|(getBit0(BitPX0)<<0)
|
|(getBit0(BitPX0)<<0)
|
||||||
@@ -2278,11 +2464,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPX7)<<7)
|
|(getBit0(BitPX7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTY
|
#ifdef PORTY
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTY|=0
|
PORTY|=0
|
||||||
#ifdef BitPY0
|
#ifdef BitPY0
|
||||||
|(getBit1(BitPY0)<<0)
|
|(getBit1(BitPY0)<<0)
|
||||||
@@ -2309,7 +2497,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPY7)<<7)
|
|(getBit1(BitPY7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTY&=~(0
|
PORTY&=~(0
|
||||||
#ifdef BitPY0
|
#ifdef BitPY0
|
||||||
|(getBit0(BitPY0)<<0)
|
|(getBit0(BitPY0)<<0)
|
||||||
@@ -2336,11 +2526,13 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPY7)<<7)
|
|(getBit0(BitPY7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PORTZ
|
#ifdef PORTZ
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTZ|=0
|
PORTZ|=0
|
||||||
#ifdef BitPZ0
|
#ifdef BitPZ0
|
||||||
|(getBit1(BitPZ0)<<0)
|
|(getBit1(BitPZ0)<<0)
|
||||||
@@ -2367,7 +2559,9 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit1(BitPZ7)<<7)
|
|(getBit1(BitPZ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTZ&=~(0
|
PORTZ&=~(0
|
||||||
#ifdef BitPZ0
|
#ifdef BitPZ0
|
||||||
|(getBit0(BitPZ0)<<0)
|
|(getBit0(BitPZ0)<<0)
|
||||||
@@ -2394,10 +2588,10 @@ void ioHelperSetOuts(void) {
|
|||||||
|(getBit0(BitPZ7)<<7)
|
|(getBit0(BitPZ7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
17
io-helper.h
17
io-helper.h
@@ -1,7 +1,17 @@
|
|||||||
#ifndef _IO_HELPER_
|
#ifndef _IO_HELPER_
|
||||||
#define _IO_HELPER_
|
#define _IO_HELPER_
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define LEVEL 0
|
||||||
|
#define EDGE 1
|
||||||
|
#define RISING 2
|
||||||
|
#define FALLING 3
|
||||||
|
|
||||||
|
#define OFF 0
|
||||||
|
#define ON 1
|
||||||
|
#define BLINK 2
|
||||||
|
#define TOGGLE 3
|
||||||
|
|
||||||
#define nrOfOutputs 32 //must be multiple of 8
|
#define nrOfOutputs 32 //must be multiple of 8
|
||||||
#define nrOfInputs 32 //must be multiple of 8
|
#define nrOfInputs 32 //must be multiple of 8
|
||||||
@@ -9,13 +19,18 @@
|
|||||||
extern volatile uint8_t outStates[nrOfOutputs/8];
|
extern volatile uint8_t outStates[nrOfOutputs/8];
|
||||||
extern volatile uint8_t inStates[nrOfInputs/8];
|
extern volatile uint8_t inStates[nrOfInputs/8];
|
||||||
extern volatile uint8_t ioHelperDebounceTable[nrOfInputs];
|
extern volatile uint8_t ioHelperDebounceTable[nrOfInputs];
|
||||||
|
|
||||||
void ioHelperSetOuts(void);
|
void ioHelperSetOuts(void);
|
||||||
void ioHelperReadPins(void);
|
void ioHelperReadPins(void);
|
||||||
void ioHelperIoConf(void);
|
void ioHelperIoConf(void);
|
||||||
void ioHelperSetBit(volatile uint8_t *list, uint8_t nr, uint8_t state);
|
void ioHelperSetBit(volatile uint8_t *list, uint8_t nr, uint8_t state);
|
||||||
unsigned char ioHelperReadBit(volatile uint8_t *list, uint8_t nr);
|
unsigned char ioHelperReadBit(volatile uint8_t *list, uint8_t nr);
|
||||||
void ioHelperDebounce(void);
|
void ioHelperDebounce(void);
|
||||||
|
void ioHelperEdgeDetector(void);
|
||||||
|
void ioHelperBlinkOuts(void);
|
||||||
|
|
||||||
|
uint8_t read_Input(uint8_t nr, uint8_t type);
|
||||||
|
void set_Output(uint8_t nr, uint8_t state);
|
||||||
|
|
||||||
//Outputs
|
//Outputs
|
||||||
//Pin | Bit in outStates
|
//Pin | Bit in outStates
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
ddr="""#ifdef DDRA
|
ddr="""#ifdef DDRA
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
DDRA|=0
|
DDRA|=0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(1<<0)
|
|(1<<0)
|
||||||
@@ -27,13 +28,14 @@ DDRA|=0
|
|||||||
|(1<<7)
|
|(1<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
port="""
|
port="""
|
||||||
#ifdef PORTA
|
#ifdef PORTA
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTA|=0
|
PORTA|=0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(getBit1(BitPA0)<<0)
|
|(getBit1(BitPA0)<<0)
|
||||||
@@ -60,7 +62,9 @@ PORTA|=0
|
|||||||
|(getBit1(BitPA7)<<7)
|
|(getBit1(BitPA7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0;
|
|0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
PORTA&=~(0
|
PORTA&=~(0
|
||||||
#ifdef BitPA0
|
#ifdef BitPA0
|
||||||
|(getBit0(BitPA0)<<0)
|
|(getBit0(BitPA0)<<0)
|
||||||
@@ -87,6 +91,7 @@ PORTA&=~(0
|
|||||||
|(getBit0(BitPA7)<<7)
|
|(getBit0(BitPA7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user