libwebsockets
Lightweight C library for HTML5 websockets
lws-pwm.h
Go to the documentation of this file.
1 /*
2  * Generic PWM controller ops
3  *
4  * Copyright (C) 2019 - 2020 Andy Green <andy@warmcat.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 
25 typedef struct lws_pwm_map {
30 
31 typedef struct lws_pwm_ops {
32  int (*init)(const struct lws_pwm_ops *lo);
33  void (*intensity)(const struct lws_pwm_ops *lo, _lws_plat_gpio_t gpio,
34  lws_led_intensity_t inten);
38 
40 lws_pwm_plat_init(const struct lws_pwm_ops *lo);
41 
44  lws_led_intensity_t inten);
45 
46 #define lws_pwm_plat_ops \
47  .init = lws_pwm_plat_init, \
48  .intensity = lws_pwm_plat_intensity
49 
50 /*
51  * May be useful for making your own transitions or sequences
52  */
53 
58 
59 /* canned sequences that can work out of the box */
60 
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
int _lws_plat_gpio_t
Definition: lws-gpio.h:31
uint16_t lws_led_seq_phase_t
Definition: lws-led.h:30
uint16_t lws_led_intensity_t
Definition: lws-led.h:29
const lws_led_sequence_def_t lws_pwmseq_sine_down
Definition: lws-pwm.h:64
LWS_VISIBLE LWS_EXTERN lws_led_intensity_t lws_led_func_sine(lws_led_seq_phase_t n)
LWS_VISIBLE LWS_EXTERN lws_led_intensity_t lws_led_func_linear(lws_led_seq_phase_t n)
uint8_t active_level
Definition: lws-pwm.h:28
_lws_plat_gpio_t gpio
Definition: lws-pwm.h:26
const lws_led_sequence_def_t lws_pwmseq_static_on
Definition: lws-pwm.h:65
const lws_led_sequence_def_t lws_pwmseq_static_half
Definition: lws-pwm.h:66
const lws_led_sequence_def_t lws_pwmseq_sine_endless_slow
struct lws_pwm_ops lws_pwm_ops_t
const lws_led_sequence_def_t lws_pwmseq_linear_wipe
Definition: lws-pwm.h:63
struct lws_pwm_map lws_pwm_map_t
LWS_VISIBLE LWS_EXTERN int lws_pwm_plat_init(const struct lws_pwm_ops *lo)
const lws_led_sequence_def_t lws_pwmseq_sine_up
Definition: lws-pwm.h:64
const lws_led_sequence_def_t lws_pwmseq_sine_endless_fast
Definition: lws-pwm.h:62
const lws_led_sequence_def_t lws_pwmseq_static_off
Definition: lws-pwm.h:67
LWS_VISIBLE LWS_EXTERN void lws_pwm_plat_intensity(const struct lws_pwm_ops *lo, _lws_plat_gpio_t gpio, lws_led_intensity_t inten)
uint8_t index
Definition: lws-pwm.h:27
const lws_pwm_map_t * pwm_map
Definition: lws-pwm.h:35
uint8_t count_pwm_map
Definition: lws-pwm.h:36
void(* intensity)(const struct lws_pwm_ops *lo, _lws_plat_gpio_t gpio, lws_led_intensity_t inten)
Definition: lws-pwm.h:33
int(* init)(const struct lws_pwm_ops *lo)
Definition: lws-pwm.h:32