libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
class="ui-resizable-handle">
Loading...
Searching...
No Matches
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
{
26
_lws_plat_gpio_t
gpio
;
27
uint8_t
index
;
28
uint8_t
active_level
;
29
}
lws_pwm_map_t
;
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);
35
const
lws_pwm_map_t
*
pwm_map
;
36
uint8_t
count_pwm_map
;
37
}
lws_pwm_ops_t
;
38
39
LWS_VISIBLE
LWS_EXTERN
int
40
lws_pwm_plat_init
(
const
struct
lws_pwm_ops
*lo);
41
42
LWS_VISIBLE
LWS_EXTERN
void
43
lws_pwm_plat_intensity
(
const
struct
lws_pwm_ops
*lo,
_lws_plat_gpio_t
gpio,
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
54
LWS_VISIBLE
LWS_EXTERN
lws_led_intensity_t
55
lws_led_func_linear
(
lws_led_seq_phase_t
n);
56
LWS_VISIBLE
LWS_EXTERN
lws_led_intensity_t
57
lws_led_func_sine
(
lws_led_seq_phase_t
n);
58
59
/* canned sequences that can work out of the box */
60
61
extern
const
lws_led_sequence_def_t
lws_pwmseq_sine_endless_slow
,
62
lws_pwmseq_sine_endless_fast
,
63
lws_pwmseq_linear_wipe
,
64
lws_pwmseq_sine_up
,
lws_pwmseq_sine_down
,
65
lws_pwmseq_static_on
,
66
lws_pwmseq_static_half
,
67
lws_pwmseq_static_off
;
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:296
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:697
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:291
_lws_plat_gpio_t
int _lws_plat_gpio_t
Definition
lws-gpio.h:31
lws_led_seq_phase_t
uint16_t lws_led_seq_phase_t
Definition
lws-led.h:30
lws_led_intensity_t
uint16_t lws_led_intensity_t
Definition
lws-led.h:29
lws_led_sequence_def_t
Definition
lws-led.h:47
lws_pwmseq_sine_down
const lws_led_sequence_def_t lws_pwmseq_sine_down
Definition
lws-pwm.h:64
lws_led_func_sine
LWS_VISIBLE LWS_EXTERN lws_led_intensity_t lws_led_func_sine(lws_led_seq_phase_t n)
lws_led_func_linear
LWS_VISIBLE LWS_EXTERN lws_led_intensity_t lws_led_func_linear(lws_led_seq_phase_t n)
lws_pwm_map::active_level
uint8_t active_level
Definition
lws-pwm.h:28
lws_pwm_map::gpio
_lws_plat_gpio_t gpio
Definition
lws-pwm.h:26
lws_pwmseq_static_on
const lws_led_sequence_def_t lws_pwmseq_static_on
Definition
lws-pwm.h:65
lws_pwmseq_static_half
const lws_led_sequence_def_t lws_pwmseq_static_half
Definition
lws-pwm.h:66
lws_pwmseq_sine_endless_slow
const lws_led_sequence_def_t lws_pwmseq_sine_endless_slow
lws_pwm_ops_t
struct lws_pwm_ops lws_pwm_ops_t
lws_pwmseq_linear_wipe
const lws_led_sequence_def_t lws_pwmseq_linear_wipe
Definition
lws-pwm.h:63
lws_pwm_map_t
struct lws_pwm_map lws_pwm_map_t
lws_pwm_plat_init
LWS_VISIBLE LWS_EXTERN int lws_pwm_plat_init(const struct lws_pwm_ops *lo)
lws_pwmseq_sine_up
const lws_led_sequence_def_t lws_pwmseq_sine_up
Definition
lws-pwm.h:64
lws_pwmseq_sine_endless_fast
const lws_led_sequence_def_t lws_pwmseq_sine_endless_fast
Definition
lws-pwm.h:62
lws_pwmseq_static_off
const lws_led_sequence_def_t lws_pwmseq_static_off
Definition
lws-pwm.h:67
lws_pwm_plat_intensity
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)
lws_pwm_map::index
uint8_t index
Definition
lws-pwm.h:27
lws_pwm_map
Definition
lws-pwm.h:25
lws_pwm_ops
Definition
lws-pwm.h:31
lws_pwm_ops::pwm_map
const lws_pwm_map_t * pwm_map
Definition
lws-pwm.h:35
lws_pwm_ops::count_pwm_map
uint8_t count_pwm_map
Definition
lws-pwm.h:36
lws_pwm_ops::intensity
void(* intensity)(const struct lws_pwm_ops *lo, _lws_plat_gpio_t gpio, lws_led_intensity_t inten)
Definition
lws-pwm.h:33
lws_pwm_ops::init
int(* init)(const struct lws_pwm_ops *lo)
Definition
lws-pwm.h:32
include
libwebsockets
lws-pwm.h
Generated on
for libwebsockets by
1.18.0