You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/bsl/csl/stm32f042/Src/gpio.cpp

83 lines
905 B

#include "pin.hpp"
#include "../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f042x6.h"
//#include "stm32f042x6.h"
Pin::Pin(){
RCC->AHBENR |= RCC_AHBENR_GPIOBEN;
// Set PIN 3 of port B as Output
GPIOB->MODER |= GPIO_MODER_MODER3_0;
GPIOB->MODER &=~ GPIO_MODER_MODER3_1;
}
Pin::~Pin(){}
void Pin::setMode(mode mode)
{
}
void Pin::setOutputState(state state)
{
}
void Pin::setPullUpDonw(pullUpDown resistance)
{
}
void Pin::setSpeed(speed speed)
{
}
void Pin::config(mode mode, state state, pullUpDown resistance, speed speed)
{
}
bool Pin::read()
{
return 1;
}
bool Pin::toggle()
{
return 1;
}
void Pin::write(bool state)
{
if(state == 1)
{
GPIOB->BSRR |= GPIO_BSRR_BS_3;
return;
}
GPIOB->BSRR |= GPIO_BSRR_BR_3;
}
void Pin::init()
{
}
void Pin::deInit()
{
}
void Pin::hardwareInfo()
{
}
void Pin::throwError(uint16_t line, errors errNo)
{
}