ledflash 2.0.0.0
ledflash.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef LEDFLASH_H
36#define LEDFLASH_H
37
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54
55// -------------------------------------------------------------- PUBLIC MACROS
65#define LEDFLASH_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.ch_ena = MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.fls = MIKROBUS( mikrobus, MIKROBUS_RST ); \
68 cfg.tor = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
69 cfg.flg = MIKROBUS( mikrobus, MIKROBUS_INT );
76#define LEDFLASH_RETVAL uint8_t
77
78#define LEDFLASH_OK 0x00
79#define LEDFLASH_INIT_ERROR 0xFF
82 // End group macro
83// --------------------------------------------------------------- PUBLIC TYPES
92typedef struct
93{
94 // Output pins
95
96 digital_out_t ch_ena;
97 digital_out_t fls;
98 digital_out_t tor;
99
100 // Input pins
101
102 digital_in_t flg;
103
104} ledflash_t;
105
109typedef struct
110{
111 // Additional gpio pins
112
113 pin_name_t ch_ena;
114 pin_name_t fls;
115 pin_name_t tor;
116 pin_name_t flg;
117
119
120 // End types group
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
150
159
168
177
186
195
204
216
217#ifdef __cplusplus
218}
219#endif
220#endif // _LEDFLASH_H_
221
222 // End public_function group
224
225// ------------------------------------------------------------------------- END
#define LEDFLASH_RETVAL
Definition ledflash.h:76
void ledflash_char_supcap_disable(ledflash_t *ctx)
Charge Supercapacitor Disable function.
void ledflash_cfg_setup(ledflash_cfg_t *cfg)
Config Object Initialization function.
LEDFLASH_RETVAL ledflash_init(ledflash_t *ctx, ledflash_cfg_t *cfg)
Initialization function.
void ledflash_char_supcap_enable(ledflash_t *ctx)
Charge Supercapacitor Enable function.
void ledflash_flash_disable(ledflash_t *ctx)
Flash Disable function.
void ledflash_flash_enable(ledflash_t *ctx)
Flash Enable function.
uint8_t ledflash_flash_rdy_flag(ledflash_t *ctx)
Check Flash Ready Flag function.
void ledflash_torch_disable(ledflash_t *ctx)
Torch Disable function.
void ledflash_torch_enable(ledflash_t *ctx)
Torch Enable function.
Click configuration structure definition.
Definition ledflash.h:110
pin_name_t flg
Definition ledflash.h:116
pin_name_t fls
Definition ledflash.h:114
pin_name_t tor
Definition ledflash.h:115
pin_name_t ch_ena
Definition ledflash.h:113
Click ctx object definition.
Definition ledflash.h:93
digital_out_t ch_ena
Definition ledflash.h:96
digital_in_t flg
Definition ledflash.h:102
digital_out_t tor
Definition ledflash.h:98
digital_out_t fls
Definition ledflash.h:97