projects
/
my-code
/
arm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
98d1a9b
)
example for the button api
author
hackbard
<hackbard@staubsauger.localdomain>
Fri, 7 Sep 2007 17:43:30 +0000
(19:43 +0200)
committer
hackbard
<hackbard@staubsauger.localdomain>
Fri, 7 Sep 2007 17:43:30 +0000
(19:43 +0200)
betty/betty.c
patch
|
blob
|
history
diff --git
a/betty/betty.c
b/betty/betty.c
index
af593d8
..
3b19542
100644
(file)
--- a/
betty/betty.c
+++ b/
betty/betty.c
@@
-255,9
+255,8
@@
void bl_off(void) {
int main() {
int main() {
- char buf[]="betty - live from the flash at 0x80000000! ;)\r\n";
- u64 keys;
- u8 i;
+ char buf[]="betty - live from flash at 0x80000000! ;)\r\n";
+ t_button button;
pll_init();
uart0_init();
pll_init();
uart0_init();
@@
-265,23
+264,21
@@
int main() {
pin_select_init();
init_lcd(0);
bl_init();
pin_select_init();
init_lcd(0);
bl_init();
- button_init();
+ button_init(&button);
+ button_set_retries(&button,100);
pause(0xffffff);
bl_toggle();
while(1) {
pause(0xffffff);
bl_toggle();
while(1) {
- uart0_send_string("\n");
- //uart0_send_string(buf);
- //bl_toggle();
pause(0x0fffff);
pause(0x0fffff);
- button_get_event(&keys,1000);
- for(i=0;i<42;i++) {
-
//if(keys&(1<<i
)) {
-
// uart0_send_byte(0x30+i
);
- // break;
-
uart0_send_byte(keys&(1<<i)?0x31:0x30
);
+
+ /* button test! */
+
if(button_get_event(&button
)) {
+
uart0_send_string(buf
);
+ if(button.key[0]==BUTTON_POWER)
+
bl_toggle(
);
}
}
}
}