Library for matrix keyboard using ESP-IDF framework
It needed just 4 simple steps to use this library:
- Copy the
keypad_espidf.h
andkeypad_espidf.c
to your project; - Set your keypad settings by using the
keypad_settings_t
structure; - Install it with
keypad_install(keypad_settings_t *)
; - Use the income information with the
.queue
in the settings and FreeRTOS Queue.
Before start using your keyboard or even install it, a structure needs to be set with all configuration of your keypad.
keypad_settings_t
num_row_layout
= Number of rows of the layoutnum_col_layout
= Number of columns of the layoutlayout
= Keypad layout in 2 dimensionsnum_gpio_out
= Number of output GPIOsnum_gpio_in
= Number of input GPIOsgpio_output
= Pointer for the output GPIOs arraygpio_input
= Pointer for the input GPIOs arrayfrequency
= Scan frequency in Hzlast_output
= Last order in output dimensionlast_input
= Last order in input dimensionqueue
= Queue to send this structure
After that, the installation is needed. To do so, the functions keypad_install(keypad_settings_t *)
is called and the keypad configuration passed to the library. Here are setted the output and input pins, create the keypad queue, create the sequency task to scan each output, install the ISR and set the interrupt handler for each input pin.
The keypad_sequency_task(void *)
makes a sequency for each output pin, by switching every pin in high level and just the select one in low. During the task is working, the ISR handler is active to store the last input pin and than send it to the keypad queue.
- Write a macro to set default setting to the commum membrane keypad 4x4