upgrade to new iohelper version
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
#ifndef _IO_HELPER_
|
||||
#define _IO_HELPER_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#define LEVEL 0
|
||||
#define EDGE 1
|
||||
@@ -13,24 +13,20 @@
|
||||
#define BLINK 2
|
||||
#define TOGGLE 3
|
||||
|
||||
#define nrOfOutputs 32 //must be multiple of 8
|
||||
#define nrOfInputs 32 //must be multiple of 8
|
||||
|
||||
#define NUMBER_OF_INPUT_BYTES 4
|
||||
extern volatile uint8_t outStates[nrOfOutputs/8];
|
||||
extern volatile uint8_t inStates[nrOfInputs/8];
|
||||
extern volatile uint8_t ioHelperDebounceTable[nrOfInputs];
|
||||
|
||||
extern volatile uint8_t outStates[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t outStatesBlinking[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t inStates[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t inStatesRaw[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t ioHelperDebounceTable[NUMBER_OF_INPUT_BYTES*8];
|
||||
extern volatile uint8_t oldInstates[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t inStatesBothEdges[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t inStatesRisingEdge[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t inStatesFallingEdge[NUMBER_OF_INPUT_BYTES];
|
||||
extern volatile uint8_t outStatesBlinking[nrOfOutputs/8];
|
||||
|
||||
extern volatile uint8_t inStatesBothEdges[nrOfInputs/8];
|
||||
extern volatile uint8_t inStatesRisingEdge[nrOfInputs/8];
|
||||
extern volatile uint8_t inStatesFallingEdge[nrOfInputs/8];
|
||||
|
||||
|
||||
uint8_t read_Input(uint8_t nr, uint8_t type);
|
||||
void set_Output(uint8_t nr, uint8_t state);
|
||||
|
||||
void ioHelperInitBuffer(void);
|
||||
void ioHelperSetOuts(void);
|
||||
void ioHelperReadPins(void);
|
||||
void ioHelperIoConf(void);
|
||||
@@ -38,6 +34,10 @@ void ioHelperSetBit(volatile uint8_t *list, uint8_t nr, uint8_t state);
|
||||
unsigned char ioHelperReadBit(volatile uint8_t *list, uint8_t nr);
|
||||
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
|
||||
//Verknüpfen von Pin | Bit mit Bitposition (0...n) outStates[0...n/8].
|
||||
|
||||
@@ -1,92 +1,97 @@
|
||||
import string
|
||||
|
||||
ddr="""#ifdef DDRA
|
||||
DDRA|=0
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
DDRA|=0
|
||||
#ifdef BitPA0
|
||||
|(1<<0)
|
||||
#endif
|
||||
|(1<<0)
|
||||
#endif
|
||||
#ifdef BitPA1
|
||||
|(1<<1)
|
||||
#endif
|
||||
|(1<<1)
|
||||
#endif
|
||||
#ifdef BitPA2
|
||||
|(1<<2)
|
||||
#endif
|
||||
|(1<<2)
|
||||
#endif
|
||||
#ifdef BitPA3
|
||||
|(1<<3)
|
||||
#endif
|
||||
|(1<<3)
|
||||
#endif
|
||||
#ifdef BitPA4
|
||||
|(1<<4)
|
||||
#endif
|
||||
|(1<<4)
|
||||
#endif
|
||||
#ifdef BitPA5
|
||||
|(1<<5)
|
||||
#endif
|
||||
|(1<<5)
|
||||
#endif
|
||||
#ifdef BitPA6
|
||||
|(1<<6)
|
||||
#endif
|
||||
|(1<<6)
|
||||
#endif
|
||||
#ifdef BitPA7
|
||||
|(1<<7)
|
||||
#endif
|
||||
|0;
|
||||
|
||||
|(1<<7)
|
||||
#endif
|
||||
|0;
|
||||
}
|
||||
#endif
|
||||
|
||||
"""
|
||||
|
||||
port="""
|
||||
#ifdef PORTA
|
||||
PORTA|=0
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
PORTA|=0
|
||||
#ifdef BitPA0
|
||||
|(getBit1(BitPA0)<<0)
|
||||
|(getBit1(BitPA0)<<0)
|
||||
#endif
|
||||
#ifdef BitPA1
|
||||
|(getBit1(BitPA1)<<1)
|
||||
|(getBit1(BitPA1)<<1)
|
||||
#endif
|
||||
#ifdef BitPA2
|
||||
|(getBit1(BitPA2)<<2)
|
||||
|(getBit1(BitPA2)<<2)
|
||||
#endif
|
||||
#ifdef BitPA3
|
||||
|(getBit1(BitPA3)<<3)
|
||||
|(getBit1(BitPA3)<<3)
|
||||
#endif
|
||||
#ifdef BitPA4
|
||||
|(getBit1(BitPA4)<<4)
|
||||
|(getBit1(BitPA4)<<4)
|
||||
#endif
|
||||
#ifdef BitPA5
|
||||
|(getBit1(BitPA5)<<5)
|
||||
|(getBit1(BitPA5)<<5)
|
||||
#endif
|
||||
#ifdef BitPA6
|
||||
|(getBit1(BitPA6)<<6)
|
||||
|(getBit1(BitPA6)<<6)
|
||||
#endif
|
||||
#ifdef BitPA7
|
||||
|(getBit1(BitPA7)<<7)
|
||||
|(getBit1(BitPA7)<<7)
|
||||
#endif
|
||||
|0;
|
||||
|0;
|
||||
}
|
||||
|
||||
PORTA&=~(0
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
PORTA&=~(0
|
||||
#ifdef BitPA0
|
||||
|(getBit0(BitPA0)<<0)
|
||||
|(getBit0(BitPA0)<<0)
|
||||
#endif
|
||||
#ifdef BitPA1
|
||||
|(getBit0(BitPA1)<<1)
|
||||
|(getBit0(BitPA1)<<1)
|
||||
#endif
|
||||
#ifdef BitPA2
|
||||
|(getBit0(BitPA2)<<2)
|
||||
|(getBit0(BitPA2)<<2)
|
||||
#endif
|
||||
#ifdef BitPA3
|
||||
|(getBit0(BitPA3)<<3)
|
||||
|(getBit0(BitPA3)<<3)
|
||||
#endif
|
||||
#ifdef BitPA4
|
||||
|(getBit0(BitPA4)<<4)
|
||||
|(getBit0(BitPA4)<<4)
|
||||
#endif
|
||||
#ifdef BitPA5
|
||||
|(getBit0(BitPA5)<<5)
|
||||
|(getBit0(BitPA5)<<5)
|
||||
#endif
|
||||
#ifdef BitPA6
|
||||
|(getBit0(BitPA6)<<6)
|
||||
|(getBit0(BitPA6)<<6)
|
||||
#endif
|
||||
#ifdef BitPA7
|
||||
|(getBit0(BitPA7)<<7)
|
||||
|(getBit0(BitPA7)<<7)
|
||||
#endif
|
||||
|0);
|
||||
|0);
|
||||
}
|
||||
#endif
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user