nanopower  2.0.0.0
nanopower.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 NANOPOWER_H
36 #define NANOPOWER_H
37 
38 #include "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 
51 // -------------------------------------------------------------- PUBLIC MACROS
57 #define NANOPW_ENABLE_DEVICE 1
58 #define NANOPW_DISABLE_DEVICE 0
59 
64 #define NANOPOWER_MAP_MIKROBUS( cfg, mikrobus ) \
65  cfg.en= MIKROBUS( mikrobus, MIKROBUS_CS );
66 
72 #define NANOPOWER_RETVAL uint8_t
73 
74 #define NANOPOWER_OK 0x00
75 #define NANOPOWER_INIT_ERROR 0xFF
76  // End group macro
79 // --------------------------------------------------------------- PUBLIC TYPES
88 typedef struct
89 {
90 
91  digital_out_t en;
92 
93 } nanopower_t;
94 
98 typedef struct
99 {
100 
101  pin_name_t en;
102 
104  // End types group
106 
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
127 
136 
146 void nanopw_enable_device ( nanopower_t *ctx, const uint8_t state );
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 #endif // _NANOPOWER_H_
152  // End public_function group
155 
156 // ------------------------------------------------------------------------- END
nanopower_cfg_t::en
pin_name_t en
Definition: nanopower.h:101
nanopower_t::en
digital_out_t en
Definition: nanopower.h:91
nanopower_t
Click ctx object definition.
Definition: nanopower.h:89
nanopower_init
NANOPOWER_RETVAL nanopower_init(nanopower_t *ctx, nanopower_cfg_t *cfg)
Initialization function.
nanopw_enable_device
void nanopw_enable_device(nanopower_t *ctx, const uint8_t state)
Click Enable function.
nanopower_cfg_setup
void nanopower_cfg_setup(nanopower_cfg_t *cfg)
Config Object Initialization function.
NANOPOWER_RETVAL
#define NANOPOWER_RETVAL
Definition: nanopower.h:72
nanopower_cfg_t
Click configuration structure definition.
Definition: nanopower.h:99