Skip to content

Commit

Permalink
Merge pull request #3 from sim-/master
Browse files Browse the repository at this point in the history
Bring up to date with main
  • Loading branch information
ahalekelly committed Feb 7, 2017
2 parents d8da3ae + aa1a55a commit 1c78876
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ program_usbasp_%: %.hex
program_avrisp2_%: %.hex
avrdude -c avrisp2 -p m8 -U flash:w:$<:i

program_jtag3isp_%: %.hex
avrdude -c jtag3isp -p m8 -U flash:w:$<:i

program_dragon_%: %.hex
avrdude -c dragon_isp -p m8 -P usb -U flash:w:$<:i

Expand All @@ -65,6 +68,9 @@ read_usbasp:
read_avrisp2:
avrdude -c avrisp2 -p m8 -P usb -v -U flash:r:flash.hex:i -U eeprom:r:eeprom.hex:i

read_jtag3isp:
avrdude -c jtag3isp -p m8 -P usb -v -U flash:r:flash.hex:i -U eeprom:r:eeprom.hex:i

read_dragon:
avrdude -c dragon_isp -p m8 -P usb -v -U flash:r:flash.hex:i -U eeprom:r:eeprom.hex:i

Expand Down
17 changes: 8 additions & 9 deletions hxt200a.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.equ F_CPU = 16000000
.equ USE_INT0 = 1
.equ USE_I2C = 1
.equ USE_I2C = 0
.equ USE_UART = 1
.equ USE_ICP = 0

Expand Down Expand Up @@ -44,21 +44,21 @@
;*********************
.equ mux_b = 7 ; ADC7 phase input
.equ mux_c = 6 ; ADC6 phase input
.equ i2c_clk = 5 ; ADC5/SCL
.equ i2c_data = 4 ; ADC4/SDA
.equ BpFET = 5 ; ADC5/SCL
;.equ = 4 ; ADC4/SDA
.equ ApFET = 3
;.equ = 2
.equ mux_voltage = 2 ; ADC2 voltage input (470k from Vbat, 49.9k to gnd, 10.10V -> .969V at ADC2)
.equ mux_temperature = 1 ; ADC1 temperature input (1.5k from +5V, 10k NTC to gnd)
.equ mux_a = 0 ; ADC0 phase input

.equ O_POWER = 470
.equ O_GROUND = 47

.equ INIT_PC = (1<<i2c_clk)+(1<<i2c_data)
.equ DIR_PC = (1<<ApFET)
.equ INIT_PC = 0
.equ DIR_PC = (1<<BpFET)+(1<<ApFET)

.equ ApFET_port = PORTC
.equ BpFET_port = PORTC

;*********************
; PORT D definitions *
Expand All @@ -67,15 +67,14 @@
;.equ sense_star = 6 (comparator AN0)
.equ CnFET = 5
.equ CpFET = 4
.equ BpFET = 3
;.equ BpFET = 3
.equ rcp_in = 2
.equ txd = 1
.equ rxd = 0

.equ INIT_PD = (1<<txd)
.equ DIR_PD = (1<<BnFET)+(1<<CnFET)+(1<<CpFET)+(1<<BpFET)+(1<<txd)
.equ DIR_PD = (1<<BnFET)+(1<<CnFET)+(1<<CpFET)+(1<<txd)

.equ BnFET_port = PORTD
.equ CnFET_port = PORTD
.equ CpFET_port = PORTD
.equ BpFET_port = PORTD
9 changes: 5 additions & 4 deletions tgy.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3508,14 +3508,14 @@ wait_for_power_on_init:

cpi temp3, 1 ; Neutral brake
brne set_brake1
ldi YL, 1 << low(BRAKE_SPEED)
ldi YL, low(1 << BRAKE_SPEED)
sts brake_sub, YL
ldi2 YL, YH, BRAKE_POWER
rjmp set_brake_duty

set_brake1: cpi temp3, 2 ; Thumb brake
brne wait_for_power_on
ldi YL, 1 << low(LOW_BRAKE_SPEED)
ldi YL, low(1 << LOW_BRAKE_SPEED)
sts brake_sub, YL
ldi2 YL, YH, LOW_BRAKE_POWER

Expand Down Expand Up @@ -3572,8 +3572,9 @@ wait_for_power_rx:
rcall evaluate_rc ; Only get rc_duty, don't set duty
tst rc_timeout ; If not a valid signal, loop
breq wait_for_power_on ; while increasing boot/beacon timers
adiw YL, 0 ; If no power requested yet, loop
breq wait_for_power_on_init ; while resetting boot/beacon timers
adiw YL, 0
brne start_from_running ; If power requested, start; otherwise,
rjmp wait_for_power_on_init ; loop while resetting boot/beacon timers

start_from_running:
rcall switch_power_off
Expand Down

0 comments on commit 1c78876

Please sign in to comment.