Example #1
0
void buttons_init()
{
    GpioSetPull(SWITCH1, gpio_pull_up);
    GpioSetInvert(SWITCH1, ON);

    GpioSetPull(SWITCH2, gpio_pull_up);
    GpioSetInvert(SWITCH2, ON);

    GpioSetPull(SWITCH3, gpio_pull_up);
    GpioSetInvert(SWITCH3, ON);

    GpioSetInterrupt(SWITCH1, gpio_interrupt0, gpio_bothedges);
    GpioSetInterrupt(SWITCH2, gpio_interrupt0, gpio_bothedges);
    GpioSetInterrupt(SWITCH3, gpio_interrupt0, gpio_bothedges);
}
Example #2
0
void SystemInit()
{
    //bt reset default HIGH (bt in reset)
    //GpioSetInvert(bt_reset,  ON);
    GpioWrite(bt_reset, HIGH);
    GpioSetDirection(bt_reset, OUTPUT);

    //bt shdn default HIGH (nrf off)
    GpioSetInvert(bt_shdn,  ON);
    GpioWrite(bt_shdn, HIGH);
    GpioSetDirection(bt_shdn, OUTPUT);

    //button setup (High if pressed)
    GpioSetPull(user_button, gpio_pull_up);
    GpioSetInvert(user_button, ON);
    GpioSetDirection(user_button, INPUT);
    //
}