ozone2
2.0.0.0
clicks
ozone2
lib
include
ozone2.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 OZONE2_H
36
#define OZONE2_H
37
38
#include "drv_digital_out.h"
39
#include "drv_digital_in.h"
40
#include "drv_spi_master.h"
41
42
43
// -------------------------------------------------------------- PUBLIC MACROS
54
#define OZONE2_MAP_MIKROBUS( cfg, mikrobus ) \
55
cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
56
cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
57
cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
58
cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
59
cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
60
66
#define OZONE2_RETVAL uint8_t
67
68
#define OZONE2_OK 0x00
69
#define OZONE2_INIT_ERROR 0xFF
70
// End group macro
73
// --------------------------------------------------------------- PUBLIC TYPES
82
typedef
struct
83
{
84
// Output pins
85
digital_out_t
cs
;
86
87
// Input pins
88
digital_in_t
an
;
89
digital_in_t
miso
;
90
91
// Modules
92
spi_master_t
spi
;
93
pin_name_t
chip_select
;
94
95
}
ozone2_t
;
96
100
typedef
struct
101
{
102
// Communication gpio pins
103
104
pin_name_t
miso
;
105
pin_name_t
sck
;
106
pin_name_t
cs
;
107
pin_name_t
mosi
;
108
109
// Additional gpio pins
110
111
pin_name_t
an
;
112
113
// static variable
114
115
uint32_t
spi_speed
;
116
spi_master_mode_t
spi_mode
;
117
spi_master_chip_select_polarity_t
cs_polarity
;
118
119
}
ozone2_cfg_t
;
120
121
// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
127
#ifdef __cplusplus
128
extern
"C"
{
129
#endif
130
139
void
ozone2_cfg_setup
(
ozone2_cfg_t
*cfg );
140
148
OZONE2_RETVAL
ozone2_init
(
ozone2_t
*ctx,
ozone2_cfg_t
*cfg );
149
158
uint32_t
ozone2_read
(
ozone2_t
*ctx );
159
160
161
#ifdef __cplusplus
162
}
163
#endif
164
#endif // _OZONE2_H_
165
// End public_function group
168
169
// ------------------------------------------------------------------------- END
ozone2_t::cs
digital_out_t cs
Definition:
ozone2.h:85
ozone2_read
uint32_t ozone2_read(ozone2_t *ctx)
Ozone 2 click read.
ozone2_t::chip_select
pin_name_t chip_select
Definition:
ozone2.h:93
ozone2_t::spi
spi_master_t spi
Definition:
ozone2.h:92
ozone2_cfg_t::miso
pin_name_t miso
Definition:
ozone2.h:104
ozone2_cfg_t::an
pin_name_t an
Definition:
ozone2.h:111
ozone2_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition:
ozone2.h:116
OZONE2_RETVAL
#define OZONE2_RETVAL
Definition:
ozone2.h:66
ozone2_cfg_t::sck
pin_name_t sck
Definition:
ozone2.h:105
ozone2_cfg_t::mosi
pin_name_t mosi
Definition:
ozone2.h:107
ozone2_init
OZONE2_RETVAL ozone2_init(ozone2_t *ctx, ozone2_cfg_t *cfg)
Initialization function.
ozone2_t::an
digital_in_t an
Definition:
ozone2.h:88
ozone2_cfg_t::cs
pin_name_t cs
Definition:
ozone2.h:106
ozone2_cfg_t::spi_speed
uint32_t spi_speed
Definition:
ozone2.h:115
ozone2_t::miso
digital_in_t miso
Definition:
ozone2.h:89
ozone2_t
Click ctx object definition.
Definition:
ozone2.h:82
ozone2_cfg_setup
void ozone2_cfg_setup(ozone2_cfg_t *cfg)
Config Object Initialization function.
ozone2_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition:
ozone2.h:117
ozone2_cfg_t
Click configuration structure definition.
Definition:
ozone2.h:100
Generated by
1.8.16