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