diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c index 652f94473a..d340a526b2 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c @@ -49,9 +49,9 @@ void set_compare(uint16_t count) { // Used to increment the slave counter static void tim_update_irq_handler(void) { - SlaveCounter++; if (TIM_GetITStatus(TIM_MST, TIM_IT_Update) == SET) { TIM_ClearITPendingBit(TIM_MST, TIM_IT_Update); + SlaveCounter++; } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c index 0868ddbad5..07bee5d67c 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c @@ -49,9 +49,9 @@ void set_compare(uint16_t count) { // Used to increment the slave counter static void tim_update_irq_handler(void) { - SlaveCounter++; if (TIM_GetITStatus(TIM_MST, TIM_IT_Update) == SET) { TIM_ClearITPendingBit(TIM_MST, TIM_IT_Update); + SlaveCounter++; } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c index 1cf64cd6fd..e1088dec9a 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c @@ -52,10 +52,10 @@ void set_compare(uint16_t count) { // Used to increment the slave counter static void tim_update_irq_handler(void) { - SlaveCounter++; if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_UPDATE) == SET) { __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_UPDATE); __HAL_TIM_SetCounter(&TimMasterHandle, 0); // Reset counter !!! + SlaveCounter++; } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c index d7b4880553..f7c8f244db 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c @@ -65,14 +65,14 @@ void analogout_init(dac_t *obj, PinName pin) { DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable; - if (pin == PA_4) { + if (obj->channel == PA_4) { DAC_Init(DAC_Channel_1, &DAC_InitStructure); DAC_Cmd(DAC_Channel_1, ENABLE); } - else { // PA_5 - DAC_Init(DAC_Channel_2, &DAC_InitStructure); - DAC_Cmd(DAC_Channel_2, ENABLE); - } + //if (obj->channel == PA_5) { + // DAC_Init(DAC_Channel_2, &DAC_InitStructure); + // DAC_Cmd(DAC_Channel_2, ENABLE); + //} analogout_write_u16(obj, 0); } @@ -84,18 +84,19 @@ static inline void dac_write(dac_t *obj, uint16_t value) { if (obj->channel == PA_4) { DAC_SetChannel1Data(DAC_Align_12b_R, value); } - else { // PA_5 - DAC_SetChannel2Data(DAC_Align_12b_R, value); - } + //if (obj->channel == PA_5) { + // DAC_SetChannel2Data(DAC_Align_12b_R, value); + //} } static inline int dac_read(dac_t *obj) { if (obj->channel == PA_4) { return (int)DAC_GetDataOutputValue(DAC_Channel_1); } - else { // PA_5 - return (int)DAC_GetDataOutputValue(DAC_Channel_2); - } + //if (obj->channel == PA_5) { + // return (int)DAC_GetDataOutputValue(DAC_Channel_2); + //} + return 0; } void analogout_write(dac_t *obj, float value) {