26 lines
567 B
C
26 lines
567 B
C
|
|
#include <stdbool.h>
|
|
|
|
#include <hardware/structs/iobank0.h>
|
|
#include <hardware/gpio.h>
|
|
|
|
#include "zap_pinout.h"
|
|
|
|
#include "zap_gpio.h"
|
|
|
|
void zap_gpio_init(bool init_pins_as_gpio, bool enable) {
|
|
gpio_put(ZAP_GPIO_ENABLE, enable);
|
|
gpio_set_dir(ZAP_GPIO_ENABLE, GPIO_OUT);
|
|
gpio_set_function(ZAP_GPIO_ENABLE, GPIO_FUNC_SIO);
|
|
|
|
if (init_pins_as_gpio) {
|
|
// don't use them as output yet
|
|
sio_hw->gpio_oe_clr = ZAP_GPIO_MASK;
|
|
for (int i = ZAP_GPIO_BASE; i <= ZAP_GPIO_END; ++i) {
|
|
gpio_set_pulls(i, false, false);
|
|
gpio_set_function(i, GPIO_FUNC_SIO);
|
|
}
|
|
}
|
|
}
|
|
|