]> hackdaworld.org Git - my-code/arm.git/commitdiff
example for the button api
authorhackbard <hackbard@staubsauger.localdomain>
Fri, 7 Sep 2007 17:43:30 +0000 (19:43 +0200)
committerhackbard <hackbard@staubsauger.localdomain>
Fri, 7 Sep 2007 17:43:30 +0000 (19:43 +0200)
betty/betty.c

index af593d87008cfc5fcc6e4d163037a81f3d2032fc..3b19542792abb64df57cb0bb015519224e3a3543 100644 (file)
@@ -255,9 +255,8 @@ void bl_off(void) {
 
 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();
@@ -265,23 +264,21 @@ int main() {
        pin_select_init();
        init_lcd(0);
        bl_init();
-       button_init();
+       button_init(&button);
+       button_set_retries(&button,100);
 
        pause(0xffffff);
 
        bl_toggle();
 
        while(1) {
-               uart0_send_string("\n");
-               //uart0_send_string(buf);
-               //bl_toggle();
                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();
                }
        }