Buttons: Change return value of board_buttons() and the type of btn_buttonset_t to uint32_t so that more than 8 buttons can be supported.

This commit is contained in:
Gregory Nutt
2017-04-09 07:22:49 -06:00
parent 5a0636d8bc
commit f9e402018b
77 changed files with 125 additions and 153 deletions
+2 -2
View File
@@ -126,9 +126,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t retval; uint32_t retval;
retval = at32uc3_gpioread(PINMUX_GPIO_BUTTON1) ? 0 : BUTTON1; retval = at32uc3_gpioread(PINMUX_GPIO_BUTTON1) ? 0 : BUTTON1;
retval |= at32uc3_gpioread(PINMUX_GPIO_BUTTON2) ? 0 : BUTTON2; retval |= at32uc3_gpioread(PINMUX_GPIO_BUTTON2) ? 0 : BUTTON2;
+2 -2
View File
@@ -120,9 +120,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -79,9 +79,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key. A low value will be sensed when the /* Check that state of each key. A low value will be sensed when the
* button is pressed. * button is pressed.
+2 -2
View File
@@ -104,9 +104,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+1 -1
View File
@@ -77,7 +77,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return 0; return 0;
} }
+2 -2
View File
@@ -103,9 +103,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+1 -13
View File
@@ -49,18 +49,6 @@
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -77,7 +65,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return 0; return 0;
} }
+1 -13
View File
@@ -49,18 +49,6 @@
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -77,7 +65,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return 0; return 0;
} }
+1 -1
View File
@@ -168,7 +168,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return inp(EZ80_PB_DDR) & 7; return inp(EZ80_PB_DDR) & 7;
} }
+2 -2
View File
@@ -91,9 +91,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key. A LOW value means that the key is pressed, */ /* Check that state of each key. A LOW value means that the key is pressed, */
+2 -2
View File
@@ -92,9 +92,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
if (kinetis_gpioread(GPIO_SW2)) if (kinetis_gpioread(GPIO_SW2))
{ {
+2 -2
View File
@@ -96,9 +96,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
if (kinetis_gpioread(GPIO_SW2)) if (kinetis_gpioread(GPIO_SW2))
{ {
+2 -2
View File
@@ -79,9 +79,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
bool pinValue; bool pinValue;
/* Check that state of each key */ /* Check that state of each key */
+1 -1
View File
@@ -74,7 +74,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
/* The KwikStik-K40 board has no standard GPIO contact buttons */ /* The KwikStik-K40 board has no standard GPIO contact buttons */
@@ -159,7 +159,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return tms570_gioread(GIO_BUTTON) ? BUTTON_GIOA7_BIT : 0; return tms570_gioread(GIO_BUTTON) ? BUTTON_GIOA7_BIT : 0;
} }
+2 -2
View File
@@ -127,9 +127,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -126,9 +126,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -129,10 +129,10 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
#if 0 /* Not yet implemented */ #if 0 /* Not yet implemented */
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -94,9 +94,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
if (hcs12_gpioread(NE64BADGE_BUTTON1)) if (hcs12_gpioread(NE64BADGE_BUTTON1))
{ {
+1 -1
View File
@@ -77,7 +77,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0; return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0;
} }
+1 -1
View File
@@ -88,7 +88,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
/* Check the state of the USER button. A LOW value means that the key is /* Check the state of the USER button. A LOW value means that the key is
* pressed. * pressed.
+1 -1
View File
@@ -78,7 +78,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
/* Check that state of each USER button. A LOW value means that the key is /* Check that state of each USER button. A LOW value means that the key is
* pressed. * pressed.
+1 -1
View File
@@ -78,7 +78,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
/* Check that state of each USER button. A LOW value means that the key is /* Check that state of each USER button. A LOW value means that the key is
* pressed. * pressed.
@@ -125,9 +125,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret; uint32_t ret;
int i; int i;
/* Check each button */ /* Check each button */
@@ -130,9 +130,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
@@ -96,9 +96,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key */ /* Check that state of each key */
@@ -96,9 +96,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key */ /* Check that state of each key */
@@ -96,9 +96,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key */ /* Check that state of each key */
@@ -102,9 +102,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key */ /* Check that state of each key */
@@ -104,9 +104,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -112,9 +112,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
if ((getreg16(STR71X_GPIO0_PD) & STR71X_WAKEUPBUTTON_GPIO0) != 0) if ((getreg16(STR71X_GPIO0_PD) & STR71X_WAKEUPBUTTON_GPIO0) != 0)
{ {
+1 -1
View File
@@ -102,7 +102,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return stm32_gpioread(BUTTON_BOOT0n) ? 0 : BUTTON_BOOT0_MASK; return stm32_gpioread(BUTTON_BOOT0n) ? 0 : BUTTON_BOOT0_MASK;
} }
+2 -2
View File
@@ -149,9 +149,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+1 -1
View File
@@ -84,7 +84,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
# warning Missing logic # warning Missing logic
} }
+1 -1
View File
@@ -66,7 +66,7 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
/* Check the state of the only button */ /* Check the state of the only button */
@@ -105,9 +105,9 @@ void board_button_initialize(void)
* Name: board_buttons * Name: board_buttons
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t ret = 0; uint32_t ret = 0;
int i; int i;
/* Check that state of each key */ /* Check that state of each key */
+2 -2
View File
@@ -133,9 +133,9 @@ void board_button_initialize(void)
* *
************************************************************************************/ ************************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t retval; uint32_t retval;
retval = sam_gpioread(GPIO_BUTTON1) ? 0 : BUTTON1; retval = sam_gpioread(GPIO_BUTTON1) ? 0 : BUTTON1;
retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : BUTTON2; retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : BUTTON2;
+2 -2
View File
@@ -135,9 +135,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t retval; uint32_t retval;
retval = sam_gpioread(GPIO_SCROLLUP) ? 0 : BUTTON_SCROLLUP; retval = sam_gpioread(GPIO_SCROLLUP) ? 0 : BUTTON_SCROLLUP;
retval |= sam_gpioread(GPIO_SCROLLDWN) ? 0 : BUTTON_SCROLLDOWN; retval |= sam_gpioread(GPIO_SCROLLDWN) ? 0 : BUTTON_SCROLLDOWN;
+1 -5
View File
@@ -53,10 +53,6 @@
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -88,7 +84,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+1 -1
View File
@@ -86,7 +86,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+1 -1
View File
@@ -85,7 +85,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_gpioread(GPIO_BP2) ? 0 : BUTTON_BP2_BIT; return sam_gpioread(GPIO_BP2) ? 0 : BUTTON_BP2_BIT;
} }
+1 -1
View File
@@ -96,7 +96,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT; return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
} }
+1 -1
View File
@@ -100,7 +100,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_pioread(PIO_USER) ? 0 : BUTTON_USER_BIT; return sam_pioread(PIO_USER) ? 0 : BUTTON_USER_BIT;
} }
+1 -1
View File
@@ -100,7 +100,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_pioread(PIO_USER1) ? 0 : BUTTON_USER1_BIT; return sam_pioread(PIO_USER1) ? 0 : BUTTON_USER1_BIT;
} }
+1 -1
View File
@@ -96,7 +96,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT; return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
} }
+1 -1
View File
@@ -85,7 +85,7 @@ void board_button_initialize(void)
* *
************************************************************************************/ ************************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT; return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+1 -1
View File
@@ -85,7 +85,7 @@ void board_button_initialize(void)
* *
************************************************************************************/ ************************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT; return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+1 -1
View File
@@ -147,7 +147,7 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+1 -1
View File
@@ -85,7 +85,7 @@ void board_button_initialize(void)
* *
************************************************************************************/ ************************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT; return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
} }
+2 -2
View File
@@ -163,9 +163,9 @@ void board_button_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
uint8_t board_buttons(void) uint32_t board_buttons(void)
{ {
uint8_t retval; uint32_t retval;
retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT; retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT;

Some files were not shown because too many files have changed in this diff Show More