From bc77939db197d201eefede488e5bbfafc802f3b4 Mon Sep 17 00:00:00 2001 From: prosper00 <57373245+prosper00@users.noreply.github.com> Date: Wed, 24 May 2023 11:32:00 -0600 Subject: [PATCH] Update wiring.c --- examples/GPIO_analogRead/wiring.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/examples/GPIO_analogRead/wiring.c b/examples/GPIO_analogRead/wiring.c index d696857..e0acde1 100644 --- a/examples/GPIO_analogRead/wiring.c +++ b/examples/GPIO_analogRead/wiring.c @@ -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); -- GitLab