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 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define LEDFLASH_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.ch_ena = MIKROBUS( mikrobus, MIKROBUS_AN ); \
53  cfg.fls = MIKROBUS( mikrobus, MIKROBUS_RST ); \
54  cfg.tor = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
55  cfg.flg = MIKROBUS( mikrobus, MIKROBUS_INT );
56 
62 #define LEDFLASH_RETVAL uint8_t
63 
64 #define LEDFLASH_OK 0x00
65 #define LEDFLASH_INIT_ERROR 0xFF
66  // End group macro
69 // --------------------------------------------------------------- PUBLIC TYPES
78 typedef struct
79 {
80  // Output pins
81 
82  digital_out_t ch_ena;
83  digital_out_t fls;
84  digital_out_t tor;
85 
86  // Input pins
87 
88  digital_in_t flg;
89 
90 } ledflash_t;
91 
95 typedef struct
96 {
97  // Additional gpio pins
98 
99  pin_name_t ch_ena;
100  pin_name_t fls;
101  pin_name_t tor;
102  pin_name_t flg;
103 
105  // End types group
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
127 
136 
145 
154 
163 
172 
181 
190 
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 #endif // _LEDFLASH_H_
207  // End public_function group
210 
211 // ------------------------------------------------------------------------- END
ledflash_torch_enable
void ledflash_torch_enable(ledflash_t *ctx)
Torch Enable function.
ledflash_t::fls
digital_out_t fls
Definition: ledflash.h:83
ledflash_flash_disable
void ledflash_flash_disable(ledflash_t *ctx)
Flash Disable function.
ledflash_cfg_t
Click configuration structure definition.
Definition: ledflash.h:96
ledflash_cfg_setup
void ledflash_cfg_setup(ledflash_cfg_t *cfg)
Config Object Initialization function.
ledflash_char_supcap_disable
void ledflash_char_supcap_disable(ledflash_t *ctx)
Charge Supercapacitor Disable function.
ledflash_cfg_t::ch_ena
pin_name_t ch_ena
Definition: ledflash.h:99
ledflash_cfg_t::tor
pin_name_t tor
Definition: ledflash.h:101
ledflash_t::flg
digital_in_t flg
Definition: ledflash.h:88
ledflash_t::tor
digital_out_t tor
Definition: ledflash.h:84
ledflash_torch_disable
void ledflash_torch_disable(ledflash_t *ctx)
Torch Disable function.
ledflash_t::ch_ena
digital_out_t ch_ena
Definition: ledflash.h:82
ledflash_t
Click ctx object definition.
Definition: ledflash.h:79
ledflash_flash_rdy_flag
uint8_t ledflash_flash_rdy_flag(ledflash_t *ctx)
Check Flash Ready Flag function.
LEDFLASH_RETVAL
#define LEDFLASH_RETVAL
Definition: ledflash.h:62
ledflash_flash_enable
void ledflash_flash_enable(ledflash_t *ctx)
Flash Enable function.
ledflash_cfg_t::flg
pin_name_t flg
Definition: ledflash.h:102
ledflash_char_supcap_enable
void ledflash_char_supcap_enable(ledflash_t *ctx)
Charge Supercapacitor Enable function.
ledflash_cfg_t::fls
pin_name_t fls
Definition: ledflash.h:100
ledflash_init
LEDFLASH_RETVAL ledflash_init(ledflash_t *ctx, ledflash_cfg_t *cfg)
Initialization function.