コード例 #1
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Initializes board Button(s) */
static void Board_BTN_Init(void)
{
    pinmux_t buttons[] = { ONBOARD_BTNS };
    Chip_GPIO_Init(LPC_GPIO_PORT);
    for (int i = 0; i < (sizeof(buttons)/sizeof(buttons[0])); i++)
    {
        Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, TO_PORT(buttons[i]), TO_PIN(buttons[i]));
    }
}
コード例 #2
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Initializes board LED(s) */
static void Board_LED_Init(void)
{
    pinmux_t leds[] = { ONBOARD_LEDS };
    Chip_GPIO_Init(LPC_GPIO_PORT);
    for (int i = 0; i < (sizeof(leds)/sizeof(leds[0])); i++)
    {
        Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, TO_PORT(leds[i]), TO_PIN(leds[i]));
    }
}
コード例 #3
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
void BOARD_assert(const char *file, const int line)
{
    /* NOTE: If LED 24 (the one next to power supply connector) blinks, 
     * it means that your application has some serious issues */

    /* IOCON and GPIO doesn't have to be enabled at this point */
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
    Chip_GPIO_Init(LPC_GPIO_PORT);
    /* set mux and output direction */
    Chip_IOCON_PinMuxSet(LPC_IOCON, TO_PORT(ONBOARD_ASSERT_LED), TO_PIN(ONBOARD_ASSERT_LED), ONBOARDCFG_ASSERT_LED);
    Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, TO_PORT(ONBOARD_ASSERT_LED), TO_PIN(ONBOARD_ASSERT_LED));
    /* blink forever. the speed depends on core clock settings */
    for (volatile int i = 1; i; )
    {
        Board_LED_SetLevel(ONBOARD_ASSERT_LED, true);
        for (volatile int k = 500000; k; k--) __asm("nop");
        Board_LED_SetLevel(ONBOARD_ASSERT_LED, false);
        for (volatile int k = 500000; k; k--) __asm("nop");
    }
}
コード例 #4
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Get the GPIO level of board Button */
bool Board_BTN_GetLevel(pinmux_t pinmux)
{
    return Chip_GPIO_ReadPortBit(LPC_GPIO_PORT, TO_PORT(pinmux), TO_PIN(pinmux));
}
コード例 #5
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Set the GPIO level of board LED */
void Board_LED_SetLevel(pinmux_t pinmux, bool high)
{
    Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, TO_PORT(pinmux), TO_PIN(pinmux), high);
}
コード例 #6
0
ファイル: tm4c_gpio.c プロジェクト: chmeeedalf/chaos
int gpio_get(int pin)
{
	return MAP_GPIOPinRead(TO_BASE(pin), TO_PIN(pin));
}
コード例 #7
0
ファイル: tm4c_gpio.c プロジェクト: chmeeedalf/chaos
void gpio_set(int pin, int value)
{
	value = !!value;

	MAP_GPIOPinWrite(TO_BASE(pin), TO_PIN(pin), (value << TO_PIN(pin)));
}