aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/gpio.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
commit753f89de354eff212d84f3f2aff41146865da342 (patch)
tree095e2183ce956bac028083d056c9c4b7ee8a8d84 /libmaple/gpio.c
parent849bc0f8f6abf42567a152cf6e01bf7349902aac (diff)
downloadlibrambutan-753f89de354eff212d84f3f2aff41146865da342.tar.gz
librambutan-753f89de354eff212d84f3f2aff41146865da342.zip
whitespace cleanups
Diffstat (limited to 'libmaple/gpio.c')
-rw-r--r--libmaple/gpio.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/libmaple/gpio.c b/libmaple/gpio.c
index c5bb450..f7aee2b 100644
--- a/libmaple/gpio.c
+++ b/libmaple/gpio.c
@@ -1,4 +1,4 @@
-/* *****************************************************************************
+/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
@@ -20,12 +20,12 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
- * ****************************************************************************/
+ *****************************************************************************/
/**
- * @file gpio.c
+ * @file gpio.c
*
- * @brief GPIO initialization routine
+ * @brief GPIO initialization routine
*/
#include "libmaple.h"
@@ -33,39 +33,38 @@
#include "gpio.h"
void gpio_init(void) {
- rcc_clk_enable(RCC_GPIOA);
- rcc_clk_enable(RCC_GPIOB);
- rcc_clk_enable(RCC_GPIOC);
- rcc_clk_enable(RCC_GPIOD);
- #if NR_GPIO_PORTS >= 7
- rcc_clk_enable(RCC_GPIOE);
- rcc_clk_enable(RCC_GPIOF);
- rcc_clk_enable(RCC_GPIOG);
- #endif
- rcc_clk_enable(RCC_AFIO);
+ rcc_clk_enable(RCC_GPIOA);
+ rcc_clk_enable(RCC_GPIOB);
+ rcc_clk_enable(RCC_GPIOC);
+ rcc_clk_enable(RCC_GPIOD);
+#if NR_GPIO_PORTS >= 7
+ rcc_clk_enable(RCC_GPIOE);
+ rcc_clk_enable(RCC_GPIOF);
+ rcc_clk_enable(RCC_GPIOG);
+#endif
+ rcc_clk_enable(RCC_AFIO);
}
void gpio_set_mode(GPIO_Port* port, uint8 gpio_pin, GPIOPinMode mode) {
- uint32 tmp;
- uint32 shift = POS(gpio_pin % 8);
- GPIOReg CR;
+ uint32 tmp;
+ uint32 shift = POS(gpio_pin % 8);
+ GPIOReg CR;
- ASSERT(port);
- ASSERT(gpio_pin < 16);
+ ASSERT(port);
+ ASSERT(gpio_pin < 16);
- if (mode == GPIO_MODE_INPUT_PU) {
- port->ODR |= BIT(gpio_pin);
- mode = CNF_INPUT_PD;
- } else if (mode == GPIO_MODE_INPUT_PD) {
- port->ODR &= ~BIT(gpio_pin);
- }
+ if (mode == GPIO_MODE_INPUT_PU) {
+ port->ODR |= BIT(gpio_pin);
+ mode = CNF_INPUT_PD;
+ } else if (mode == GPIO_MODE_INPUT_PD) {
+ port->ODR &= ~BIT(gpio_pin);
+ }
- CR = (gpio_pin < 8) ? &(port->CRL) : &(port->CRH);
+ CR = (gpio_pin < 8) ? &(port->CRL) : &(port->CRH);
- tmp = *CR;
- tmp &= POS_MASK(shift);
- tmp |= mode << shift;
-
- *CR = tmp;
+ tmp = *CR;
+ tmp &= POS_MASK(shift);
+ tmp |= mode << shift;
+ *CR = tmp;
}