#ifndef DRILL_SAFE_GPIO_H
#define DRILL_SAFE_GPIO_H

#include <stdbool.h>
#include <stdint.h>

#define DRILL_SAFE_GPIO_PORTS 3u

typedef struct {
    volatile uint32_t *moder;
    volatile uint32_t *otyper;
    volatile uint32_t *ospeedr;
    volatile uint32_t *pupdr;
    volatile uint32_t *bsrr;
    uint16_t output_mask;
    uint16_t high_mask;
} drill_safe_gpio_port;

typedef struct {
    drill_safe_gpio_port port[DRILL_SAFE_GPIO_PORTS];
} drill_safe_gpio_set;

bool drill_safe_gpio_validate(const drill_safe_gpio_set *set);
bool drill_safe_gpio_preload(const drill_safe_gpio_set *set);
bool drill_safe_gpio_configure_outputs(const drill_safe_gpio_set *set);

#endif
