Mercurial > public > hwos_code
diff src/adc_lightsensor.asm @ 475:237afdfb4918
2.12 release candidate...
buttons invertable via PC command (OSTC+ only)
author | heinrichsweikamp |
---|---|
date | Fri, 13 Jan 2017 13:08:17 +0100 |
parents | 2880aa1264f5 |
children | b455b31ce022 |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Wed Jan 04 15:04:42 2017 +0100 +++ b/src/adc_lightsensor.asm Fri Jan 13 13:08:17 2017 +0100 @@ -586,12 +586,22 @@ decf WREG,W ;-1 decf WREG,W ;-1 -> 2-22 banksel analog_sw2 + btfss button_polarity,1;(1= normal, 0=inverted) + bra sw2_inverted addwf analog_sw2,W ; average (~128) - banksel common cpfsgt ADRESH bra get_analog_sw1 - bsf analog_sw2_pressed + banksel common + bsf analog_sw2_pressed ; Left button normal + bra get_analog_sw1 +sw2_inverted: + subwf analog_sw2,W ; average (~128) + cpfslt ADRESH + bra get_analog_sw1 + banksel common + bsf analog_sw2_pressed ; Left button inverted get_analog_sw1: + banksel common movlw b'00101001' ; power on ADC, select AN10 rcall wait_adc banksel analog_counter @@ -631,12 +641,22 @@ decf WREG,W ;-1 decf WREG,W ;-1 -> 2-22 banksel analog_sw1 + btfss button_polarity,0;(1= normal, 0=inverted) + bra sw1_inverted addwf analog_sw1,W ; average (~128) - banksel common cpfsgt ADRESH bra get_analog_sw_done - bsf analog_sw1_pressed + banksel common + bsf analog_sw1_pressed ; right button normal + bra get_analog_sw_done +sw1_inverted: + subwf analog_sw1,W ; average (~128) + cpfslt ADRESH + bra get_analog_sw_done + banksel common + bsf analog_sw1_pressed ; right button inverted get_analog_sw_done: + banksel common movlw b'10001101' ; Restore to right justified movwf ADCON2 btfsc analog_sw1_pressed