Compare commits
2 Commits
7a288faddb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c530411395 | ||
|
|
545e7f380d |
270
io-helper.c
270
io-helper.c
File diff suppressed because it is too large
Load Diff
27
io-helper.h
27
io-helper.h
@@ -3,22 +3,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define LEVEL 0
|
extern volatile uint8_t outStates[4];
|
||||||
#define EDGE 1
|
extern volatile uint8_t inStates[4];
|
||||||
#define RISING 2
|
extern volatile uint8_t ioHelperDebounceTable[32];
|
||||||
#define FALLING 3
|
extern volatile uint8_t oldInstates[4];
|
||||||
|
extern volatile uint8_t inStatesBothEdges[4];
|
||||||
#define OFF 0
|
extern volatile uint8_t inStatesRisingEdge[4];
|
||||||
#define ON 1
|
extern volatile uint8_t inStatesFallingEdge[4];
|
||||||
#define BLINK 2
|
|
||||||
#define TOGGLE 3
|
|
||||||
|
|
||||||
#define nrOfOutputs 32 //must be multiple of 8
|
|
||||||
#define nrOfInputs 32 //must be multiple of 8
|
|
||||||
|
|
||||||
extern volatile uint8_t outStates[nrOfOutputs/8];
|
|
||||||
extern volatile uint8_t inStates[nrOfInputs/8];
|
|
||||||
extern volatile uint8_t ioHelperDebounceTable[nrOfInputs];
|
|
||||||
|
|
||||||
void ioHelperSetOuts(void);
|
void ioHelperSetOuts(void);
|
||||||
void ioHelperReadPins(void);
|
void ioHelperReadPins(void);
|
||||||
@@ -27,10 +18,6 @@ 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 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,7 +1,6 @@
|
|||||||
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)
|
||||||
@@ -28,14 +27,13 @@ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
|||||||
|(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)
|
||||||
@@ -62,9 +60,7 @@ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
|||||||
|(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)
|
||||||
@@ -91,7 +87,6 @@ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
|||||||
|(getBit0(BitPA7)<<7)
|
|(getBit0(BitPA7)<<7)
|
||||||
#endif
|
#endif
|
||||||
|0);
|
|0);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user