summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-05-15 16:17:46 +0700
committerhathach <[email protected]>2019-05-15 16:17:46 +0700
commit9863230a8d38ddefe6cb421c8bc7417abfdf724f (patch)
treea07a7cdd03e40575693b3dcf068fbfa7d50099fd /hw
parent2d58f3118e4dff3760f4c563f351dc0f02738770 (diff)
update button for mcb1800
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/mcb1800/board_mcb1800.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/hw/bsp/mcb1800/board_mcb1800.c b/hw/bsp/mcb1800/board_mcb1800.c
index db3b84d9b..a16a41082 100644
--- a/hw/bsp/mcb1800/board_mcb1800.c
+++ b/hw/bsp/mcb1800/board_mcb1800.c
@@ -27,10 +27,12 @@
#include "chip.h"
#include "../board.h"
+// PD_10
#define LED_PORT 6
#define LED_PIN 24
-#define BUTTON_PORT 4
+// P4_0
+#define BUTTON_PORT 2
#define BUTTON_PIN 0
@@ -43,7 +45,7 @@ const uint32_t ExtRateIn = 0;
static const PINMUX_GRP_T pinmuxing[] =
{
- /* Board LEDs */
+ // LEDs
{0xD, 10, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
{0xD, 11, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
{0xD, 12, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
@@ -53,6 +55,9 @@ static const PINMUX_GRP_T pinmuxing[] =
{0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
{0x9, 2, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
+ // Button
+ {0x4, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLUP)},
+
/* I2S */
{0x3, 0, (SCU_PINIO_FAST | SCU_MODE_FUNC2)},
{0x6, 0, (SCU_PINIO_FAST | SCU_MODE_FUNC4)},
@@ -93,6 +98,9 @@ void board_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
Chip_GPIO_Init(LPC_GPIO_PORT);
@@ -189,11 +197,8 @@ void board_led_write(bool state)
uint32_t board_button_read(void)
{
- uint32_t result = 0;
-
-// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) result |= (button_read(i) ? TU_BIT(i) : 0);
-
- return result;
+ // active low
+ return Chip_GPIO_GetPinState(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN) ? 0 : 1;
}