Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_STM32F0/port_api.c
- Revision:
- 630:825f75ca301e
- Parent:
- 469:fc4922e0c183
--- a/targets/hal/TARGET_STM/TARGET_STM32F0/port_api.c Mon Sep 28 10:30:09 2015 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32F0/port_api.c Mon Sep 28 10:45:10 2015 +0100
@@ -1,6 +1,6 @@
/* mbed Microcontroller Library
*******************************************************************************
- * Copyright (c) 2014, STMicroelectronics
+ * Copyright (c) 2015, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,13 +38,11 @@
// high nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
// low nibble = pin number
-PinName port_pin(PortName port, int pin_n)
-{
+PinName port_pin(PortName port, int pin_n) {
return (PinName)(pin_n + (port << 4));
}
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir)
-{
+void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
uint32_t port_index = (uint32_t)port;
// Enable GPIO clock
@@ -61,8 +59,7 @@
port_dir(obj, dir);
}
-void port_dir(port_t *obj, PinDirection dir)
-{
+void port_dir(port_t *obj, PinDirection dir) {
uint32_t i;
obj->direction = dir;
for (i = 0; i < 16; i++) { // Process all pins
@@ -76,8 +73,7 @@
}
}
-void port_mode(port_t *obj, PinMode mode)
-{
+void port_mode(port_t *obj, PinMode mode) {
uint32_t i;
for (i = 0; i < 16; i++) { // Process all pins
if (obj->mask & (1 << i)) { // If the pin is used
@@ -86,13 +82,11 @@
}
}
-void port_write(port_t *obj, int value)
-{
+void port_write(port_t *obj, int value) {
*obj->reg_out = (*obj->reg_out & ~obj->mask) | (value & obj->mask);
}
-int port_read(port_t *obj)
-{
+int port_read(port_t *obj) {
if (obj->direction == PIN_OUTPUT) {
return (*obj->reg_out & obj->mask);
} else { // PIN_INPUT
