Exemple #1
0
void main(void)
{
	char buf[]="Hello, Flynix!";

	con_clear();
	printk(buf, 0xff);

	while(1);

}
void con_init(){
  // allocate framebuffer
  con_gfxBuffer=malloc(SCREEN_WIDTH*SCREEN_HEIGHT+64);
  con_gfxBuffer=(char*)(((unsigned int)con_gfxBuffer+32)&0xffffffe0);

  // init struct
  con_gfxStruct.offset=(unsigned int)con_gfxBuffer;
  con_gfxStruct.enable=true;

  con_numLines=(SCREEN_HEIGHT-CON_MARGIN_Y)/CON_FONT->height;
  con_numCols=(SCREEN_REAL_WIDTH-CON_MARGIN_X)/CON_FONT->width;

  con_screenVisible=false;
  con_clear();
}
__IRAM_CODE void btn_processPress(int val)
{
    int btn;
    struct evt_t evt;

    for(btn=0;btn<NB_BUTTONS;btn++)
    {
        if(BTN_NOT_PRESSED(val,btn)) /* the btn is NOT pressed */
        {
            nb_pressed[btn]=0;   /* reset nb_pressed */
            mx_press[btn] = current_repeatParam->init_delay;
            press_step[btn] = 0;
            /*if(btn==BTN_OFF)
                nb_off_press=0;   */ /* if off btn released -> reset nb_off_press */
        }
        else            /* the btn i is pressed */
        {    
            
            /*if(btn==BTN_OFF)  */  /* OFF btn pressed => check if we have to halt */
            /*{
                nb_off_press++;
                if(nb_off_press>MAX_OFF)
                {
                    printk("[OFF button] => halt\n");
                    halt_device();                    
                }
            }*/

            if(nb_pressed[btn]==0)
            {
#ifdef HAVE_FM_REMOTE
                if(!inHold)
                {
#endif
                    switch(press_step[btn])
                    {
                        case 0:
                            press_step[btn] = 1;
                            nb_pressed[btn] = current_repeatParam->init_delay;
                            break;
                        case 1:
                            press_step[btn] = 2;
                            nb_pressed[btn] = current_repeatParam->second_delay;
                            mx_press[btn] = current_repeatParam->second_delay;
                            break;
                        case 2:
                            mx_press[btn] -= current_repeatParam->dec_value;
                            if(mx_press[btn]<current_repeatParam->min_delay)
                                mx_press[btn]=current_repeatParam->min_delay;
                            nb_pressed[btn] = mx_press[btn];
                            break;
                        default:
                            press_step[btn] = 0;
                            mx_press[btn] = current_repeatParam->init_delay;
                    }
#if 0
                    if(lcd_get_state()==0)
                    {
                        /* the lcd is off => turn on and discard the event */
                        lcd_keyPress();
                        break;
                    }
                    else
                        lcd_launchTimer(); /* postpone the lcd timer */
                    halt_launchTimer(); /* postpone the poweroff timer */
#endif

                    if(!con_screenIsVisible())
                    {
                      if (val&BTMASK_F1 && btn+1==BTN_ON) con_screenSwitch();
                      
                      // post the event
                      evt.evt=btn+1;
                      evt.evt_class=BTN_CLASS;
                      evt.data=(void*)mx_press[btn];
                      evt_send(&evt);
                    }
                    else
                    {
                        switch(btn+1)
                        {
                            case BTN_ON:
                                con_screenSwitch();
                                break;
                            case BTN_OFF:
                                con_clear();
                                break;
                            case BTN_UP:
                                con_screenScroll(-1);
                                break;
                            case BTN_DOWN:
                                con_screenScroll(1);
                                break;
                        }
                    }


                    //printk("BTN %d pressed\n",btn);
#ifdef HAVE_FM_REMOTE
                }
                else
                {
                    //FM_putTmpText("** HOLD **",30);
                    printk("** HOLD **\n");
                }
#endif
            }
            else
                nb_pressed[btn]--;
        }
    }
}
Exemple #4
0
void con_start(unsigned int video)
{
    screen = (char *) video;
    con_attr(CON_WHITE);
    con_clear();
}