diff options
-rw-r--r-- | tuer-rfid/Makefile | 2 | ||||
-rw-r--r-- | tuer-rfid/manual.c | 8 | ||||
-rw-r--r-- | tuer-rfid/sl018.c | 4 | ||||
-rw-r--r-- | tuer-rfid/stepper.c | 11 |
4 files changed, 13 insertions, 12 deletions
diff --git a/tuer-rfid/Makefile b/tuer-rfid/Makefile index 697806b..5f7f893 100644 --- a/tuer-rfid/Makefile +++ b/tuer-rfid/Makefile @@ -22,7 +22,7 @@ ## NAME := tuer-rfid -BOARD_TYPE := teensy2 +BOARD_TYPE := teenstep OBJ := $(NAME).o heartbeat.o stepper.o ledmatrix.o sl018.o keystore.o statemachine.o eventqueue.o limits.o manual.o ajar.o LIBS := util led lufa-descriptor-usbserial anyio EXTERNAL_LIBS := lufa diff --git a/tuer-rfid/manual.c b/tuer-rfid/manual.c index 1423939..5ea6dd6 100644 --- a/tuer-rfid/manual.c +++ b/tuer-rfid/manual.c @@ -25,10 +25,10 @@ #include "manual.h" #include "eventqueue.h" -#define MANUAL_PIN PINF -#define MANUAL_PORT PORTF -#define MANUAL_DDR DDRF -#define MANUAL_BIT 0 +#define MANUAL_PIN PIND +#define MANUAL_PORT PORTD +#define MANUAL_DDR DDRD +#define MANUAL_BIT 7 #define MANUAL_LP_MAX 255 diff --git a/tuer-rfid/sl018.c b/tuer-rfid/sl018.c index a94e704..99382a9 100644 --- a/tuer-rfid/sl018.c +++ b/tuer-rfid/sl018.c @@ -27,8 +27,8 @@ #include <util/delay.h> #define SL018_TWI_ADDR 0xA0 -#define SL018_TAG_STA_PIN PIND -#define SL018_TAG_STA_BIT 7 +#define SL018_TAG_STA_PIN PINE +#define SL018_TAG_STA_BIT 6 #define CARD_PRESENT (!((SL018_TAG_STA_PIN >> SL018_TAG_STA_BIT) & 1)) #define MAX_UID_LEN 7 diff --git a/tuer-rfid/stepper.c b/tuer-rfid/stepper.c index 52e902c..e90700c 100644 --- a/tuer-rfid/stepper.c +++ b/tuer-rfid/stepper.c @@ -39,7 +39,8 @@ uint8_t step_table [] = #define STEPPER_PORT PORTF #define STEPPER_DDR DDRF #define STEPPER_FIRST_BIT 4 -#define STEPPER_ENABLE_BIT 1 +#define STEPPER_ENABLE_A_BIT 0 +#define STEPPER_ENABLE_B_BIT 1 #define LENGTH_STEP_TABLE (sizeof(step_table)/sizeof(uint8_t)) #define STEPPER_OUTPUT_BITMASK (~(0xF << STEPPER_FIRST_BIT )) @@ -50,7 +51,7 @@ stepper_direction_t step_direction = dir_open; inline void stepper_stop(void) { - STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_BIT); + STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_A_BIT | 1<<STEPPER_ENABLE_B_BIT); TCCR1B = 0; // no clock source TIMSK1 = 0; // disable timer interrupt } @@ -91,15 +92,15 @@ static inline uint8_t stepper_handle(void) void stepper_init(void) { - STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_BIT); - STEPPER_DDR |= (0xF << STEPPER_FIRST_BIT) | (1<<STEPPER_ENABLE_BIT); + STEPPER_PORT &= ~(0xF << STEPPER_FIRST_BIT | 1<<STEPPER_ENABLE_A_BIT | 1<<STEPPER_ENABLE_B_BIT); + STEPPER_DDR |= (0xF << STEPPER_FIRST_BIT) | (1<<STEPPER_ENABLE_A_BIT) | (1<<STEPPER_ENABLE_B_BIT); } uint8_t stepper_start(stepper_direction_t direction) { step_cnt = 0; step_direction = direction; - STEPPER_PORT |= 1<<STEPPER_ENABLE_BIT; + STEPPER_PORT |= (1<<STEPPER_ENABLE_A_BIT) | (1<<STEPPER_ENABLE_B_BIT); TCCR1A = 0; // prescaler 1:256, WGM = 4 (CTC) TCCR1B = 1<<WGM12 | 1<<CS12; // OCR1A = 124; // (1+124)*256 = 32000 -> 2 ms @ 16 MHz |