Ejemplo n.º 1
0
void board_rotation(){
  
  uint8_t pressed = 0;

  uint8_t board_orientation = eeprom_read_byte(eeBoardOrientation);
  board_orientation &= 0x03;

  _brd_render(board_orientation);
  lcd_update();
  while ((pressed = wait_for_button(BUTTON_ANY)) != BUTTON_BACK){
    if (pressed == BUTTON_OK){
      eeprom_write_byte(eeBoardOrientation, board_orientation);
      BoardOrientation = board_orientation;
      _brd_print_warning();
    }

    switch (pressed){
      case BUTTON_UP:
        board_orientation++;
        break;
      case BUTTON_DOWN:
        board_orientation--;
        break;   
    }
    board_orientation &= 0x03;
    _brd_render(board_orientation);
    lcd_update();
  }

}
Ejemplo n.º 2
0
/********************************************************************************
PUCK:
函数功能:获取屏幕显示信息,并显示
入口:
     type-----模式参数;curs-----光标位置
返回:
********************************************************************************/
void screen (u8 type, curs_t curs) 
{
   const scrn_t* p;
  //在此前,vlist的信息已经更新-----PUCK

    static scrn_t scrn={0xff,0xff,"",{0}};   //不为0,保证第一次就能更新,因为0x000000有可能第一次就是0---PUCK
    if(scrn.code != vlist.code)              //按照全显代码检索:编码已经更新,需要根据vlist的编码获取新的显示元素-----------PUCK
    {
        for (p=&table[0];p!=&table[MAXCOUNT];++p) 
        {
            if ( p->code==vlist.code)  //按照显示代码检索
            {
                scrn = *p;
                break;
            }                
        }
    }
    if(p==&table[MAXCOUNT]) //找不到显示的代码,只显示代码,事件,其他不显示-------PUCK
    {
      lcd_code     (vlist.user, curs, vlist.dlen);
      lcd_events();
      lcd_update();  
      return ;
    }
    
    curs %= vlist.dlen;
    lcd_data     (scrn.item, scrn.frmt,scrn.elem.signpos);   //18ms
    lcd_code     (vlist.user, curs, vlist.dlen);       //26ms
    lcd_mode     (type);                ///A/B/C 3种模式
    lcd_total    (scrn.elem.total    ); ///< "总",
    lcd_phase    (scrn.elem.phase    ); ///< "A/B/C相",
    lcd_voltage  (scrn.elem.voltage  ); ///< "电压",
    lcd_current  (scrn.elem.current  ); ///< "电流",
    lcd_positive (scrn.elem.positive ); ///< mode4.bit4 ? "输入" : "正向";
    lcd_negative (scrn.elem.negative ); ///< mode4.bit4 ? "输出" : "反向";
    lcd_reactive (scrn.elem.reactive ); ///< "无功",
    lcd_active   (scrn.elem.active   ); ///< "有功",
    lcd_power    (scrn.elem.power    ); ///< "功率",
    lcd_factor   (scrn.elem.factor   ); ///< "因数",
    lcd_angle    (scrn.elem.angle    ); ///< "相角",
    lcd_energy   (scrn.elem.energy   ); ///< "电量",
    lcd_demand   (scrn.elem.demand   ); ///< "需量",
    lcd_time     (scrn.elem.time     ); ///< "时间",
    lcd_charge   (scrn.elem.charge   ); ///< "电费",
    lcd_lostvolt (scrn.elem.lostvolt ); ///< "失压",
    lcd_lostcurt (scrn.elem.lostcurt ); ///< "失流",
    lcd_periods  (scrn.elem.periods  ); ///< "时段",
    lcd_feerate  (scrn.elem.feerate  ); ///< "费率",    
    lcd_thismonth(scrn.elem.thismonth); ///< "本月",
    lcd_lastmonth(scrn.elem.lastmonth); ///< mode4.bit5 ? "上月", "上上月" : "上1月", "上2月";
    lcd_assemble (scrn.elem.assemble ); ///< "无功组合方式1 or 2", mode4.bit7 ? "逆时针" : "顺时针";
    lcd_quadrant (scrn.elem.quadrant ); ///< "XX象限",
    lcd_tariff   (scrn.elem.tariff   ); ///< 显示"费率Tx",
    lcd_times    (scrn.elem.times    ); ///< 显示"上XX次",
    lcd_events   ();    //8ms
    lcd_update   ();
}
Ejemplo n.º 3
0
void backtrace(int pcAddr, int spAddr, unsigned *line)
{
    UnwResult r;

    lcd_putsf(0, (*line)++, "pc:%08x sp:%08x", pcAddr, spAddr);
    lcd_update();

    r = UnwindStart(pcAddr, spAddr, &cliCallbacks, (void *)line);

    lcd_puts(0, (*line)++, "bt end");
    lcd_update();
}
Ejemplo n.º 4
0
void fatal_error(void)
{
    extern int line;
    bool holdstatus=false;

    /* System font is 6 pixels wide */
#if defined(IPOD_1G2G) || defined(IPOD_3G)
    printf("Insert Firewire cable, or");
    printf("hold MENU+PLAY to reboot");
    printf("then REW+FF for disk mode");
#elif LCD_WIDTH >= (30*6)
    printf("Insert USB cable, or");
    printf("hold MENU+SELECT to reboot");
    printf("then SELECT+PLAY for disk mode");
#else
    printf("Insert USB cable, or");
    printf("hold MENU+SELECT to");
    printf("reboot then SELECT+PLAY");
    printf("for disk mode");
#endif
    lcd_update();

    usb_init();
    while (1) {
        if (button_hold() != holdstatus) {
            if (button_hold()) {
                holdstatus=true;
                lcd_puts(0, line, "Hold switch on!");
            } else {
                holdstatus=false;
                lcd_puts(0, line, "               ");
            }
            lcd_update();
        }
        if (usb_detect() == USB_INSERTED) {
            ata_sleepnow(); /* Immediately spindown the disk. */
            sleep(HZ*2);
#if CONFIG_CPU == PP5020
            memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21);
#elif CONFIG_CPU == PP5022
            memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21);
#elif CONFIG_CPU == PP5002
            memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17);
#endif /* CONFIG_CPU */
            system_reboot(); /* Reboot */
        }
        udelay(100000); /* 100ms */
    }

}
Ejemplo n.º 5
0
void logf_panic_dump(int *y)
{
    int i;
    /* nothing to print ? */
    if(logfindex == 0 && !logfwrap)
    {
        lcd_puts(1, (*y)++, "no logf data");
        lcd_update();
        return;
    }

    lcd_puts(1, (*y)++, "start of logf data");
    lcd_update();
    i = logfindex - 2; /* The last actual characer (i.e. not '\0') */

    while(i >= 0)
    {
        while(logfbuffer[i] != 0 && i>=0)
        {
            i--;
        }
        if(strlen( &logfbuffer[i + 1]) > 0)
        {
            lcd_puts(1, (*y)++, &logfbuffer[i + 1]);
            lcd_update();
        }
        i--;
    }
    if(logfwrap)
    {
        i = MAX_LOGF_SIZE - 1;
        while(i >= logfindex)
        {
            while(logfbuffer[i] != 0 && i >= logfindex)
            {
                i--;
            }
            if(strlen( &logfbuffer[i + 1]) > 0)
            {
                lcd_putsf(1, (*y)++, "%*s", (MAX_LOGF_SIZE-i) &logfbuffer[i + 1]);
                lcd_update();
            }
        }
        i--;
    }
    lcd_puts(1, (*y)++, "end of logf data");
    lcd_update();
}
Ejemplo n.º 6
0
void exec_init() {
	// initialize all sub-systems
	hl_init();
	schd_init();
	lcd_init();
	cam_init();	
	adc_init();
	serv_init();
	cont_init();
	ui_init();
	mot_init();
	//comms_init();	
	
	// disable interrupt
	disable_irq(EXEC_PIT_IRQ_NUM);
	
	// enable the clock to the PIT module (pg. 299)
	SIM_SCGC6 |= SIM_SCGC6_PIT_MASK;

	// enable clock for PIT timers and allow timers to continue to
	// run in debug mode (pg. 1038)
	PIT_MCR = 0x0; 
	
	exec_disablePit();
	
	exec_sysMode = EXEC_MODE_IDLE;
	lcd_update();
	exec_update();		
}
Ejemplo n.º 7
0
Archivo: menu.c Proyecto: Andyboby/gt3b
// show main screen (model number and name/battery/...)
static void main_screen(u8 item) {
    menu_adc_wakeup = 0;

    // chars is item dependent
    if (item == MS_NAME) {
	// model name
	lcd_segment(LS_SYM_CHANNEL, LS_OFF);
	lcd_segment(LS_SYM_DOT, LS_OFF);
	lcd_segment(LS_SYM_VOLTS, LS_OFF);
	show_model_number(cg.model);
	lcd_chars(cm.name);
    }
    else if (item == MS_BATTERY) {
	static u16 bat_val;
	static u16 bat_time;

	// battery voltage
	lcd_segment(LS_SYM_CHANNEL, LS_OFF);
	lcd_segment(LS_SYM_DOT, LS_ON);
	lcd_segment(LS_SYM_VOLTS, LS_ON);
	show_model_number(cg.model);
	// calculate voltage from current raw value and calib value
	if (time_sec >= bat_time) {
	    bat_time = time_sec + 2;
	    bat_val = (u16)(((u32)adc_battery * 100 + 300) / cg.battery_calib);
	}
	lcd_char_num3(bat_val);
	menu_adc_wakeup = 1;
    }
    else {
	// timers
	menu_timer_show((u8)(item - MS_TIMER0));
    }
    lcd_update();
}
void power_off(void)
{
#if defined(HAVE_LCD_COLOR) && !defined(HAVE_LCD_SHUTDOWN)
    /* Clear the screen and backdrop to
    remove ghosting effect on shutdown */
    lcd_set_backdrop(NULL);
    lcd_set_background(LCD_WHITE);
    lcd_clear_display();
    lcd_update();
    sleep(HZ/16);
#endif

#ifndef BOOTLOADER
#ifdef IPOD_1G2G
    /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */
    system_reboot();
#else
    /* We don't turn off the ipod, we put it in a deep sleep */
    /* Clear latter part of iram (the part used by plugins/codecs) to ensure
     * that the OF behaves properly on boot. There is some kind of boot
     * failure flag there which otherwise may not be cleared.
     */
#if CONFIG_CPU == PP5022
    memset((void*)0x4000c000, 0, 0x14000);
#elif CONFIG_CPU == PP5020
    memset((void*)0x4000c000, 0, 0xc000);
#endif
    pcf50605_standby_mode();
#endif
#endif
}
Ejemplo n.º 9
0
bool dbg_ports(void)
{
    int line;

    lcd_setfont(FONT_SYSFIXED);

    while(1)
    {
        lcd_clear_display();
        line = 0;
        
        _DEBUG_PRINTF("GPIO_PADR:  %02x",(unsigned char)GPIO_PADR);
        _DEBUG_PRINTF("GPIO_PACON: %02x",(unsigned char)GPIO_PACON);
        _DEBUG_PRINTF("GPIO_PBDR:  %02x",(unsigned char)GPIO_PBDR);
        _DEBUG_PRINTF("GPIO_PBCON: %02x",(unsigned char)GPIO_PBCON);
        _DEBUG_PRINTF("GPIO_PCDR:  %02x",(unsigned char)GPIO_PCDR);
        _DEBUG_PRINTF("GPIO_PCCON: %02x",(unsigned char)GPIO_PCCON);
        _DEBUG_PRINTF("GPIO_PDDR:  %02x",(unsigned char)GPIO_PDDR);
        _DEBUG_PRINTF("GPIO_PDCON: %02x",(unsigned char)GPIO_PDCON);
        _DEBUG_PRINTF("ADC0: %d", adc_read(0));
        _DEBUG_PRINTF("ADC1: %d", adc_read(1));
        _DEBUG_PRINTF("ADC2: %d", adc_read(2));
        _DEBUG_PRINTF("ADC3: %d", adc_read(3));

        lcd_update();
        if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
            break;
    }
    lcd_setfont(FONT_UI);
    return false;
}
Ejemplo n.º 10
0
bool dbg_hw_info(void)
{
    int line;
    lcd_clear_display();
    lcd_setfont(FONT_SYSFIXED);

    while(1)
    {
        lcd_clear_display();
        line = 0;

        /* _DEBUG_PRINTF statements can be added here to show debug info */
        _DEBUG_PRINTF("SCU_ID:      0x%0x", SCU_ID);
        _DEBUG_PRINTF("SCU_PLLCON1: 0x%0x", SCU_PLLCON1);
        _DEBUG_PRINTF("SCU_PLLCON2: 0x%0x", SCU_PLLCON2);
        _DEBUG_PRINTF("SCU_PLLCON3: 0x%0x", SCU_PLLCON3);
        _DEBUG_PRINTF("SCU_DIVCON1: 0x%0x", SCU_DIVCON1);
        _DEBUG_PRINTF("SCU_CLKCFG:  0x%0x", SCU_CLKCFG);
        _DEBUG_PRINTF("SCU_CHIPCFG: 0x%0x", SCU_CHIPCFG);
        line++;
        _DEBUG_PRINTF("sd_debug_time_rd: %d", sd_debug_time_rd);
        _DEBUG_PRINTF("sd_debug_time_wr: %d", sd_debug_time_wr);
        lcd_update(); 
        switch(button_get_w_tmo(HZ/20))
        {
            case DEBUG_CANCEL:
            case BUTTON_REL:
                lcd_setfont(FONT_UI);
                return false;
        }
    }

    lcd_setfont(FONT_UI);
    return false;
}
Ejemplo n.º 11
0
bool lcd_debug_screen(void)
{
    lcd_setfont(FONT_SYSFIXED);

    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 10);
        switch(button)
        {
            case ACTION_STD_NEXT:
            case ACTION_STD_PREV:
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }

        lcd_clear_display();
        lcd_putsf(0, 0, "has power: %d", lcd_has_power);
        lcd_putsf(0, 1, "lcd kind: %d", lcd_kind);
        lcd_update();
        yield();
    }

    return true;
}
Ejemplo n.º 12
0
int main(void)
{
    char buf[16];
    char labels[2][16] = {
        "Luftdruck",
        "Windgeschw.",
    };
    char units[2][16] = {
        "Pa",
        "m/s",
    };
    float (*functions[2]) () = {
        barometer_read,
        anemometer_read,
    };

    init();
    while(1)
    {
        lcd_set_battery_level(battery_read());
        float2string(buf, functions[selection]());
        sprintf(buf, "%s %s", buf, units[selection]);
        lcd_set_label(labels[selection], buf);
        lcd_update();
    }
    return 0;
}
Ejemplo n.º 13
0
bool dbg_hw_info_adc(void)
{
    lcd_setfont(FONT_SYSFIXED);
    
    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 25);
        switch(button)
        {
            case ACTION_STD_NEXT:
            case ACTION_STD_PREV:
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }
        
        lcd_clear_display();

        /* add battery readout in mV, this it is not the direct output of a channel */
        lcd_putsf(0, 0, "Battery(mV) %d", _battery_voltage());
        for(unsigned i = 0; i < NUM_ADC_CHANNELS; i++)
        {
            lcd_putsf(0, i + 1, "%s %d", imx233_adc_channel_name[i],
                adc_read(i));
        }
        
        lcd_update();
        yield();
    }
}
Ejemplo n.º 14
0
bool dbg_hw_info_rtc(void)
{
    lcd_setfont(FONT_SYSFIXED);
    
    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 10);
        switch(button)
        {
            case ACTION_STD_NEXT:
            case ACTION_STD_PREV:
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }
        
        lcd_clear_display();
        struct imx233_rtc_info_t info = imx233_rtc_get_info();
        
        lcd_putsf(0, 0, "seconds: %lu", info.seconds);
        for(int i = 0; i < 6; i++)
            lcd_putsf(0, i + 1, "persistent%d: 0x%lx", i, info.persistent[i]);
        
        lcd_update();
        yield();
    }
}
Ejemplo n.º 15
0
int printf(const char *format, ...)
{
    static char printfbuf[256];
    int len;
    unsigned char *ptr;
    va_list ap;
    va_start(ap, format);

    ptr = printfbuf;
    len = vsnprintf(ptr, sizeof(printfbuf), format, ap);
    va_end(ap);

    lcd_puts(0, line++, ptr);
    if (verbose)
        lcd_update();
    if(line >= LCD_HEIGHT/SYSFONT_HEIGHT)
        line = 0;
#ifdef HAVE_REMOTE_LCD
    lcd_remote_puts(0, remote_line++, ptr);
    if (verbose)
        lcd_remote_update();
    if(remote_line >= LCD_REMOTE_HEIGHT/SYSFONT_HEIGHT)
        remote_line = 0;
#endif
    return len;
}
Ejemplo n.º 16
0
static void show_logo(void)
{
    lcd_clear_display();
    lcd_puts(0, 0, "Rockbox");
    lcd_puts(0, 1, "Rescue boot");
    lcd_update();
}
void lcd_enable(bool state)
{
    if (state == lcd_on)
        return;

    if(state)
    {
        /* "enabled" implies "powered" */
        if (!lcd_powered)
        {
            LCD_SPI_powerup();
            /* Wait long enough for a frame to be written - yes, it
             * takes awhile. */
            sleep(HZ/5);
        }

        lcd_on = true;
        lcd_update();
        send_event(LCD_EVENT_ACTIVATION, NULL);
    }
    else
    {
        lcd_on = false;
    }
}
Ejemplo n.º 18
0
static bool reset_settings(void)
{
    bool done=false;
    int line;
    int button;
 
    lcd_clear_display();

#ifdef HAVE_LCD_CHARCELLS
    line = 0;
#else
    line = 1;
    lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER));
#endif
    lcd_puts(0,line,str(LANG_RESET_CONFIRM));
    lcd_puts(0,line+1,str(LANG_RESET_CANCEL));

    lcd_update();
     
    while(!done) {
        button = button_get(true);
        switch(button) {
            case SETTINGS_OK:
                settings_reset();
                settings_apply();
                lcd_clear_display();
                lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR));
                done = true;
                break;

            case SETTINGS_CANCEL:
                lcd_clear_display();
                lcd_puts(0,1,str(LANG_RESET_DONE_CANCEL));
                done = true;
                break;

            default:
                if(default_event_handler(button) == SYS_USB_CONNECTED)
                    return true;
        }
    }

    lcd_puts(0,0,str(LANG_RESET_DONE_SETTING));
    lcd_update();
    sleep(HZ);
    return false;
}
Ejemplo n.º 19
0
/* Update a fraction of the display. */
void lcd_update_rect(int x, int y, int width, int height)
{
    (void)x;
    (void)y;
    (void)width;
    (void)height;
    lcd_update();
}
Ejemplo n.º 20
0
static int boot_menu(void)
{
    const char* strings[] = {"Boot Rockbox", "Boot OF", "USB mode", "Reset Rockbox configuration"};
    int button, touch, poweroff_repeat = 0;
    unsigned int i;

    verbose = true;
    adc_init();

redraw:
    lcd_clear_display();
    for(i=0; i<ARRAYLEN(strings); i++)
    {
        lcd_drawrect(RECT_X, RECT_Y(i), RECT_WIDTH, RECT_HEIGHT);
        lcd_putsxy(TEXT_X(i), TEXT_Y(i), strings[i]);
    }
    lcd_update();

    while(1)
    {
        button = button_get_w_tmo(HZ/4);
        if(button & BUTTON_TOUCHSCREEN)
        {
            touch = button_get_data();
            unsigned int x = touch & 0xFFFF, y = touch >> 16;
            int found = -1;
            for(i=0; i<ARRAYLEN(strings); i++)
            {
                if(x > RECT_X && x < RECT_X+RECT_WIDTH &&
                   y > RECT_Y(i) && y < RECT_Y(i)+RECT_HEIGHT)
                {
                    found = i;
                    break;
                }
            }

            switch(found)
            {
                case 0:
                    reset_screen();
                    boot_rockbox();
                    break;
                case 1:
                    reset_screen();
                    boot_of();
                    break;
                case 2:
                    usb_mode();
                    break;
                case 3:
                    reset_configuration();
                    break;
            }

            if(found != -1)
                goto redraw;
        }
        else if(button & BUTTON_POWER)
Ejemplo n.º 21
0
static void show_splash(int timeout, const char *msg)
{
    reset_screen();
    lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2,
                (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
    lcd_update();

    sleep(timeout);
}
Ejemplo n.º 22
0
static void init_tagcache(void)
{
    bool clear = false;
#if CONFIG_CODEC == SWCODEC
    long talked_tick = 0;
#endif
    tagcache_init();
    
    while (!tagcache_is_initialized())
    {
        int ret = tagcache_get_commit_step();

        if (ret > 0)
        {
#if CONFIG_CODEC == SWCODEC
            /* hwcodec can't use voice here, as the database commit
             * uses the audio buffer. */
            if(global_settings.talk_menu
               && (talked_tick == 0
                   || TIME_AFTER(current_tick, talked_tick+7*HZ)))
            {
                talked_tick = current_tick;
                talk_id(LANG_TAGCACHE_INIT, false);
                talk_number(ret, true);
                talk_id(VOICE_OF, true);
                talk_number(tagcache_get_max_commit_step(), true);
            }
#endif
#ifdef HAVE_LCD_BITMAP
            if (lang_is_rtl())
            {
                splashf(0, "[%d/%d] %s", ret, tagcache_get_max_commit_step(),
                    str(LANG_TAGCACHE_INIT));
            }
            else
            {
                splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret,
                    tagcache_get_max_commit_step());
            }
#else
            lcd_double_height(false);
            lcd_putsf(0, 1, " DB [%d/%d]", ret, 
                tagcache_get_max_commit_step());
            lcd_update();
#endif
            clear = true;
        }
        sleep(HZ/4);
    }
    tagtree_init();

    if (clear)
    {
        backlight_on();
        show_logo();
    }
}
Ejemplo n.º 23
0
bool dbg_hw_info(void)
{
    unsigned manu, id; /* flash IDs */
    int got_id; /* flag if we managed to get the flash IDs */
    int oldmode;  /* saved memory guard mode */
    int line = 0;

    oldmode = system_memory_guard(MEMGUARD_NONE);  /* disable memory guard */

    /* get flash ROM type */
    got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
    if (!got_id)
        got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */

    system_memory_guard(oldmode);  /* re-enable memory guard */

    lcd_setfont(FONT_SYSFIXED);
    lcd_clear_display();

    lcd_puts(0, line++, "[Hardware info]");

    if (got_id)
        lcd_putsf(0, line++, "Flash: M=%04x D=%04x", manu, id);
    else
        lcd_puts(0, line++, "Flash: M=???? D=????"); /* unknown, sorry */

#ifdef IAUDIO_X5
    {
        struct ds2411_id id;

        lcd_puts(0, ++line, "Serial Number:");

        got_id = ds2411_read_id(&id);

        if (got_id == DS2411_OK)
        {
            lcd_putsf(0, ++line, "  FC=%02x", (unsigned)id.family_code);
            lcd_putsf(0, ++line, "  ID=%02X %02X %02X %02X %02X %02X",
                (unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2],
                (unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]);
            lcd_putsf(0, ++line, "  CRC=%02X", (unsigned)id.crc);
        }
        else
        {
            lcd_putsf(0, ++line, "READ ERR=%d", got_id);
        }
    }
#endif

    lcd_update();

    /* wait for exit */
    while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL));

    lcd_setfont(FONT_UI);
    return false;
}
Ejemplo n.º 24
0
bool dbg_hw_info_pinctrl(void)
{
    lcd_setfont(FONT_SYSFIXED);

#ifdef IMX233_PINCTRL_DEBUG
    unsigned top_user = 0;
#endif
    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 10);
        switch(button)
        {
            case ACTION_STD_NEXT:
#ifdef IMX233_PINCTRL_DEBUG
                top_user++;
                break;
#endif
            case ACTION_STD_PREV:
#ifdef IMX233_PINCTRL_DEBUG
                if(top_user > 0)
                    top_user--;
                break;
#endif
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }

        lcd_clear_display();
        for(int i = 0; i < 4; i++)
            lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff));
#ifdef IMX233_PINCTRL_DEBUG
        unsigned cur_line = 6;
        unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height;
        unsigned cur_idx = 0;

        for(int bank = 0; bank < 4; bank++)
        for(int pin = 0; pin < 32; pin++)
        {
            const char *owner = imx233_pinctrl_get_pin_use(bank, pin);
            if(owner == NULL)
                continue;
            if(cur_idx++ >= top_user && cur_line < last_line)
                lcd_putsf(0, cur_line++, "B%dP%02d %s", bank, pin, owner);
        }
        if(cur_idx < top_user)
            top_user = cur_idx - 1;
#endif
        lcd_update();
        yield();
    }
}
Ejemplo n.º 25
0
bool dbg_hw_info_power(void)
{
    lcd_setfont(FONT_SYSFIXED);
    
    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 10);
        switch(button)
        {
            case ACTION_STD_NEXT:
            case ACTION_STD_PREV:
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }
        
        lcd_clear_display();

        struct imx233_power_info_t info = imx233_power_get_info(POWER_INFO_ALL);
        int line = 0;
        unsigned trg, bo;
        bool en;
        int linreg;
        char buf[16];
        
        lcd_putsf(0, line++, "name  value bo linreg");
#define DISP_REGULATOR(name) \
        imx233_power_get_regulator(REGULATOR_##name, &trg, &bo); \
        imx233_power_get_regulator_linreg(REGULATOR_##name, &en, &linreg); \
        if(en) snprintf(buf, sizeof(buf), "%d", linreg); \
        else snprintf(buf, sizeof(buf), " "); \
        lcd_putsf(0, line++, "%6s %4d %4d %s", #name, trg, bo, buf); \

        DISP_REGULATOR(VDDD);
        DISP_REGULATOR(VDDA);
        DISP_REGULATOR(VDDIO);
        DISP_REGULATOR(VDDMEM);
        lcd_putsf(0, line++, "DC-DC: pll: %d   freq: %d", info.dcdc_sel_pllclk, info.dcdc_freqsel);
        lcd_putsf(0, line++, "charge: %d mA  stop: %d mA", info.charge_current, info.stop_current);
        lcd_putsf(0, line++, "charging: %d  bat_adj: %d", info.charging, info.batt_adj);
        lcd_putsf(0, line++, "4.2: en: %d  dcdc: %d", info._4p2_enable, info._4p2_dcdc);
        lcd_putsf(0, line++, "4.2: cmptrip: %d dropout: %d", info._4p2_cmptrip, info._4p2_dropout);
        lcd_putsf(0, line++, "5V: pwd_4.2_charge: %d", info._5v_pwd_charge_4p2);
        lcd_putsf(0, line++, "5V: chargelim: %d mA", info._5v_charge_4p2_limit);
        lcd_putsf(0, line++, "5V: dcdc: %d  xfer: %d", info._5v_enable_dcdc, info._5v_dcdc_xfer);
        lcd_putsf(0, line++, "5V: thr: %d mV use: %d cmps: %d", info._5v_vbusvalid_thr,
            info._5v_vbusvalid_detect, info._5v_vbus_cmps);
        
        lcd_update();
        yield();
    }
}
Ejemplo n.º 26
0
static void usb_screen(void)
{
    lcd_clear_display();
    lcd_puts(0, 0, "USB mode");
    lcd_update();

    usb_acknowledge(SYS_USB_CONNECTED_ACK);
    while(usb_wait_for_disconnect_w_tmo(&button_queue, HZ)) {
    }
}
Ejemplo n.º 27
0
void system_exception_wait(void)
{
    /* make sure lcd and backlight are on */
    lcd_update();
    _backlight_on();
    _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
    /* wait until button release (if a button is pressed) */
    while(button_read_device());
    /* then wait until next button press */
    while(!button_read_device());
}
Ejemplo n.º 28
0
int main(void)
{
	DelayInit();
	init_lcd();
	init_rotary_encoder();
	
	while (1)
	{
		lcd_update();
	}
}
Ejemplo n.º 29
0
void __render_options(uint8_t total, const char* volatile title, char * volatile str_addr){
    uint8_t volatile op = 0;
    FontSelector = f6x8;
    PixelType = 0;
    lcd_clear();
    print_title(title);
    print_std_footer();
    for (op=0; op < total; op++){
      print_string_2((char *) pgm_read_word(str_addr + op*2), 0, 11 + 9*op, op == MenuState->selected_item ? HIGHLIGHT_FULL_LINE : HIGHLIGHT_NONE);  
    }
    lcd_update();
}
Ejemplo n.º 30
0
void display_number(uint32_t value, uint8_t digits)
{
	lcd_clear();
	for (uint8_t i = 0; i < digits; i++)
	{
		uint8_t digit = value % 10;
		value /= 10;
		
		lcd_putc(5 - i, '0' + digit);
	}
	lcd_update();
}