takashi kadono
/
Nucleo446_SSD1331
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/hal/pwmout_api.h@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | |
kadonotakashi | 0:8fdf9a60065b | 2 | /** \addtogroup hal */ |
kadonotakashi | 0:8fdf9a60065b | 3 | /** @{*/ |
kadonotakashi | 0:8fdf9a60065b | 4 | /* mbed Microcontroller Library |
kadonotakashi | 0:8fdf9a60065b | 5 | * Copyright (c) 2006-2013 ARM Limited |
kadonotakashi | 0:8fdf9a60065b | 6 | * |
kadonotakashi | 0:8fdf9a60065b | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kadonotakashi | 0:8fdf9a60065b | 8 | * you may not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 9 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 12 | * |
kadonotakashi | 0:8fdf9a60065b | 13 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
kadonotakashi | 0:8fdf9a60065b | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 16 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 17 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 18 | */ |
kadonotakashi | 0:8fdf9a60065b | 19 | #ifndef MBED_PWMOUT_API_H |
kadonotakashi | 0:8fdf9a60065b | 20 | #define MBED_PWMOUT_API_H |
kadonotakashi | 0:8fdf9a60065b | 21 | |
kadonotakashi | 0:8fdf9a60065b | 22 | #include "device.h" |
kadonotakashi | 0:8fdf9a60065b | 23 | |
kadonotakashi | 0:8fdf9a60065b | 24 | #if DEVICE_PWMOUT |
kadonotakashi | 0:8fdf9a60065b | 25 | |
kadonotakashi | 0:8fdf9a60065b | 26 | #ifdef __cplusplus |
kadonotakashi | 0:8fdf9a60065b | 27 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 28 | #endif |
kadonotakashi | 0:8fdf9a60065b | 29 | |
kadonotakashi | 0:8fdf9a60065b | 30 | /** Pwmout hal structure. pwmout_s is declared in the target's hal |
kadonotakashi | 0:8fdf9a60065b | 31 | */ |
kadonotakashi | 0:8fdf9a60065b | 32 | typedef struct pwmout_s pwmout_t; |
kadonotakashi | 0:8fdf9a60065b | 33 | |
kadonotakashi | 0:8fdf9a60065b | 34 | /** |
kadonotakashi | 0:8fdf9a60065b | 35 | * \defgroup hal_pwmout Pwmout hal functions |
kadonotakashi | 0:8fdf9a60065b | 36 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 37 | */ |
kadonotakashi | 0:8fdf9a60065b | 38 | |
kadonotakashi | 0:8fdf9a60065b | 39 | /** Initialize the pwm out peripheral and configure the pin |
kadonotakashi | 0:8fdf9a60065b | 40 | * |
kadonotakashi | 0:8fdf9a60065b | 41 | * @param obj The pwmout object to initialize |
kadonotakashi | 0:8fdf9a60065b | 42 | * @param pin The pwmout pin to initialize |
kadonotakashi | 0:8fdf9a60065b | 43 | */ |
kadonotakashi | 0:8fdf9a60065b | 44 | void pwmout_init(pwmout_t *obj, PinName pin); |
kadonotakashi | 0:8fdf9a60065b | 45 | |
kadonotakashi | 0:8fdf9a60065b | 46 | /** Deinitialize the pwmout object |
kadonotakashi | 0:8fdf9a60065b | 47 | * |
kadonotakashi | 0:8fdf9a60065b | 48 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 49 | */ |
kadonotakashi | 0:8fdf9a60065b | 50 | void pwmout_free(pwmout_t *obj); |
kadonotakashi | 0:8fdf9a60065b | 51 | |
kadonotakashi | 0:8fdf9a60065b | 52 | /** Set the output duty-cycle in range <0.0f, 1.0f> |
kadonotakashi | 0:8fdf9a60065b | 53 | * |
kadonotakashi | 0:8fdf9a60065b | 54 | * Value 0.0f represents 0 percentage, 1.0f represents 100 percent. |
kadonotakashi | 0:8fdf9a60065b | 55 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 56 | * @param percent The floating-point percentage number |
kadonotakashi | 0:8fdf9a60065b | 57 | */ |
kadonotakashi | 0:8fdf9a60065b | 58 | void pwmout_write(pwmout_t *obj, float percent); |
kadonotakashi | 0:8fdf9a60065b | 59 | |
kadonotakashi | 0:8fdf9a60065b | 60 | /** Read the current float-point output duty-cycle |
kadonotakashi | 0:8fdf9a60065b | 61 | * |
kadonotakashi | 0:8fdf9a60065b | 62 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 63 | * @return A floating-point output duty-cycle |
kadonotakashi | 0:8fdf9a60065b | 64 | */ |
kadonotakashi | 0:8fdf9a60065b | 65 | float pwmout_read(pwmout_t *obj); |
kadonotakashi | 0:8fdf9a60065b | 66 | |
kadonotakashi | 0:8fdf9a60065b | 67 | /** Set the PWM period specified in seconds, keeping the duty cycle the same |
kadonotakashi | 0:8fdf9a60065b | 68 | * |
kadonotakashi | 0:8fdf9a60065b | 69 | * Periods smaller than microseconds (the lowest resolution) are set to zero. |
kadonotakashi | 0:8fdf9a60065b | 70 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 71 | * @param seconds The floating-point seconds period |
kadonotakashi | 0:8fdf9a60065b | 72 | */ |
kadonotakashi | 0:8fdf9a60065b | 73 | void pwmout_period(pwmout_t *obj, float seconds); |
kadonotakashi | 0:8fdf9a60065b | 74 | |
kadonotakashi | 0:8fdf9a60065b | 75 | /** Set the PWM period specified in miliseconds, keeping the duty cycle the same |
kadonotakashi | 0:8fdf9a60065b | 76 | * |
kadonotakashi | 0:8fdf9a60065b | 77 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 78 | * @param ms The milisecond period |
kadonotakashi | 0:8fdf9a60065b | 79 | */ |
kadonotakashi | 0:8fdf9a60065b | 80 | void pwmout_period_ms(pwmout_t *obj, int ms); |
kadonotakashi | 0:8fdf9a60065b | 81 | |
kadonotakashi | 0:8fdf9a60065b | 82 | /** Set the PWM period specified in microseconds, keeping the duty cycle the same |
kadonotakashi | 0:8fdf9a60065b | 83 | * |
kadonotakashi | 0:8fdf9a60065b | 84 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 85 | * @param us The microsecond period |
kadonotakashi | 0:8fdf9a60065b | 86 | */ |
kadonotakashi | 0:8fdf9a60065b | 87 | void pwmout_period_us(pwmout_t *obj, int us); |
kadonotakashi | 0:8fdf9a60065b | 88 | |
kadonotakashi | 0:8fdf9a60065b | 89 | /** Set the PWM pulsewidth specified in seconds, keeping the period the same. |
kadonotakashi | 0:8fdf9a60065b | 90 | * |
kadonotakashi | 0:8fdf9a60065b | 91 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 92 | * @param seconds The floating-point pulsewidth in seconds |
kadonotakashi | 0:8fdf9a60065b | 93 | */ |
kadonotakashi | 0:8fdf9a60065b | 94 | void pwmout_pulsewidth(pwmout_t *obj, float seconds); |
kadonotakashi | 0:8fdf9a60065b | 95 | |
kadonotakashi | 0:8fdf9a60065b | 96 | /** Set the PWM pulsewidth specified in miliseconds, keeping the period the same. |
kadonotakashi | 0:8fdf9a60065b | 97 | * |
kadonotakashi | 0:8fdf9a60065b | 98 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 99 | * @param ms The floating-point pulsewidth in miliseconds |
kadonotakashi | 0:8fdf9a60065b | 100 | */ |
kadonotakashi | 0:8fdf9a60065b | 101 | void pwmout_pulsewidth_ms(pwmout_t *obj, int ms); |
kadonotakashi | 0:8fdf9a60065b | 102 | |
kadonotakashi | 0:8fdf9a60065b | 103 | /** Set the PWM pulsewidth specified in microseconds, keeping the period the same. |
kadonotakashi | 0:8fdf9a60065b | 104 | * |
kadonotakashi | 0:8fdf9a60065b | 105 | * @param obj The pwmout object |
kadonotakashi | 0:8fdf9a60065b | 106 | * @param us The floating-point pulsewidth in microseconds |
kadonotakashi | 0:8fdf9a60065b | 107 | */ |
kadonotakashi | 0:8fdf9a60065b | 108 | void pwmout_pulsewidth_us(pwmout_t *obj, int us); |
kadonotakashi | 0:8fdf9a60065b | 109 | |
kadonotakashi | 0:8fdf9a60065b | 110 | /**@}*/ |
kadonotakashi | 0:8fdf9a60065b | 111 | |
kadonotakashi | 0:8fdf9a60065b | 112 | #ifdef __cplusplus |
kadonotakashi | 0:8fdf9a60065b | 113 | } |
kadonotakashi | 0:8fdf9a60065b | 114 | #endif |
kadonotakashi | 0:8fdf9a60065b | 115 | |
kadonotakashi | 0:8fdf9a60065b | 116 | #endif |
kadonotakashi | 0:8fdf9a60065b | 117 | |
kadonotakashi | 0:8fdf9a60065b | 118 | #endif |
kadonotakashi | 0:8fdf9a60065b | 119 | |
kadonotakashi | 0:8fdf9a60065b | 120 | /** @}*/ |