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
targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pwmout_api.c@340:28d1f895c6fe, 2014-10-09 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Oct 09 08:15:07 2014 +0100
- Revision:
- 340:28d1f895c6fe
- Parent:
- 227:7bd0639b8911
- Child:
- 402:09075a3b15e3
Synchronized with git revision b5a4c8e80393336b2656fb29ab46d405d3068602
Full URL: https://github.com/mbedmicro/mbed/commit/b5a4c8e80393336b2656fb29ab46d405d3068602/
HAL: nrf51822 - Few fixes for PWM and Serial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 84:f54042cbc282 | 1 | /* mbed Microcontroller Library |
mbed_official | 84:f54042cbc282 | 2 | ******************************************************************************* |
mbed_official | 84:f54042cbc282 | 3 | * Copyright (c) 2014, STMicroelectronics |
mbed_official | 84:f54042cbc282 | 4 | * All rights reserved. |
mbed_official | 84:f54042cbc282 | 5 | * |
mbed_official | 84:f54042cbc282 | 6 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 84:f54042cbc282 | 7 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 84:f54042cbc282 | 8 | * |
mbed_official | 84:f54042cbc282 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 84:f54042cbc282 | 10 | * this list of conditions and the following disclaimer. |
mbed_official | 84:f54042cbc282 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 84:f54042cbc282 | 12 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 84:f54042cbc282 | 13 | * and/or other materials provided with the distribution. |
mbed_official | 84:f54042cbc282 | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 84:f54042cbc282 | 15 | * may be used to endorse or promote products derived from this software |
mbed_official | 84:f54042cbc282 | 16 | * without specific prior written permission. |
mbed_official | 84:f54042cbc282 | 17 | * |
mbed_official | 84:f54042cbc282 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 84:f54042cbc282 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 84:f54042cbc282 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 84:f54042cbc282 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 84:f54042cbc282 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 84:f54042cbc282 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 84:f54042cbc282 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 84:f54042cbc282 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 84:f54042cbc282 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 84:f54042cbc282 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 84:f54042cbc282 | 28 | ******************************************************************************* |
mbed_official | 84:f54042cbc282 | 29 | */ |
mbed_official | 84:f54042cbc282 | 30 | #include "pwmout_api.h" |
mbed_official | 84:f54042cbc282 | 31 | |
mbed_official | 166:cb4253f91ada | 32 | #if DEVICE_PWMOUT |
mbed_official | 166:cb4253f91ada | 33 | |
mbed_official | 84:f54042cbc282 | 34 | #include "cmsis.h" |
mbed_official | 84:f54042cbc282 | 35 | #include "pinmap.h" |
mbed_official | 340:28d1f895c6fe | 36 | #include "mbed_error.h" |
mbed_official | 84:f54042cbc282 | 37 | |
mbed_official | 164:90c6009cba07 | 38 | // TIM1 cannot be used because already used by the us_ticker |
mbed_official | 340:28d1f895c6fe | 39 | // Uncomment/comment line above to use an alternate timer, |
mbed_official | 340:28d1f895c6fe | 40 | // If the channel is not the same, |
mbed_official | 340:28d1f895c6fe | 41 | // Please don't forget to uncomment/comment in the pwmout_write() function also |
mbed_official | 84:f54042cbc282 | 42 | static const PinMap PinMap_PWM[] = { |
mbed_official | 340:28d1f895c6fe | 43 | {PA_4, PWM_14, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_TIM14)}, // TIM14_CH1 |
mbed_official | 340:28d1f895c6fe | 44 | {PA_6, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH1 |
mbed_official | 340:28d1f895c6fe | 45 | // {PA_6, PWM_16, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_TIM16)}, // TIM16_CH1 |
mbed_official | 340:28d1f895c6fe | 46 | {PA_7, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH2 |
mbed_official | 340:28d1f895c6fe | 47 | // {PA_7, PWM_14, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_TIM14)}, // TIM14_CH1 |
mbed_official | 340:28d1f895c6fe | 48 | // {PA_7, PWM_17, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_TIM17)}, // TIM17_CH1 |
mbed_official | 340:28d1f895c6fe | 49 | {PB_0, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH3 |
mbed_official | 340:28d1f895c6fe | 50 | {PB_1, PWM_14, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_TIM14)}, // TIM14_CH1 |
mbed_official | 340:28d1f895c6fe | 51 | // {PB_1, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH4 |
mbed_official | 340:28d1f895c6fe | 52 | {PB_4, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH1 |
mbed_official | 340:28d1f895c6fe | 53 | {PB_5, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH2 |
mbed_official | 340:28d1f895c6fe | 54 | {PB_6, PWM_16, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM16)}, // TIM16_CH1N |
mbed_official | 340:28d1f895c6fe | 55 | {PB_7, PWM_17, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM17)}, // TIM17_CH1N |
mbed_official | 340:28d1f895c6fe | 56 | {PB_8, PWM_16, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM16)}, // TIM16_CH1 |
mbed_official | 340:28d1f895c6fe | 57 | {PB_9, PWM_17, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM17)}, // TIM17_CH1 |
mbed_official | 340:28d1f895c6fe | 58 | {PB_14, PWM_15, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM15)}, // TIM15_CH1 |
mbed_official | 340:28d1f895c6fe | 59 | {PB_15, PWM_15, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM15)}, // TIM15_CH2 |
mbed_official | 340:28d1f895c6fe | 60 | // {PB_15, PWM_15, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_TIM15)}, // TIM15_CH1N |
mbed_official | 340:28d1f895c6fe | 61 | {PC_6, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH1 |
mbed_official | 340:28d1f895c6fe | 62 | {PC_7, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH2 |
mbed_official | 340:28d1f895c6fe | 63 | {PC_8, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH3 |
mbed_official | 340:28d1f895c6fe | 64 | {PC_9, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM3)}, // TIM3_CH4 |
mbed_official | 84:f54042cbc282 | 65 | {NC, NC, 0} |
mbed_official | 84:f54042cbc282 | 66 | }; |
mbed_official | 84:f54042cbc282 | 67 | |
mbed_official | 340:28d1f895c6fe | 68 | static TIM_HandleTypeDef TimHandle; |
mbed_official | 340:28d1f895c6fe | 69 | |
mbed_official | 216:577900467c9e | 70 | void pwmout_init(pwmout_t* obj, PinName pin) { |
mbed_official | 84:f54042cbc282 | 71 | // Get the peripheral name from the pin and assign it to the object |
mbed_official | 84:f54042cbc282 | 72 | obj->pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM); |
mbed_official | 340:28d1f895c6fe | 73 | |
mbed_official | 340:28d1f895c6fe | 74 | if (obj->pwm == (PWMName)NC) { |
mbed_official | 340:28d1f895c6fe | 75 | error("PWM error: pinout mapping failed."); |
mbed_official | 340:28d1f895c6fe | 76 | } |
mbed_official | 216:577900467c9e | 77 | |
mbed_official | 84:f54042cbc282 | 78 | // Enable TIM clock |
mbed_official | 340:28d1f895c6fe | 79 | if (obj->pwm == PWM_3) __TIM3_CLK_ENABLE(); |
mbed_official | 340:28d1f895c6fe | 80 | if (obj->pwm == PWM_14) __TIM14_CLK_ENABLE(); |
mbed_official | 340:28d1f895c6fe | 81 | if (obj->pwm == PWM_15) __TIM15_CLK_ENABLE(); |
mbed_official | 340:28d1f895c6fe | 82 | if (obj->pwm == PWM_16) __TIM16_CLK_ENABLE(); |
mbed_official | 340:28d1f895c6fe | 83 | if (obj->pwm == PWM_17) __TIM17_CLK_ENABLE(); |
mbed_official | 84:f54042cbc282 | 84 | |
mbed_official | 84:f54042cbc282 | 85 | // Configure GPIO |
mbed_official | 84:f54042cbc282 | 86 | pinmap_pinout(pin, PinMap_PWM); |
mbed_official | 216:577900467c9e | 87 | |
mbed_official | 84:f54042cbc282 | 88 | obj->pin = pin; |
mbed_official | 84:f54042cbc282 | 89 | obj->period = 0; |
mbed_official | 84:f54042cbc282 | 90 | obj->pulse = 0; |
mbed_official | 216:577900467c9e | 91 | |
mbed_official | 84:f54042cbc282 | 92 | pwmout_period_us(obj, 20000); // 20 ms per default |
mbed_official | 84:f54042cbc282 | 93 | } |
mbed_official | 84:f54042cbc282 | 94 | |
mbed_official | 84:f54042cbc282 | 95 | void pwmout_free(pwmout_t* obj) { |
mbed_official | 340:28d1f895c6fe | 96 | // Configure GPIO |
mbed_official | 340:28d1f895c6fe | 97 | pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)); |
mbed_official | 84:f54042cbc282 | 98 | } |
mbed_official | 84:f54042cbc282 | 99 | |
mbed_official | 84:f54042cbc282 | 100 | void pwmout_write(pwmout_t* obj, float value) { |
mbed_official | 340:28d1f895c6fe | 101 | TIM_OC_InitTypeDef sConfig; |
mbed_official | 340:28d1f895c6fe | 102 | int channel = 0; |
mbed_official | 340:28d1f895c6fe | 103 | int complementary_channel = 0; |
mbed_official | 216:577900467c9e | 104 | |
mbed_official | 340:28d1f895c6fe | 105 | TimHandle.Instance = (TIM_TypeDef *)(obj->pwm); |
mbed_official | 340:28d1f895c6fe | 106 | |
mbed_official | 340:28d1f895c6fe | 107 | if (value < (float)0.0) { |
mbed_official | 84:f54042cbc282 | 108 | value = 0.0; |
mbed_official | 340:28d1f895c6fe | 109 | } else if (value > (float)1.0) { |
mbed_official | 84:f54042cbc282 | 110 | value = 1.0; |
mbed_official | 84:f54042cbc282 | 111 | } |
mbed_official | 216:577900467c9e | 112 | |
mbed_official | 84:f54042cbc282 | 113 | obj->pulse = (uint32_t)((float)obj->period * value); |
mbed_official | 216:577900467c9e | 114 | |
mbed_official | 164:90c6009cba07 | 115 | // Configure channels |
mbed_official | 340:28d1f895c6fe | 116 | sConfig.OCMode = TIM_OCMODE_PWM1; |
mbed_official | 340:28d1f895c6fe | 117 | sConfig.Pulse = obj->pulse; |
mbed_official | 340:28d1f895c6fe | 118 | sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; |
mbed_official | 340:28d1f895c6fe | 119 | sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; |
mbed_official | 340:28d1f895c6fe | 120 | sConfig.OCFastMode = TIM_OCFAST_DISABLE; |
mbed_official | 340:28d1f895c6fe | 121 | sConfig.OCIdleState = TIM_OCIDLESTATE_RESET; |
mbed_official | 340:28d1f895c6fe | 122 | sConfig.OCNIdleState = TIM_OCNIDLESTATE_RESET; |
mbed_official | 84:f54042cbc282 | 123 | |
mbed_official | 164:90c6009cba07 | 124 | switch (obj->pin) { |
mbed_official | 164:90c6009cba07 | 125 | // Channels 1 |
mbed_official | 164:90c6009cba07 | 126 | case PA_4: |
mbed_official | 164:90c6009cba07 | 127 | case PA_6: |
mbed_official | 340:28d1f895c6fe | 128 | // case PA_7: |
mbed_official | 164:90c6009cba07 | 129 | case PB_1: |
mbed_official | 164:90c6009cba07 | 130 | case PB_4: |
mbed_official | 164:90c6009cba07 | 131 | case PB_8: |
mbed_official | 164:90c6009cba07 | 132 | case PB_9: |
mbed_official | 164:90c6009cba07 | 133 | case PB_14: |
mbed_official | 164:90c6009cba07 | 134 | case PC_6: |
mbed_official | 340:28d1f895c6fe | 135 | channel = TIM_CHANNEL_1; |
mbed_official | 164:90c6009cba07 | 136 | break; |
mbed_official | 164:90c6009cba07 | 137 | // Channels 1N |
mbed_official | 164:90c6009cba07 | 138 | case PB_6: |
mbed_official | 164:90c6009cba07 | 139 | case PB_7: |
mbed_official | 340:28d1f895c6fe | 140 | // case PB_15: |
mbed_official | 340:28d1f895c6fe | 141 | channel = TIM_CHANNEL_1; |
mbed_official | 340:28d1f895c6fe | 142 | complementary_channel = 1; |
mbed_official | 164:90c6009cba07 | 143 | break; |
mbed_official | 164:90c6009cba07 | 144 | // Channels 2 |
mbed_official | 340:28d1f895c6fe | 145 | case PA_7: |
mbed_official | 164:90c6009cba07 | 146 | case PB_5: |
mbed_official | 340:28d1f895c6fe | 147 | case PB_15: |
mbed_official | 164:90c6009cba07 | 148 | case PC_7: |
mbed_official | 340:28d1f895c6fe | 149 | channel = TIM_CHANNEL_2; |
mbed_official | 216:577900467c9e | 150 | break; |
mbed_official | 164:90c6009cba07 | 151 | // Channels 3 |
mbed_official | 164:90c6009cba07 | 152 | case PB_0: |
mbed_official | 164:90c6009cba07 | 153 | case PC_8: |
mbed_official | 340:28d1f895c6fe | 154 | channel = TIM_CHANNEL_3; |
mbed_official | 164:90c6009cba07 | 155 | break; |
mbed_official | 216:577900467c9e | 156 | // Channels 4 |
mbed_official | 164:90c6009cba07 | 157 | // case PB_1: |
mbed_official | 164:90c6009cba07 | 158 | case PC_9: |
mbed_official | 340:28d1f895c6fe | 159 | channel = TIM_CHANNEL_4; |
mbed_official | 164:90c6009cba07 | 160 | break; |
mbed_official | 164:90c6009cba07 | 161 | default: |
mbed_official | 216:577900467c9e | 162 | return; |
mbed_official | 216:577900467c9e | 163 | } |
mbed_official | 216:577900467c9e | 164 | |
mbed_official | 340:28d1f895c6fe | 165 | HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, channel); |
mbed_official | 216:577900467c9e | 166 | |
mbed_official | 340:28d1f895c6fe | 167 | if (complementary_channel) { |
mbed_official | 340:28d1f895c6fe | 168 | HAL_TIMEx_PWMN_Start(&TimHandle, channel); |
mbed_official | 340:28d1f895c6fe | 169 | } else { |
mbed_official | 340:28d1f895c6fe | 170 | HAL_TIM_PWM_Start(&TimHandle, channel); |
mbed_official | 340:28d1f895c6fe | 171 | } |
mbed_official | 84:f54042cbc282 | 172 | } |
mbed_official | 84:f54042cbc282 | 173 | |
mbed_official | 84:f54042cbc282 | 174 | float pwmout_read(pwmout_t* obj) { |
mbed_official | 84:f54042cbc282 | 175 | float value = 0; |
mbed_official | 84:f54042cbc282 | 176 | if (obj->period > 0) { |
mbed_official | 84:f54042cbc282 | 177 | value = (float)(obj->pulse) / (float)(obj->period); |
mbed_official | 84:f54042cbc282 | 178 | } |
mbed_official | 340:28d1f895c6fe | 179 | return ((value > (float)1.0) ? (float)(1.0) : (value)); |
mbed_official | 84:f54042cbc282 | 180 | } |
mbed_official | 84:f54042cbc282 | 181 | |
mbed_official | 84:f54042cbc282 | 182 | void pwmout_period(pwmout_t* obj, float seconds) { |
mbed_official | 84:f54042cbc282 | 183 | pwmout_period_us(obj, seconds * 1000000.0f); |
mbed_official | 84:f54042cbc282 | 184 | } |
mbed_official | 84:f54042cbc282 | 185 | |
mbed_official | 84:f54042cbc282 | 186 | void pwmout_period_ms(pwmout_t* obj, int ms) { |
mbed_official | 84:f54042cbc282 | 187 | pwmout_period_us(obj, ms * 1000); |
mbed_official | 84:f54042cbc282 | 188 | } |
mbed_official | 84:f54042cbc282 | 189 | |
mbed_official | 84:f54042cbc282 | 190 | void pwmout_period_us(pwmout_t* obj, int us) { |
mbed_official | 340:28d1f895c6fe | 191 | TimHandle.Instance = (TIM_TypeDef *)(obj->pwm); |
mbed_official | 340:28d1f895c6fe | 192 | |
mbed_official | 84:f54042cbc282 | 193 | float dc = pwmout_read(obj); |
mbed_official | 84:f54042cbc282 | 194 | |
mbed_official | 340:28d1f895c6fe | 195 | __HAL_TIM_DISABLE(&TimHandle); |
mbed_official | 216:577900467c9e | 196 | |
mbed_official | 340:28d1f895c6fe | 197 | // Update the SystemCoreClock variable |
mbed_official | 340:28d1f895c6fe | 198 | SystemCoreClockUpdate(); |
mbed_official | 216:577900467c9e | 199 | |
mbed_official | 340:28d1f895c6fe | 200 | TimHandle.Init.Period = us - 1; |
mbed_official | 340:28d1f895c6fe | 201 | TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick |
mbed_official | 340:28d1f895c6fe | 202 | TimHandle.Init.ClockDivision = 0; |
mbed_official | 340:28d1f895c6fe | 203 | TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; |
mbed_official | 340:28d1f895c6fe | 204 | HAL_TIM_PWM_Init(&TimHandle); |
mbed_official | 84:f54042cbc282 | 205 | |
mbed_official | 84:f54042cbc282 | 206 | // Set duty cycle again |
mbed_official | 84:f54042cbc282 | 207 | pwmout_write(obj, dc); |
mbed_official | 216:577900467c9e | 208 | |
mbed_official | 340:28d1f895c6fe | 209 | // Save for future use |
mbed_official | 340:28d1f895c6fe | 210 | obj->period = us; |
mbed_official | 84:f54042cbc282 | 211 | |
mbed_official | 340:28d1f895c6fe | 212 | __HAL_TIM_ENABLE(&TimHandle); |
mbed_official | 84:f54042cbc282 | 213 | } |
mbed_official | 84:f54042cbc282 | 214 | |
mbed_official | 84:f54042cbc282 | 215 | void pwmout_pulsewidth(pwmout_t* obj, float seconds) { |
mbed_official | 84:f54042cbc282 | 216 | pwmout_pulsewidth_us(obj, seconds * 1000000.0f); |
mbed_official | 84:f54042cbc282 | 217 | } |
mbed_official | 84:f54042cbc282 | 218 | |
mbed_official | 84:f54042cbc282 | 219 | void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) { |
mbed_official | 84:f54042cbc282 | 220 | pwmout_pulsewidth_us(obj, ms * 1000); |
mbed_official | 84:f54042cbc282 | 221 | } |
mbed_official | 84:f54042cbc282 | 222 | |
mbed_official | 84:f54042cbc282 | 223 | void pwmout_pulsewidth_us(pwmout_t* obj, int us) { |
mbed_official | 84:f54042cbc282 | 224 | float value = (float)us / (float)obj->period; |
mbed_official | 84:f54042cbc282 | 225 | pwmout_write(obj, value); |
mbed_official | 84:f54042cbc282 | 226 | } |
mbed_official | 166:cb4253f91ada | 227 | |
mbed_official | 166:cb4253f91ada | 228 | #endif |