Main Page   Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

legOS/kernel/dkey.c File Reference

debounced key driver. More...


Functions

char dkey_timer __attribute__ ((unused))
single key state. More...

 __asm__ (" .text .align 1 .global _dkey_handler _dkey_handler: mov.b @_dkey_timer,r6l ; check debouncing timer==0 beq dkey_check dec r6l mov.b r6l,@_dkey_timer rts dkey_check: sub.b r6l,r6l ; generate button codes ; from PORT4/PORT7 in r6l mov.b @_PORT4,r6h bld #1,r6h bist #0,r6l bld #2,r6h bist #1,r6l mov.b @_PORT7,r6h bld #6,r6h bist #2,r6l bld #7,r6h bist #3,r6l mov.b @_dkey_multi,r6h xor.b r6l,r6h ; create mask of changed positions in r6h beq dkey_same mov.b r6l,@_dkey_multi and.b r6h,r6l ; mask out unchanged positions mov.b r6l,@_dkey mov.b #100,r6l ; set debouncing timer mov.b r6l,@_dkey_timer dkey_same: rts ")
debouncing timer. More...

wakeup_t dkey_pressed (wakeup_t data)
wakeup if any of the given keys is pressed.

wakeup_t dkey_released (wakeup_t data)
wakeup if all of the given keys are released.

int getchar (void)
wait for keypress and return key code. More...


Variables

volatile unsigned char dkey_multi
volatile unsigned char dkey
multi-key state.


Detailed Description

debounced key driver.

Author(s):
Markus L. Noga <markus@noga.de>

Function Documentation

char dkey_timer __attribute__ ((unused))

single key state.

////////////////////////////////////////////////////////////////////////////

__asm__ (".text.align 1.global _dkey_handler_dkey_handler:mov.b@ _dkey_timer, r6l; check debouncing timer = =0 beq dkey_check dec r6l mov.b r6l, @_dkey_timer rts dkey_check:sub. b r6l, r6l;generate button codes;from PORT4/PORT7 in r6l mov.b@ _PORT4, r6h bld# 1, r6h bist# 0, r6l bld# 2, r6h bist# 1, r6l mov.b@ _PORT7, r6h bld# 6, r6h bist# 2, r6l bld# 7, r6h bist# 3, r6l mov.b@ _dkey_multi, r6h xor. b r6l, r6h;create mask of changed positions in r6h beq dkey_same mov. b r6l, @_dkey_multi and. b r6h, r6l;mask out unchanged positions mov. b r6l, @_dkey mov.b# 100, r6l;set debouncing timer mov. b r6l, @_dkey_timer dkey_same:rts")

debouncing timer.

////////////////////////////////////////////////////////////////////////////

wakeup_t dkey_pressed (wakeup_t data)

wakeup if any of the given keys is pressed.

wakeup_t dkey_released (wakeup_t data)

wakeup if all of the given keys are released.

int getchar (void)

wait for keypress and return key code.

key combinations not admissible.


Variable Documentation

volatile unsigned char dkey_multi

volatile unsigned char dkey

multi-key state.

legOS-0.2.4 is released under the Mozilla Public License. Original code copyright 1998-1999 by the authors.