rework #4

Merged
Steins7 merged 88 commits from rework into dev 2024-04-20 18:20:23 +00:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit f0da0cd05c - Show all commits

View File

@ -48,7 +48,7 @@ void gpio_configure(enum GpioPort port, enum GpioPin pin_mask,
}
}
regs->PORTS[port].CRL.word &= ~(0xF * mask);
regs->PORTS[port].CRL.word |= (config << 2) | (mode << 0) * mask;
regs->PORTS[port].CRL.word |= ((config << 2) | (mode << 0)) * mask;
//clear config for selected port, then apply new config, 8 last pins
mask = 0;
@ -61,7 +61,7 @@ void gpio_configure(enum GpioPort port, enum GpioPin pin_mask,
}
}
regs->PORTS[port].CRH.word &= ~(0xF * mask);
regs->PORTS[port].CRH.word |= (config << 2) | (mode << 0) * mask;
regs->PORTS[port].CRH.word |= ((config << 2) | (mode << 0)) * mask;
}
void gpio_reset(enum GpioPort port, enum GpioPin pin_mask)
@ -85,3 +85,4 @@ bool gpio_read(enum GpioPort port, enum GpioPin pin_mask)
//--local functions-------------------------------------------------------------

View File

@ -55,8 +55,9 @@ enum GpioPin {
};
/**
* Available modes for a pin. To have a pin in both modes simultaneously, see
* push-pull configuration in input mode
* Available modes for a pin. To have a pin in both modes simultaneously, use
* push-pull configuration in input mode but note that the power may be
* limited
*/
enum GpioMode {
GPIO_MODE_INPUT = 0,
@ -66,7 +67,7 @@ enum GpioMode {
};
/**
* Available configurations for a pin. Some configurations onlly apply in input
* Available configurations for a pin. Some configurations only apply in input
* mode (denoted "IN") while others only apply in output mode (denoted "OUT")
*/
enum GpioConfig {
@ -115,3 +116,4 @@ bool gpio_read(enum GpioPort port, enum GpioPin pin_mask);
#endif //_RCC_H_