1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

more stuff, still not working

This commit is contained in:
Bas Wijnen
2009-08-19 01:00:05 +02:00
parent a892e9cfc0
commit ebdc68a9d8
4 changed files with 69 additions and 42 deletions

View File

@@ -60,13 +60,13 @@ enum cap_type:
CAP_PWM
NUM_EVENT_TYPES
static Caps events = Cap (0, 6)
static unsigned events
static void event (event_type type, unsigned data):
Cap (2, type - 32).invoke (data)
Cap (events, type - 32).invoke (data)
static void set_cb (Cap cap, event_type type):
cap.clone (events, type - 32)
cap.clone (Cap (events, type - 32))
class DevKeyboard:
static unsigned const encode[GPIO_KBD_NUM_COLS][GPIO_KBD_NUM_ROWS]
@@ -255,10 +255,13 @@ class Pwm:
// TODO: make it really work as a pwm instead of a switch; check if pwm1 is connected to anything.
Num start ():
__my_memory.create_caps (NUM_EVENT_TYPES - 32).clone (__my_caps, 6)
map_gpio ()
map_pwm0 ()
Caps e = __my_memory.create_caps (NUM_EVENT_TYPES - 32)
events = e.use ()
free_cap (e)
DevKeyboard kbd
Touchpad tp
Lockleds leds
@@ -268,14 +271,15 @@ Num start ():
GPIO_GPIER (GPIO_KBD_ROW_PORT) = (1 << GPIO_TP_LEFT) | (1 << GPIO_TP_RIGHT) | GPIO_KBD_ROW_MASK
Kernel::register_interrupt (IRQ_GPIO0)
Caps c (0, 7)
__my_memory.create_caps (4).clone (__my_caps, 7)
__my_receiver.create_capability (CAP_KEYBOARD).clone (c, 0)
__my_receiver.create_capability (CAP_TOUCHPAD).clone (c, 1)
__my_receiver.create_capability (CAP_LOCKLEDS).clone (c, 2)
__my_receiver.create_capability (CAP_PWM).clone (c, 3)
Caps c = __my_memory.create_caps (4)
unsigned init_slot = c.use ()
__my_receiver.create_capability (CAP_KEYBOARD, Cap (init_slot, 0))
__my_receiver.create_capability (CAP_TOUCHPAD, Cap (init_slot, 1))
__my_receiver.create_capability (CAP_LOCKLEDS, Cap (init_slot, 2))
__my_receiver.create_capability (CAP_PWM, Cap (init_slot, 3))
__my_parent.invoke (c, INIT_SET_GPIO)
free_cap (c)
if kbd.is_scanning ():
__my_receiver.set_alarm (ALARM_INTERVAL)