2019-08-30 09:15:00 +00:00
|
|
|
#include "gpio.h"
|
|
|
|
|
2019-09-07 19:47:43 +00:00
|
|
|
#include <stm32f37x_conf.h>
|
2019-08-30 09:15:00 +00:00
|
|
|
|
2019-09-02 11:41:24 +00:00
|
|
|
|
2019-08-30 09:15:00 +00:00
|
|
|
void GPIO::Init() {
|
|
|
|
GPIO_InitTypeDef gpio_init;
|
|
|
|
|
2019-09-02 11:41:24 +00:00
|
|
|
gpio_init.GPIO_Pin = PIN_RST_OLED | PIN_SS_DAC0 | PIN_SS_DAC1 | PIN_RST_USB | PIN_SS_USB | PIN_SS_OLED | PIN_SDC_OLED;
|
2019-08-30 09:15:00 +00:00
|
|
|
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
|
|
|
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
|
|
|
|
GPIO_Init(GPIOB, &gpio_init);
|
|
|
|
|
|
|
|
gpio_init.GPIO_Pin = PIN_GATE_OUT_1 | PIN_GATE_OUT_2 | PIN_GATE_OUT_3 | PIN_GATE_OUT_4 | PIN_GATE_OUT_5 | PIN_GATE_OUT_6;
|
|
|
|
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
|
|
|
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
|
|
|
|
GPIO_Init(GPIOA, &gpio_init);
|
2019-09-02 11:41:24 +00:00
|
|
|
|
|
|
|
Write(GPIO_PIN(SS_DAC0), Bit_SET);
|
|
|
|
Write(GPIO_PIN(SS_DAC1), Bit_SET);
|
|
|
|
Write(GPIO_PIN(SS_USB), Bit_SET);
|
|
|
|
Write(GPIO_PIN(SS_OLED), Bit_SET);
|
2019-08-30 09:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPIO::Write(GPIO_TypeDef* port, uint16_t pin, bool state) {
|
2019-08-30 11:07:08 +00:00
|
|
|
GPIO_WriteBit(port, pin, static_cast<BitAction>(state));
|
2019-08-30 09:15:00 +00:00
|
|
|
}
|