none
Keypad SysIntr or GPIO SysIntr ? RRS feed

  • Question

  • Hello!

    I have attached a Keypad on the development board (PortA). I would read this using interrupts.

    As i have seen, i can define a SYSINTR_KEYPAD for the keypad, but then there must be an analysation in OEMInterruptHandler which PINs are used for the keypad to send the SYSINTR_KEYPAD - right ?

    Or i can use normal GPIO interrupts, but the i have more work in the driver, since i have to do a KernelIoControl/InterruptInitialize/InterruptDone for each input PIN of the kaypad (as seen in Matrix Keypad) ?

    Tuesday, February 8, 2011 2:38 PM

All replies

  • "on the development board (PortA)" of what have you connected the keypad? A bit more of info would help to figure out the scenario.

    I imagine that PortA is a set of digital IN which you connect a device -the keypad- with a set of digital OUT (one for each key or a matrix).

    I imagine that digital IN toggling will trigger an interrupt (on edge or level), maybe a different one for each IN or only one for the whole port: in the latter case, if

    OEMInterruptHandler is already setup to handle GPIO interrupts, for example returning SYSINTR_PORTA, well SYSINTR_KEYP == SYSINTR_PORTA and in the driver

    you have to figure out which line has moved. In any case if your driver has an IST you have to deal with InterruptInitialize/InterruptDone

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Tuesday, February 8, 2011 2:59 PM
  • Its a standard 3x4 keypad (3 columns, 4 rows).
    The columns are connected to PIO pins configured as input with interrupts (+ external pull-up's).
    The port and pin's used for the keypad is stored in the registry, so the configuration is not fix.

    Therefore i can use a SYSINTR_KEYPAD (pins for the keypad are masked in OEMInterruptHandler returning a SYSINTR_KEYPAD)
    or i use normal GPIO's (so there would be a KernelIoControl/InterruptInitialize/InterruptDone for every interrupt input pin in the driver)

    I do not have a SYSINTR_PORTx since i have a SYSINTR_PINx for every pin.

    But if i want to develop a standard windows ce keyboard driver (using layout manager interface)
    i have to use a SYSINTR_KEYPAD (for structure KEYBD_IST) ?

    Wednesday, February 9, 2011 7:51 AM
  • If the ports/pins were fixed you may modify OEMInterruptHandler so it returns SYSINTR_KEYPAD when it processes the GPIO IRQ related to the keypad connected PIO.

    If you want to be able to use different ports/pins you may do something like read the config from the registry and InterruptInitialize the SYSINTR for each pin; when those IST's are signalled they will call SetEvent which will trigger the main IST (not actually tied to an event connected to a SYSINTR): every time it will read the PIO's to detect the current keypad status etc


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, February 9, 2011 8:13 AM
  • Thanks - the reading from the registry is already done and the keypad works (currently without interrupt, polling mode for test)

    So if i want to develop a standard windows ce keyboard driver (using layout manager interface) i should use a SYSINTR_KEYPAD (in the structure KEYBD_IST there is space for exact one SYSINTR) ?

    Wednesday, February 9, 2011 8:40 AM
  • the standard PS2 keyboard driver reads the SYSINTR value from the registry and the upper layer IST once is triggered will call the PDD layer IST (that you have to write). If you want to be consistent with this you need to return the same SYSINTR value every time a PIO IRQ related to the keypad is triggered.  It's up to you define the value of such SYSINTR: the SYSINTR_KEYPAD you're talking could be related to something different (a keypad for an evaluation board with the same processor). In addition: which SYSINTR return respect to the IRQ is hardcoded in OEMInterruptHandler so, if you change ports/pins you need to modify it


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, February 9, 2011 11:18 AM
  • >> If you want to be consistent with this you need to return the same SYSINTR value every time a PIO IRQ related to the keypad is triggered.

    This is what i mean with : "As i have seen, i can define a SYSINTR_KEYPAD for the keypad, but then there must be an analysation in OEMInterruptHandler which PINs are used for the keypad to send the SYSINTR_KEYPAD - right ?"

    Wednesday, February 9, 2011 1:14 PM