#include "gpio.h"

#include "ch32v003fun.h"

void init_gpio(void) {
  // Enable clock for GPIOB
  RCC->APB2PCENR |= RCC_APB2Periph_GPIOB;

  // GPIOB Configuration: Pins 3 and 4 as Output, Push-Pull, 10MHz
  GPIOB->CFGLR &= ~((0xF << (4 * 3)) | (0xF << (4 * 4)));
  GPIOB->CFGLR |= ((GPIO_Speed_10MHz | GPIO_CNF_OUT_PP) << (4 * 3)) |
                  ((GPIO_Speed_10MHz | GPIO_CNF_OUT_PP) << (4 * 4));
}
