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
Revision 332:e299ae530e63, committed 2014-09-27
- Comitter:
- Geremia
- Date:
- Sat Sep 27 11:16:28 2014 +0000
- Parent:
- 331:098575c6d2c8
- Commit message:
- - fix F411 F334 systeminit when HSI used; - STMs PortInOut port.read() always read input data register (real external pin state) even if direction is output (same as other platforms)
Changed in this revision
--- a/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/system_stm32f3xx.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/system_stm32f3xx.c Sat Sep 27 11:16:28 2014 +0000 @@ -144,7 +144,7 @@ */ uint32_t SystemCoreClock = 72000000; -__IO const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; +const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; /** * @}
--- a/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/system_stm32f4xx.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/system_stm32f4xx.c Sat Sep 27 11:16:28 2014 +0000 @@ -157,7 +157,7 @@ variable is updated automatically. */ uint32_t SystemCoreClock = 16000000; -__IO const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; +const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; /** * @}
--- a/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,11 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,12 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } - else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,11 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,11 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -87,11 +87,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,11 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -93,11 +93,7 @@ int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -87,11 +87,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -93,11 +93,7 @@ int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -87,11 +87,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -88,11 +88,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F3XX/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_STM32F3XX/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -87,11 +87,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F407VG/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_STM32F407VG/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -87,11 +87,7 @@ } int port_read(port_t *obj) { - if (obj->direction == PIN_OUTPUT) { - return (*obj->reg_out & obj->mask); - } else { // PIN_INPUT - return (*obj->reg_in & obj->mask); - } + return (*obj->reg_in & obj->mask); // always read IDR, regardless of pin direction } #endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/port_api.c Wed Sep 24 13:15:06 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_STM32F4XX/port_api.c Sat Sep 27 11:16:28 2014 +0000 @@ -73,11 +73,7 @@ } int port_read(port_t *obj) { - switch (obj->direction) { - case PIN_OUTPUT: return *obj->reg_out & obj->mask; - case PIN_INPUT: return *obj->reg_in & obj->mask; - } - return 0; + return *obj->reg_in & obj->mask; } #endif