aaio

AVR All-In-One helper C library for Arduino boards
git clone git://git.luxferre.top/aaio.git
Log | Files | Refs

example_5110.c (700B)


      1 
      2 /* AAIO features to use */
      3 #define AAIO_FEATURE_KEYPAD
      4 #define AAIO_FEATURE_LCD_5110
      5 
      6 /* include the AAIO header */
      7 #include "aaio.h"
      8 
      9 /* keypad definition */
     10 const static uint8_t keypad_def[4][4] PROGMEM = {
     11 	{'1' , '2' , '3' , 'A' },
     12 	{'4' , '5' , '6' , 'B' },
     13 	{'7' , '8' , '9' , 'C' },
     14 	{'*' , '0' , '#' , 'D' }
     15 };
     16 
     17 int main(void) {
     18   aaio_lcd_init();
     19   aaio_lcd_clear();
     20   aaio_lcd_write_string("AAIO lib rulez!",1);
     21   aaio_lcd_set_cursor(0, 10);
     22   aaio_lcd_write_string("Nice!", 3);
     23   aaio_lcd_render();
     24   unsigned char c;
     25   for(;;) {
     26     c = aaio_scankey(keypad_def);
     27     if(c != 0xff) {
     28       aaio_lcd_set_cursor(0, 32);
     29       aaio_lcd_write_char(c, 2);
     30       aaio_lcd_render();
     31     }
     32   }
     33 }