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

Update wiring.c

parent ec065de5
No related branches found
No related tags found
No related merge requests found
......@@ -46,27 +46,10 @@ void portEnable(enum GPIOports port) {
void pinMode(enum GPIOpins pin, enum GPIOpinMode mode) {
GPIO_TypeDef * GPIOx;
uint16_t PinOffset = 0;
uint16_t PinOffset;
if (pin <= pin_A7) {
GPIOx = GPIOA;
PinOffset = pin << 2;
}
else if (pin <= pin_B7) { /* GPIOB doesn't actually exist (yet?)
GPIOx = GPIOB;
PinOffset = (pin-8) << 2; */
}
else if (pin <= pin_C7) {
GPIOx = GPIOC;
PinOffset = (pin - 16) << 2;
}
else if (pin <= pin_D7) {
GPIOx = GPIOD;
PinOffset = (pin - 24) << 2;
}
else {
return;
}
GPIOx = GPIOA+(pin>>3);
PinOffset = (pin & 0x7)<<2;
GPIOx->CFGLR &= ~(0b1111<<PinOffset); // zero the 4 configuration bits
......
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