Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Skool_wkshp_lib2015 by
Diff: keypad.cpp
- Revision:
- 1:68d1a8c4970b
- Parent:
- 0:3ad0af8abf43
--- a/keypad.cpp Fri Sep 25 13:48:39 2015 +0000
+++ b/keypad.cpp Thu Oct 01 19:17:25 2015 +0000
@@ -98,13 +98,15 @@
HAL_GPIO_WritePin(GPIOC, cols[0] | cols[1] | cols[2], GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, cols[1], GPIO_PIN_RESET);
wait_ms(25);
- temp = (GPIOC->IDR & 0x0160);
+ temp = (GPIOC->IDR & 0x0360);
switch (temp) {
- case 0x0140: retval = 0x01;
+ case 0x0340: retval = 0x01;
break;
- case 0x0120: retval = 0x05;
+ case 0x0320: retval = 0x05;
break;
- case 0x0060: retval = 0x09;
+ case 0x0260: retval = 0x09;
+ break;
+ case 0x0160: retval = 0x0D;
break;
default: retval = 0xFF;
break;
@@ -112,7 +114,8 @@
HAL_GPIO_WritePin(GPIOC, cols[0] | cols[1] | cols[2], GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, cols[2], GPIO_PIN_RESET);
wait_ms(25);
- if ((GPIOC->IDR & 0x0200) == 0x0000) retval = 0x0E;
+ temp = (GPIOC->IDR & 0x0360);
+ if (temp == 0x0160) {retval = 0x0E;}
}
// Wait for the release of the key
HAL_GPIO_WritePin(GPIOC, cols[0] | cols[1] | cols[2], GPIO_PIN_SET);
