34 lines
700 B
C
34 lines
700 B
C
|
|||
|
|
/* AAIO features to use */
|
||
|
|
#define AAIO_FEATURE_KEYPAD
|
||
|
|
#define AAIO_FEATURE_LCD_5110
|
||
|
|
|
||
|
|
/* include the AAIO header */
|
||
|
|
#include "aaio.h"
|
||
|
|
|
||
|
|
/* keypad definition */
|
||
|
|
const static uint8_t keypad_def[4][4] PROGMEM = {
|
||
|
|
{'1' , '2' , '3' , 'A' },
|
||
|
|
{'4' , '5' , '6' , 'B' },
|
||
|
|
{'7' , '8' , '9' , 'C' },
|
||
|
|
{'*' , '0' , '#' , 'D' }
|
||
|
|
};
|
||
|
|
|
||
|
|
int main(void) {
|
||
|
|
aaio_lcd_init();
|
||
|
|
aaio_lcd_clear();
|
||
|
|
aaio_lcd_write_string("AAIO lib rulez!",1);
|
||
|
|
aaio_lcd_set_cursor(0, 10);
|
||
|
|
aaio_lcd_write_string("Nice!", 3);
|
||
|
|
aaio_lcd_render();
|
||
|
|
unsigned char c;
|
||
|
|
for(;;) {
|
||
|
|
c = aaio_scankey(keypad_def);
|
||
|
|
if(c != 0xff) {
|
||
|
|
aaio_lcd_set_cursor(0, 32);
|
||
|
|
aaio_lcd_write_char(c, 2);
|
||
|
|
aaio_lcd_render();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|