Ejemplo n.º 1
0
static void mpr121_thread(void)
{
    struct queue_event ev;

    while(1)
    {
        queue_wait(&mpr121_queue, &ev);
        /* handle usb connect and ignore all messages except rmi interrupts */
        if(ev.id == SYS_USB_CONNECTED)
        {
            usb_acknowledge(SYS_USB_CONNECTED_ACK);
            continue;
        }
        else if(ev.id != MPR121_INTERRUPT)
            continue;
        /* clear interrupt and get status */
        unsigned status;
        touchpad_btns = 0;
        if(!mpr121_get_touch_status(&status))
        {
            /* ELE3: up
             * ELE4: back
             * ELE5: menu
             * ELE6: down
             * ELE7: play */
            if(status & 0x8) touchpad_btns |= BUTTON_UP;
            if(status & 0x10) touchpad_btns |= BUTTON_BACK;
            if(status & 0x20) touchpad_btns |= BUTTON_MENU;
            if(status & 0x40) touchpad_btns |= BUTTON_DOWN;
            if(status & 0x80) touchpad_btns |= BUTTON_PLAY;
        }
        /* enable interrupt */
        imx233_pinctrl_setup_irq(0, 18, true, true, false, &mpr121_irq_cb, 0);
    }
}
Ejemplo n.º 2
0
/* true after full radio power up, and false before powering down */
void si4700_rds_powerup(bool on)
{
    if(on)
    {
        imx233_pinctrl_acquire(2, 27, "tuner stc/rds");
        imx233_pinctrl_set_function(2, 27, PINCTRL_FUNCTION_GPIO);
        imx233_pinctrl_enable_gpio(2, 27, false);
        /* pin is set to 0 when an RDS packet has arrived */
        imx233_pinctrl_setup_irq(2, 27, true, true, false, &stc_rds_callback, 0);
    }
    else
    {
        imx233_pinctrl_setup_irq(2, 27, false, false, false, NULL, 0);
        imx233_pinctrl_release(2, 27, "tuner stc/rds");
    }
}
Ejemplo n.º 3
0
/* Captures RDS data and processes it */
static void NORETURN_ATTR rds_thread(void)
{
    uint16_t rds_data[4];

    while(true)
    {
        semaphore_wait(&rds_sema, TIMEOUT_BLOCK);
        if(si4700_rds_read_raw(rds_data) && rds_process(rds_data))
            si4700_rds_set_event();
        /* renable callback */
        imx233_pinctrl_setup_irq(2, 27, true, true, false, &stc_rds_callback, 0);
    }
}
Ejemplo n.º 4
0
/* B0P18 is #IRQ line of the touchpad */
void button_init_device(void)
{
    mpr121_init(0xb4);
    mpr121_soft_reset();
    mpr121_set_config(&config);

    queue_init(&mpr121_queue, true);
    create_thread(mpr121_thread, mpr121_stack, sizeof(mpr121_stack), 0,
        mpr121_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU));
    /* enable interrupt */
    imx233_pinctrl_acquire(0, 18, "mpr121_int");
    imx233_pinctrl_set_function(0, 18, PINCTRL_FUNCTION_GPIO);
    imx233_pinctrl_enable_gpio(0, 18, false);
    imx233_pinctrl_setup_irq(0, 18, true, true, false, &mpr121_irq_cb, 0);
    /* generic part */
    imx233_button_init();
}