.equ GODLIKE_F = 4
.equ INCREDIBLE_HACK = (1<<4) ; destroy all your hardware
.equ INCREDIBLE_HACK_F = 5
+; leds
+.equ LED_CARD = PB0
+.equ LED_CAM = PB1
+.equ LED_FWD_TO_CAM = PB2
+.equ LED_FWD_TO_CARD = PB3
+.equ LED_OVERFLOW = PB4
; but there is only stupid and cool mode right now %)
; enable pullups on int0, int1, clk, icp io ports
ldi tmp,((1<<PD2)|(1<<PD3)|(1<<PD5)|(1<<PD6))
+; pb 0-4 output high
+ldi tmp,((1<<PB0)|(1<<PB1)|(1<<PB2)|(1<<PB3)|(1<<PB4))
+out DDRB,tmp
+out PORTB,tmp
+
; init registers
ldi bitcount,0
ldi byte,0
cbi DDRD,DDD6
sbi PORTD,PD6
+; activate led
+sbi PORTB,LED_CAM
+cbi PORTB,LED_CARD
+
; toggle state
eor state,state_m
FWD_TO_CAM:
+; activate led
+sbi PORTB,LED_FWD_TO_CARD
+cbi PORTB,LED_FWD_TO_CAM
+
; disable external interrupt 1 while toggling edge
in tmp,GIMSK
cbr tmp,INT1
cbi DDRD,DDD3
sbi DDRD,PD3
+; activate led
+sbi PORTB,LED_CARD
+cbi PORTB,LED_CAM
+
; toggle state
eor state,state_m
FWD_TO_CARD:
+; activate led
+sbi PORTB,LED_FWD_TO_CAM
+cbi PORTB,LED_FWD_TO_CARD
+
; disable icp interrupt while toggling edge
in tmp,TIMSK
cbr tmp,TICIE
; increment counter overflow
add overflow_counter,one
+; toggle led status
+mov tmp,overflow_counter
+and tmp,one
+sbi PORTB,LED_OVERFLOW
+sbrs tmp,1
+cbi PORTB,LED_OVERFLOW
+
; return
reti