- // TODO FIXME special port disable ? LEDs BTNs ?
-
- // prepare power
- // TODO FIXME more power init needed ? chrg + volt input ?
- // enable external vcc
- gpioSetDir(RB_PWR_GOOD, gpioDirection_Output);
- gpioSetValue (RB_PWR_GOOD, 0);
-
- // Disable USB Connect (we don't want USB by default)
- gpioSetDir(USB_CONNECT, gpioDirection_Output);
- gpioSetValue(USB_CONNECT, 1);
-
- static uint8_t ports[] = { RB_BTN0, RB_BTN1, RB_BTN2, RB_BTN3, RB_BTN4,
- RB_LED0, RB_LED1, RB_LED2,
- RB_HB3, RB_HB4, RB_SPI_SS2,
- RB_SPI_SS3, RB_SPI_SS4, RB_SPI_SS5,
- RB_HB0, RB_HB1, RB_HB2,
- RB_HB3, RB_HB4, RB_HB5};
-
- volatile uint32_t * regs[] = {&RB_BTN0_IO, &RB_BTN1_IO, &RB_BTN2_IO,
- &RB_BTN3_IO, &RB_BTN4_IO};
-
- int i = 0;
- while( i<10 ){
- gpioSetDir(ports[i], ports[i+1], gpioDirection_Input);
- gpioSetPullup(regs[i/2], gpioPullupMode_PullUp);
- i+=2;
- }
+ RB_HB0_IO &= ~IOCON_SWDIO_PIO1_3_FUNC_MASK;
+ RB_HB0_IO |= IOCON_SWDIO_PIO1_3_FUNC_GPIO;
+ RB_HB1_IO &= ~IOCON_JTAG_TCK_PIO0_10_FUNC_MASK;
+ RB_HB1_IO |= IOCON_JTAG_TCK_PIO0_10_FUNC_GPIO;
+
+ struct {
+ int port;
+ int pin;
+ uint32_t volatile *reg;
+ gpioPullupMode_t mode;
+ } const input_pins[] = {
+#ifdef HOB_REV2
+ { RB_BTN0 , &RB_BTN0_IO , gpioPullupMode_PullDown },
+ { RB_BTN1 , &RB_BTN1_IO , gpioPullupMode_PullDown },
+ { RB_BTN2 , &RB_BTN2_IO , gpioPullupMode_PullDown },
+ { RB_BTN3 , &RB_BTN3_IO , gpioPullupMode_PullDown },
+ { RB_BTN4 , &RB_BTN4_IO , gpioPullupMode_PullDown },
+ { RB_HB0 , &RB_HB0_IO , gpioPullupMode_PullDown },
+ { RB_HB1 , &RB_HB1_IO , gpioPullupMode_PullDown },
+ { RB_PWR_CHRG, &RB_PWR_CHRG_IO, gpioPullupMode_PullDown }
+#else
+ { RB_BTN0 , &RB_BTN0_IO , gpioPullupMode_PullUp },
+ { RB_BTN1 , &RB_BTN1_IO , gpioPullupMode_PullUp },
+ { RB_BTN2 , &RB_BTN2_IO , gpioPullupMode_PullUp },
+ { RB_BTN3 , &RB_BTN3_IO , gpioPullupMode_PullUp },
+ { RB_BTN4 , &RB_BTN4_IO , gpioPullupMode_PullUp },
+ { RB_HB0 , &RB_HB0_IO , gpioPullupMode_PullUp },
+ { RB_HB1 , &RB_HB1_IO , gpioPullupMode_PullUp },
+ { RB_PWR_CHRG, &RB_PWR_CHRG_IO, gpioPullupMode_PullUp }
+#endif
+ };