leddriver13 2.0.0.0
leddriver13.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef LEDDRIVER13_H
29#define LEDDRIVER13_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_pwm.h"
52
73#define LEDDRIVER13_DEF_FREQ 5000
74
75#define LEDDRIVER13_FAULT_OCCURS 0
76#define LEDDRIVER13_CONDITION_OK 1
77
78 // leddriver13_cfg
79
94#define LEDDRIVER13_MAP_MIKROBUS( cfg, mikrobus ) \
95 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
96 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
97 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT );
98
99 // leddriver13_map
100 // leddriver13
101
111typedef struct
112{
113 // Output pins
114 digital_out_t en;
116 // Input pins
117 digital_in_t flt;
119 // Modules
120 pwm_t pwm;
122 // ctx variable
123 uint32_t pwm_freq;
126
131typedef struct
132{
133 // Communication gpio pins
134 pin_name_t pwm;
136 // Additional gpio pins
137 pin_name_t en;
138 pin_name_t flt;
140 // Static variable
141 uint32_t dev_pwm_freq;
144
155
172
188
203
216err_t leddriver13_set_duty_cycle ( leddriver13_t *ctx, float duty_cycle );
217
230
243
257
271
286
287#ifdef __cplusplus
288}
289#endif
290#endif // LEDDRIVER13_H
291
292 // leddriver13
293
294// ------------------------------------------------------------------------ END
uint8_t leddriver13_get_fault(leddriver13_t *ctx)
LED Driver 13 get fault function.
err_t leddriver13_default_cfg(leddriver13_t *ctx)
LED Driver 13 default configuration function.
void leddriver13_cfg_setup(leddriver13_cfg_t *cfg)
LED Driver 13 configuration object setup function.
err_t leddriver13_pwm_stop(leddriver13_t *ctx)
LED Driver 13 stop PWM module.
err_t leddriver13_set_enable(leddriver13_t *ctx)
LED Driver 13 set enable function.
err_t leddriver13_set_duty_cycle(leddriver13_t *ctx, float duty_cycle)
LED Driver 13 sets PWM duty cycle.
err_t leddriver13_init(leddriver13_t *ctx, leddriver13_cfg_t *cfg)
LED Driver 13 initialization function.
err_t leddriver13_set_disable(leddriver13_t *ctx)
LED Driver 13 set disable function.
err_t leddriver13_pwm_start(leddriver13_t *ctx)
LED Driver 13 start PWM module.
leddriver13_return_value_t
LED Driver 13 Click return value data.
Definition leddriver13.h:150
@ LEDDRIVER13_ERROR
Definition leddriver13.h:152
@ LEDDRIVER13_OK
Definition leddriver13.h:151
LED Driver 13 Click configuration object.
Definition leddriver13.h:132
uint32_t dev_pwm_freq
Definition leddriver13.h:141
pin_name_t flt
Definition leddriver13.h:138
pin_name_t en
Definition leddriver13.h:137
pin_name_t pwm
Definition leddriver13.h:134
LED Driver 13 Click driver selector.
Definition leddriver13.h:112
digital_in_t flt
Definition leddriver13.h:117
uint32_t pwm_freq
Definition leddriver13.h:123
digital_out_t en
Definition leddriver13.h:114
pwm_t pwm
Definition leddriver13.h:120