Exemple #1
0
keypad_t
keypad_alloc(void)
{
    keypad_t nv = ipmi_mem_alloc(sizeof(*nv));
    int      i;

    if (nv) {
	memset(nv, 0, sizeof(*nv));
	for (i=0; i<NUM_KEY_ENTRIES; i++) {
	    nv->keys[i] = alloc_ilist();
	    if (!nv->keys[i])
		goto out_err;
	}
    }

    return nv;

 out_err:
    keypad_free(nv);
    return NULL;
}
Exemple #2
0
int main(void) {
    uint8_t i;

    keypad_init();
    led_init();
    status_init();
    layers_init();

    for (i=0; i<8; i++) led_send_command(i+1,0x00);

    wdt_enable(WDTO_1S);
    /* Even if you don't use the watchdog, turn it off here. On newer devices,
     * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!
     */
    /* RESET status: all port bits are inputs without pull-up.
     * That's the way we need D+ and D-. Therefore we don't need any
     * additional hardware initialization.
     */
    odDebugInit();
    usbInit();
    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */
    i = 0;
    while(--i){             /* fake USB disconnect for > 250 ms */
        wdt_reset();
        _delay_ms(1);
    }
    usbDeviceConnect();

    sei();
    DBG1(0x01, 0, 0);       /* debug output: main loop starts */
    for(;;){                /* main event loop */
        wdt_reset();
        usbPoll();
    }

    keypad_free();
    layers_free();

    return 0;
}