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 96:c359415e941f, committed 2014-02-18
- Comitter:
- mbed_official
- Date:
- Tue Feb 18 15:45:07 2014 +0000
- Parent:
- 95:7f2fbdc5e413
- Child:
- 97:a69e21de83fb
- Commit message:
- Synchronized with git revision 94a1bdc84b31212c9b6a6d275f9411fa3b2225fa
Full URL: https://github.com/mbedmicro/mbed/commit/94a1bdc84b31212c9b6a6d275f9411fa3b2225fa/
[NUCLEO_xxx] Fix issue with ticker + add volatile
Changed in this revision
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c Tue Feb 18 14:15:05 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c Tue Feb 18 15:45:07 2014 +0000
@@ -37,8 +37,8 @@
static int us_ticker_inited = 0;
static volatile uint32_t SlaveCounter = 0;
-static uint32_t oc_int_part = 0;
-static uint16_t oc_rem_part = 0;
+static volatile uint32_t oc_int_part = 0;
+static volatile uint16_t oc_rem_part = 0;
void set_compare(uint16_t count) {
// Set new output compare value
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c Tue Feb 18 14:15:05 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c Tue Feb 18 15:45:07 2014 +0000
@@ -37,8 +37,8 @@
static int us_ticker_inited = 0;
static volatile uint32_t SlaveCounter = 0;
-static uint32_t oc_int_part = 0;
-static uint16_t oc_rem_part = 0;
+static volatile uint32_t oc_int_part = 0;
+static volatile uint16_t oc_rem_part = 0;
void set_compare(uint16_t count) {
// Set new output compare value
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c Tue Feb 18 14:15:05 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c Tue Feb 18 15:45:07 2014 +0000
@@ -40,8 +40,8 @@
static int us_ticker_inited = 0;
static volatile uint32_t SlaveCounter = 0;
-static uint32_t oc_int_part = 0;
-static uint16_t oc_rem_part = 0;
+static volatile uint32_t oc_int_part = 0;
+static volatile uint16_t oc_rem_part = 0;
void set_compare(uint16_t count) {
// Set new output compare value
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c Tue Feb 18 14:15:05 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c Tue Feb 18 15:45:07 2014 +0000
@@ -36,8 +36,8 @@
static int us_ticker_inited = 0;
static volatile uint32_t SlaveCounter = 0;
-static uint32_t oc_int_part = 0;
-static uint16_t oc_rem_part = 0;
+static volatile uint32_t oc_int_part = 0;
+static volatile uint16_t oc_rem_part = 0;
void set_compare(uint16_t count) {
// Set new output compare value
@@ -58,20 +58,19 @@
// Output compare interrupt: used by interrupt system
if (TIM_GetITStatus(TIM_MST, TIM_IT_CC1) == SET) {
TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1);
- }
-
- if (oc_rem_part > 0) {
- set_compare(oc_rem_part); // Finish the remaining time left
- oc_rem_part = 0;
- }
- else {
- if (oc_int_part > 0) {
- set_compare(0xFFFF);
- oc_rem_part = cval; // To finish the counter loop the next time
- oc_int_part--;
+ if (oc_rem_part > 0) {
+ set_compare(oc_rem_part); // Finish the remaining time left
+ oc_rem_part = 0;
}
else {
- us_ticker_irq_handler();
+ if (oc_int_part > 0) {
+ set_compare(0xFFFF);
+ oc_rem_part = cval; // To finish the counter loop the next time
+ oc_int_part--;
+ }
+ else {
+ us_ticker_irq_handler();
+ }
}
}
}
