bargraph4 2.0.0.0
bargraph4.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 BARGRAPH4_H
29#define BARGRAPH4_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_spi_master.h"
52#include "spi_specifics.h"
53
78#define BARGRAPH4_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
79#define BARGRAPH4_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
80
81 // bargraph4_set
82
97#define BARGRAPH4_MAP_MIKROBUS( cfg, mikrobus ) \
98 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
99 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
100 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
101 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
102 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
103
104 // bargraph4_map
105 // bargraph4
106
111typedef struct
112{
113 // Output pins
114 digital_out_t rst;
116 // Modules
117 spi_master_t spi;
119 pin_name_t chip_select;
122
127typedef struct
128{
129 // Communication gpio pins
130 pin_name_t miso;
131 pin_name_t mosi;
132 pin_name_t sck;
133 pin_name_t cs;
135 // Additional gpio pins
136 pin_name_t rst;
138 // static variable
139 uint32_t spi_speed;
140 spi_master_mode_t spi_mode;
141 spi_master_chip_select_polarity_t cs_polarity;
144
155
168
182
199
215
228err_t bargraph4_set_output ( bargraph4_t *ctx, uint16_t ch_mask );
229
242err_t bargraph4_read_output ( bargraph4_t *ctx, uint16_t *ch_mask );
243
253
263
280
281#ifdef __cplusplus
282}
283#endif
284#endif // BARGRAPH4_H
285
286 // bargraph4
287
288// ------------------------------------------------------------------------ END
bargraph4_level_t
BarGraph 4 Click bar level.
Definition bargraph4.h:174
@ BARGRAPH4_LEVEL_2
Definition bargraph4.h:177
@ BARGRAPH4_LEVEL_4
Definition bargraph4.h:179
@ BARGRAPH4_LEVEL_0
Definition bargraph4.h:175
@ BARGRAPH4_LEVEL_3
Definition bargraph4.h:178
@ BARGRAPH4_LEVEL_1
Definition bargraph4.h:176
bargraph4_sel_ch_t
BarGraph 4 Click select channel.
Definition bargraph4.h:161
@ BARGRAPH4_CHANNEL_A
Definition bargraph4.h:162
@ BARGRAPH4_CHANNEL_B
Definition bargraph4.h:163
@ BARGRAPH4_CHANNEL_C
Definition bargraph4.h:164
@ BARGRAPH4_CHANNEL_D
Definition bargraph4.h:165
bargraph4_return_value_t
BarGraph 4 Click return value data.
Definition bargraph4.h:150
@ BARGRAPH4_ERROR
Definition bargraph4.h:152
@ BARGRAPH4_OK
Definition bargraph4.h:151
void bargraph4_enable_output(bargraph4_t *ctx)
BarGraph 4 enable output function.
void bargraph4_cfg_setup(bargraph4_cfg_t *cfg)
BarGraph 4 configuration object setup function.
err_t bargraph4_set_output(bargraph4_t *ctx, uint16_t ch_mask)
BarGraph 4 set output function.
void bargraph4_disable_output(bargraph4_t *ctx)
BarGraph 4 disable output function.
err_t bargraph4_init(bargraph4_t *ctx, bargraph4_cfg_t *cfg)
BarGraph 4 initialization function.
err_t bargraph4_set_channel_level(bargraph4_t *ctx, bargraph4_sel_ch_t channel, bargraph4_level_t level)
BarGraph 4 set channel level function.
err_t bargraph4_read_output(bargraph4_t *ctx, uint16_t *ch_mask)
BarGraph 4 read output function.
This file contains SPI specific macros, functions, etc.
BarGraph 4 Click configuration object.
Definition bargraph4.h:128
spi_master_chip_select_polarity_t cs_polarity
Definition bargraph4.h:141
pin_name_t sck
Definition bargraph4.h:132
spi_master_mode_t spi_mode
Definition bargraph4.h:140
pin_name_t mosi
Definition bargraph4.h:131
uint32_t spi_speed
Definition bargraph4.h:139
pin_name_t miso
Definition bargraph4.h:130
pin_name_t rst
Definition bargraph4.h:136
pin_name_t cs
Definition bargraph4.h:133
BarGraph 4 Click context object.
Definition bargraph4.h:112
spi_master_t spi
Definition bargraph4.h:117
digital_out_t rst
Definition bargraph4.h:114
pin_name_t chip_select
Definition bargraph4.h:119