- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Platform: CYW920719Q40EVB-01
IDE: Wiced Studio 6.2.1
Question 1:
I'm trying to solve this problem, but I can't understand how to configure GPIO for Matrix keys. From below the API
Is there any predefined GPIOs which are used for Matrix key interface?
/////////////////////////////////////////////////////////////////////
/// Configure GPIOs for keyscan operation. Note that only GPIOs
/// that are in the matrix are configured for keyscan operation.
/// GPIOs that are not part of the scan matrix are left alone.
///
/// \param -none
///
/// \return - none
/////////////////////////////////////////////////////////////////////
void wiced_hal_keyscan_config_gpios(void);
//======================================================================================================
Question 2:
Is it a write way to read any keypress event for 4x4 keypad?
What I am trying is, connecting a 4x4 matrix keypad with CYW920719Q40EVB-01 dev kit on J3 -J4 connector from D0 - D8 (where D3 NC) ,
And configured pins for 4x4 Matrix keypad, where D0 - D8 are mapped to pins of chip i.e. D0: P34, D1: P33, D2: P00 ... .. D8: P06
and then trying to read if any key press ? like if P34 pin is detected pressed I want to print 1 Num Pressed in debug log. if P33 then 2 num is pressed and so on.
APIs I might need to start with .
/* matrix keypad Mia driver intruupt init*/
wiced_hal_mia_enable_mia_interrupt(TRUE);
wiced_hal_mia_enable_lhl_interrupt(TRUE);//GPIO interrupt
/* matrix keypad Keyscan driver init*/
wiced_hal_keyscan_configure(KEYSCAN_ROWS, KEYSCAN_COLS); // (4,4)
wiced_hal_keyscan_init();
And by using wiced_hal_keyscan_is_any_key_pressed() function confirming if any keypress event generated or not.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
1. We register a callback function using wiced_hal_keyscan_register_for_event_notification() API to detect the interrupt and process it.
2. You need to read the Key code. This is the location in the keyscan matrix that is pressed/released.
May be implemented as ((row * numCols) + col) or ((col * numRows) + row.
BYTE keyCode;
3. I believe you need to configure WICED sleep in your app. Please check wiced_sleep.h for related APIs.
Q) "When I press a key from Matrix Keypad , I don't get any event. But when I press the On Board Button (02) I can see below log on comport:".
->I doubt there is some logical issue in the application code. I may need to see the code to confirm it.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Platform: CYW920719Q40EVB-01
IDE: Wiced Studio 6.2.1
Question 1:
I'm trying to solve this problem, but I can't understand how to configure GPIO for Matrix keys. From below the API
Is there any predefined GPIOs which are used for Matrix key interface?
/////////////////////////////////////////////////////////////////////
/// Configure GPIOs for keyscan operation. Note that only GPIOs
/// that are in the matrix are configured for keyscan operation.
/// GPIOs that are not part of the scan matrix are left alone.
/// \param -none
/// \return - none
/////////////////////////////////////////////////////////////////////
void wiced_hal_keyscan_config_gpios(void);
Solved:
I had configured the pins using "Supermux Configurator", for External 4x4 Keypad pins connected to J3-J4 connector of CYW920719Q40EVB-01 Developmentkit
Pin mapping as below:
Columns : Dev kit 4x4Matrix Kypad Rows: Dev Kit 4x4 Matrix Keypad
D5(P26) pin1 D10(P07) pin5
D6(P02) pin2 D11(P28) pin6
D6(P04) pin3 D12(P01) pin7
D6(P06) pin4 D13(P38) pin8
Note: here D5,D6 is on board connector references and P26,P02 i.e. Wiced 26 Wiced 02 etc..
/* matrix keypad Mia driver intruupt init*/
wiced_hal_mia_enable_mia_interrupt(TRUE);
wiced_hal_mia_enable_lhl_interrupt(TRUE);//GPIO interrupt
/* matrix keypad Keyscan driver init*/
wiced_hal_keyscan_configure(KEYSCAN_ROWS, KEYSCAN_COLS); // (4,4)
wiced_hal_keyscan_init();
wiced_hal_keyscan_register_for_event_notification(Key_Detect,NULL);
void Key_Detect()
{
keyStat = wiced_hal_keyscan_is_any_key_pressed();
WICED_BT_TRACE("Key_Detect, Key Status::%d\n",keyStat);
}
When I press a key from Matrix Keypad , I dont get any event. But when I press the On Board Button (02) I can see below log on comport:
Serial Capture Log:
Key_Detect, Key Status:: 1
Key_Detect, Key Status:: 1
Key_Detect, Key Status:: 1
Key_Detect, Key Status:: 1
.
.
.
.
Key_Detect, Key Status:: 0
Key_Detect, Key Status:: 0
Key_Detect, Key Status:: 0
Key_Detect, Key Status:: 0
.
.
Callback function is continually calling...
===============================================================
Queries:
(1) How do I get the interrupt/event if a key pressed from external "Matrix keypad"?
(2) How will I know which key has been pressed from Matrix keypad? How do I get the Keycode?
(3) Can it possioble to wake a device from matrix key press event ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
1. We register a callback function using wiced_hal_keyscan_register_for_event_notification() API to detect the interrupt and process it.
2. You need to read the Key code. This is the location in the keyscan matrix that is pressed/released.
May be implemented as ((row * numCols) + col) or ((col * numRows) + row.
BYTE keyCode;
3. I believe you need to configure WICED sleep in your app. Please check wiced_sleep.h for related APIs.
Q) "When I press a key from Matrix Keypad , I don't get any event. But when I press the On Board Button (02) I can see below log on comport:".
->I doubt there is some logical issue in the application code. I may need to see the code to confirm it.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please have a look at the attached wiced example...
I made some changes to the sample code to make it suitable for Matrix 4x4 keyboard.
Looking forward to your guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What does the function "wiced_hal_keyscan_config_gpios()" do?
I don't see any critical logical issues on an initial check. But not sure anything is breaking in between, since you have combined hello_client and keyboard apps together.
You can refer the "HAL Keyboard Scanner" for verifying the matrix keyboard scan logic. (Note: this particular app works on latest Modustoolbox). GitHub - cypresssemiconductorco/mtb-example-btsdk-cyw208xx-keyboard-scanner: This code example demon...
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you !