Compare commits
9 Commits
master
...
7a288faddb
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a288faddb | |||
| 962ef3878d | |||
| a39486c0fc | |||
| e355efd233 | |||
| 2ea6ec2e03 | |||
| e2f55b4284 | |||
| e9dae2fdee | |||
|
|
f473da9c3f | ||
|
|
3828826957 |
275
io-helper.c
275
io-helper.c
File diff suppressed because it is too large
Load Diff
30
io-helper.h
30
io-helper.h
@@ -1,12 +1,36 @@
|
|||||||
extern volatile uint8_t outStates[4];
|
#ifndef _IO_HELPER_
|
||||||
extern volatile uint8_t inStates[4];
|
#define _IO_HELPER_
|
||||||
|
|
||||||
|
#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 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);
|
||||||
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
|
||||||
@@ -17,3 +41,5 @@ void ioHelperDebounce(void);
|
|||||||
//Pin | Bit in inStates
|
//Pin | Bit in inStates
|
||||||
#define BitPinC1 0
|
#define BitPinC1 0
|
||||||
#define BitPinC5 1
|
#define BitPinC5 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -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