Skip to content
Snippets Groups Projects
Unverified Commit bc77939d authored by prosper00's avatar prosper00 Committed by GitHub
Browse files

Update wiring.c

parent 6b94eca6
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,9 @@
enum GPIOports getPort (enum GPIOpins pin) {
if (pin <= pin_A7) {
if (pin <= pin_A2) {
return port_A;
}
else if (pin <= pin_B7) {
return port_B;
}
else if (pin <= pin_C7) {
return port_C;
}
......@@ -29,8 +26,6 @@ void portEnable(enum GPIOports port) {
case port_A:
RCC->APB2PCENR |= RCC_APB2Periph_GPIOA;
break;
case port_B:
break;
case port_C:
RCC->APB2PCENR |= RCC_APB2Periph_GPIOC;
break;
......@@ -43,6 +38,7 @@ void portEnable(enum GPIOports port) {
}
void pinMode(enum GPIOpins pin, enum GPIOpinMode mode) {
GPIO_TypeDef * GPIOx;
uint16_t PinOffset;
......@@ -54,7 +50,7 @@ void pinMode(enum GPIOpins pin, enum GPIOpinMode mode) {
uint8_t target_pin_state = pinState_nochange; // by default, pin shall retain its state
uint8_t modeMask = 0; // configuration mask // configuration mask
uint8_t modeMask = 0; // configuration mask
switch (mode) {
case pinMode_I_floating:
......@@ -105,10 +101,6 @@ void digitalWrite(enum GPIOpins pin, uint8_t value) {
GPIOx = GPIOA;
PinOffset = pin;
}
else if (pin <= pin_B7) { /* GPIOB doesn't exist (yet?)
GPIOx = GPIOB;
PinOffset = (pin - 8); */
}
else if (pin <= pin_C7) {
GPIOx = GPIOC;
PinOffset = (pin - 16);
......@@ -139,10 +131,6 @@ uint8_t digitalRead(uint8_t pin) {
GPIOx = GPIOA;
PinOffset = pin;
}
else if (pin <= pin_B7) { /* GPIOB doesn't exist (yet?)
GPIOx = GPIOB;
PinOffset = (pin - 8); */
}
else if (pin <= pin_C7) {
GPIOx = GPIOC;
PinOffset = (pin - 16);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment