diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2009-04-08 20:45:56 +0200 |
---|---|---|
committer | Segher Boessenkool <segher@kernel.crashing.org> | 2009-04-08 20:45:56 +0200 |
commit | 93dceea77d32fb41613703efa979740cee55d8ac (patch) | |
tree | 68236e0701a242250a9cb15ae8dc29292b351549 /board-BAT.c | |
parent | 731a5d88020a62cb284d6c037462712a03d07425 (diff) |
Wire up controller for BAT
Diffstat (limited to 'board-BAT.c')
-rw-r--r-- | board-BAT.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/board-BAT.c b/board-BAT.c index 6fe0a23..5b6c8f0 100644 --- a/board-BAT.c +++ b/board-BAT.c @@ -13,6 +13,36 @@ static u16 gpio(u32 n, u16 what, u16 push, u16 pull) { + fprintf(stderr, "---> PORT %c what=%04x push=%04x pull=%04x\n", + 'A' + n, what, push, pull); + + if (n == 0) { + if (button_up) + what |= 0x8000; + if (button_down) + what |= 0x4000; + if (button_left) + what |= 0x2000; + if (button_right) + what |= 0x1000; + if (button_A) + what |= 0x0800; + if (button_menu) + what |= 0x0400; + if (button_B) + what |= 0x0200; + if (button_C) + what |= 0x0100; + } + +// if (n == 2) { +// int sda = what & 1; +// int scl = (what >> 1) & 1; +////fprintf(stderr, "SDA=%d SCL=%d\n", sda, scl); +// sda = i2c_bitbang(i2c_bus, sda, scl); +// what = (what & ~1) | sda; +// } + return what; } |