Skip to content

Commit

Permalink
Merge pull request #195 from TG9541/blackout
Browse files Browse the repository at this point in the history
fixes #194 Improve behavior of serial interface w/ shared LED-Display…
  • Loading branch information
TG9541 authored Apr 15, 2018
2 parents 74484c8 + 41a315a commit 4e272b3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
16 changes: 7 additions & 9 deletions DCDC/boardcore.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ _EXTI4_IRQHandler:
;===============================================================

.ifne HAS_LED7SEG
RamWord TIMSERIAL ; Timer: use PC7 for serial while > 0
RamByte BKEYLMPX ; status of board keys

; LED_MPX driver ( -- )
Expand All @@ -70,10 +69,6 @@ LED_MPX:
; PNRX=PC7 dual use for simulated serial port and segment DP
; disaable DP while the simulated COM port is active (with time delay)

TNZ TIM4TCNT ; active sim COM: disable DP for some time
JREQ LMPX1
MOV TIMSERIAL,#(60000/256); load MSB msec ticker
LMPX1:
LDW X,TIMSERIAL ; decrement COM use timer
JREQ LMPX3 ; no COM: use DP
DECW X ; active COM: don't change PNRX properties
Expand Down Expand Up @@ -109,12 +104,15 @@ LMPX3:
; fall through

LMPXSEGS:
LD A,YL ; 8 bit LED pattern
LD A,YL ; 8 bit LED pattern
TNZ TIMSERIAL
JREQ 1$
CP A,#0x40 ; compare patter with sign ("-", segment G set)
JRNE 2$
MOV TIMRELOAD,#1 ; Reset TIMSERIAL reload value
JRA 1$
2$:
CP A,#0x40 ; compare patter with sign ("-", segment G set)
JRNE 1$
OR A,#0x02 ; set one more segment, or else COM simulation won't work
OR A,#0x02 ; set one more segment, or else COM simulation won't work

1$:
; DCDC 7S LED display row
Expand Down
1 change: 1 addition & 0 deletions DCDC/globconf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PSIM = PORTC ; Port for UART simulation
PNRX = 7 ; Port GPIO# for HAS_RXDSIM
PNTX = 7 ; Port GPIO# for HAS_TXDSIM
SERPRIOTIM = 30000 ; RXSIM priority in BG ticks

EMIT_BG = EMIT7S ; 7S-LED background EMIT vector
QKEY_BG = QKEYB ; Board keys background QKEY vector
Expand Down
8 changes: 1 addition & 7 deletions W1401/boardcore.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ _EXTI4_IRQHandler:

.ifne HAS_LED7SEG

RamWord TIMSERIAL ; Timer: use PD1 for serial while > 0

; LED_MPX driver ( -- )
; Code called from ISR for LED MPX

Expand All @@ -82,11 +80,6 @@ LED_MPX:
LD A,(LED7LAST-5,X)
CPL A

TNZ TIM4TCNT
JREQ 1$
MOV TIMSERIAL,#(1000/256); load MSB msec ticker
JRNE LEDMPXEND
1$:
LDW Y,TIMSERIAL ; decrement COM use timer
JREQ LEDMPXGO
DECW Y ; active COM: don't change PNRX properties
Expand All @@ -95,6 +88,7 @@ LED_MPX:

; LED segment clock out while PD1/SWIM is not used as UART
LEDMPXGO:
MOV TIMRELOAD,#1 ; Reset TIMSERIAL reload value
BRES PD_CR2,#PNRX ; disable PNRX external interrupt
PUSH A ; LED pattern (2,SP)
LD A,#8 ; 8 clock pulses for 74HC164
Expand Down
1 change: 1 addition & 0 deletions W1401/globconf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PSIM = PORTD ; Port for UART simulation
PNTX = 1 ; Port GPIO# for HAS_TXDSIM
PNRX = 1 ; Port GPIO# for HAS_RXDSIM
SERPRIOTIM = 30000 ; RXSIM priority in BG ticks

EMIT_BG = EMIT7S ; 7S-LED background EMIT vector
QKEY_BG = QKEYB ; Board keys background QKEY vector
Expand Down
1 change: 1 addition & 0 deletions XH-M194/boardcore.inc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ LED_MPX:
JRA LEDMPXGO

LEDMPXDOTS:
MOV TIMRELOAD,#1 ; Reset TIMSERIAL reload value
BTJF PD_DDR,#PNRX,LEDDOTS
BRES PD_DDR,#PNRX
BRES PD_CR1,#PNRX
Expand Down
6 changes: 4 additions & 2 deletions inc/sser_fdx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

.ifne SERPRIOTIM
RamWord TIMSERIAL ; "TIMSERIAL" Timer: use PSIM,PNRX for serial while not 0
RamByte TIMRELOAD ; Reload value for TIMSERIAL, set by receive interrupt, reset by timer
.endif

.ifne HAS_RXSIM
Expand Down Expand Up @@ -52,7 +53,7 @@ TXSTOR:
.endif
TXPSTOR:
.ifne SERPRIOTIM
MOV TIMSERIAL,#(SERPRIOTIM/256) ; load MSB msec ticker
MOV TIMSERIAL,TIMRELOAD ; load MSB msec ticker
.endif

INCW X
Expand Down Expand Up @@ -95,7 +96,8 @@ _EXTI3_IRQHandler:
BRES PSIM+CR2,#PNRX ; disable PNRX external interrupt

.ifne SERPRIOTIM
MOV TIMSERIAL,#(SERPRIOTIM/256) ; load MSB msec ticker
MOV TIMRELOAD,#(SERPRIOTIM/256) ; load MSB msec reload
MOV TIMSERIAL,TIMRELOAD ; load MSB msec ticker
.endif

MOV TIM4RCNT,#9 ; set sequence counter for RX
Expand Down
6 changes: 4 additions & 2 deletions inc/sser_hdx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

.ifne SERPRIOTIM
RamWord TIMSERIAL ; "TIMSERIAL" Timer: use PSIM,PNRX for serial while not 0
RamByte TIMRELOAD ; Reload value for TIMSERIAL, set by receive interrupt, reset by timer
.endif

.ifne HAS_RXSIM
Expand Down Expand Up @@ -49,7 +50,7 @@ TXSTOR:
.endif
TXPSTOR:
.ifne SERPRIOTIM
MOV TIMSERIAL,#(SERPRIOTIM/256); load MSB msec ticker
MOV TIMSERIAL,TIMRELOAD ; load MSB msec ticker
.endif

INCW X
Expand Down Expand Up @@ -94,7 +95,8 @@ _EXTI4_IRQHandler:
BRES PSIM+CR2,#PNRX ; disable PNRX external interrupt

.ifne SERPRIOTIM
MOV TIMSERIAL,#(SERPRIOTIM/256); load MSB msec ticker
MOV TIMRELOAD,#(SERPRIOTIM/256) ; load MSB msec reload
MOV TIMSERIAL,TIMRELOAD ; load MSB msec ticker
.endif

; Set-up TIM4 for 8N1 Rx sampling at half bit time
Expand Down

0 comments on commit 4e272b3

Please sign in to comment.