rendered paste bodyvoid button_init_device(void){ /* We need to output to pin 6 of GPIOD when reading the scroll pad value */ GPIOD_OUTPUT_EN |= 0x40; GPIOD_OUTPUT_VAL |= 0x40; GPIOD_OUTPUT_EN |= 0x80; GPIOD_OUTPUT_VAL |= 0x80;}void app_main(void){ init(); int button= BUTTON_NONE; char buf0[128]; int scroll_pos; while(true){ button = button_read_device(); if (button == BUTTON_POWER){ sleep(HZ); GPIOF_OUTPUT_VAL &=~ 0x20; } if ( GPIOD_INPUT_VAL & 0x20 ) { GPIOD_OUTPUT_VAL &=~ 0x40; GPIOD_OUTPUT_VAL |= 0x80; udelay(50); scroll_pos = adc_scan(ADC_SCROLLPAD); GPIOD_OUTPUT_VAL &=~0x80; GPIOD_OUTPUT_VAL |= 0x40; snprintf(buf0, sizeof(buf0), "SCROLL: %2x",scroll_pos); } lcd_puts(0, 1, buf0); lcd_update(); } //browse_root();}