samd: port: fix coding style

We always use braces.
This commit is contained in:
Karl Palsson 2021-02-03 23:13:00 +00:00
parent 458a0553a8
commit 49327dcdc4
1 changed files with 13 additions and 8 deletions

View File

@ -24,14 +24,17 @@ void gpio_mode_setup(uint32_t gpioport, uint8_t mode, uint8_t cnf, uint32_t gpio
{ {
uint32_t reg = PORT_WRCONFIG_WRPINCFG; uint32_t reg = PORT_WRCONFIG_WRPINCFG;
/* enable pull */ /* enable pull */
if (cnf == GPIO_CNF_PULLDOWN || cnf == GPIO_CNF_PULLUP) if (cnf == GPIO_CNF_PULLDOWN || cnf == GPIO_CNF_PULLUP) {
reg |= PORT_WRCONFIG_PULLEN; reg |= PORT_WRCONFIG_PULLEN;
}
/* enable input buffer */ /* enable input buffer */
if (mode != GPIO_MODE_OUTPUT) if (mode != GPIO_MODE_OUTPUT) {
reg |= PORT_WRCONFIG_INEN; reg |= PORT_WRCONFIG_INEN;
}
/* set pmuxen */ /* set pmuxen */
if (cnf == GPIO_CNF_AF) if (cnf == GPIO_CNF_AF) {
reg |= PORT_WRCONFIG_PMUXEN; reg |= PORT_WRCONFIG_PMUXEN;
}
/* PORTx_WRCONFIG allows to configure pins [31:16] or [15:0] */ /* PORTx_WRCONFIG allows to configure pins [31:16] or [15:0] */
/* write low pins */ /* write low pins */
@ -42,18 +45,20 @@ void gpio_mode_setup(uint32_t gpioport, uint8_t mode, uint8_t cnf, uint32_t gpio
/* configure port direction for selected gpios */ /* configure port direction for selected gpios */
/* DIR is always 0 when PULL */ /* DIR is always 0 when PULL */
if (cnf == GPIO_CNF_PULLDOWN || cnf == GPIO_CNF_PULLUP) if (cnf == GPIO_CNF_PULLDOWN || cnf == GPIO_CNF_PULLUP) {
PORT_DIRCLR(gpioport) = gpios; PORT_DIRCLR(gpioport) = gpios;
else if (mode == GPIO_MODE_INPUT) } else if (mode == GPIO_MODE_INPUT) {
PORT_DIRCLR(gpioport) = gpios; PORT_DIRCLR(gpioport) = gpios;
else } else {
PORT_DIRSET(gpioport) = gpios; PORT_DIRSET(gpioport) = gpios;
}
/* PULL UP/DOWN is configured through OUT */ /* PULL UP/DOWN is configured through OUT */
if (cnf == GPIO_CNF_PULLDOWN) if (cnf == GPIO_CNF_PULLDOWN) {
PORT_OUTCLR(gpioport) = gpios; PORT_OUTCLR(gpioport) = gpios;
else if (cnf == GPIO_CNF_PULLUP) } else if (cnf == GPIO_CNF_PULLUP) {
PORT_OUTSET(gpioport) = gpios; PORT_OUTSET(gpioport) = gpios;
}
} }
/** @brief Alternate function GPIO pins /** @brief Alternate function GPIO pins