c7segrgb  2.0.0.0
c7segrgb.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 C7SEGRGB_H
36 #define C7SEGRGB_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define C7SEGRGB_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
53  cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
54 
60 #define C7SEGRGB_RETVAL uint8_t
61 
62 #define C7SEGRGB_OK 0x00
63 #define C7SEGRGB_INIT_ERROR 0xFF
64 
70 #define C7SEGRGB_ONE 0x06
71 #define C7SEGRGB_TWO 0x5B
72 #define C7SEGRGB_THREE 0x4F
73 #define C7SEGRGB_FOUR 0x66
74 #define C7SEGRGB_FIVE 0x6D
75 #define C7SEGRGB_SIX 0x7D
76 #define C7SEGRGB_SEVEN 0x07
77 #define C7SEGRGB_EIGHT 0x7F
78 #define C7SEGRGB_NINE 0x6F
79 #define C7SEGRGB_ZERO 0x3F
80 #define C7SEGRGB_POINT 0x80
81  // End group macro
86 // --------------------------------------------------------------- PUBLIC TYPES
95 typedef struct
96 {
97  // Output pins
98 
99  digital_out_t cs;
100  digital_out_t pwm;
101 
102 } c7segrgb_t;
103 
107 typedef struct
108 {
109  // Additional gpio pins
110 
111  pin_name_t cs;
112  pin_name_t pwm;
113 
115  // End types group
117 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
118 
124 #ifdef __cplusplus
125 extern "C"{
126 #endif
127 
136 void c7segrgb_cfg_setup ( c7segrgb_cfg_t *cfg );
137 
146 
154 void c7segrgb_cs_low ( c7segrgb_t *ctx );
155 
163 void c7segrgb_cs_high ( c7segrgb_t *ctx );
164 
172 void c7segrgb_pwm_low ( c7segrgb_t *ctx );
173 
181 void c7segrgb_pwm_high( c7segrgb_t *ctx );
182 
191 float c7segrgb_get_delay_value ( uint8_t cyc_num );
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 #endif // _C7SEGRGB_H_
197  // End public_function group
200 
201 // ------------------------------------------------------------------------- END
C7SEGRGB_RETVAL c7segrgb_init(c7segrgb_t *ctx, c7segrgb_cfg_t *cfg)
Initialization function.
void c7segrgb_cs_high(c7segrgb_t *ctx)
Sets the state high of CS pin function.
pin_name_t pwm
Definition: c7segrgb.h:112
Click ctx object definition.
Definition: c7segrgb.h:95
pin_name_t cs
Definition: c7segrgb.h:111
#define C7SEGRGB_RETVAL
Definition: c7segrgb.h:60
float c7segrgb_get_delay_value(uint8_t cyc_num)
Get delay value.
void c7segrgb_pwm_high(c7segrgb_t *ctx)
Sets the state high of PWM pin function.
digital_out_t cs
Definition: c7segrgb.h:99
digital_out_t pwm
Definition: c7segrgb.h:100
void c7segrgb_cs_low(c7segrgb_t *ctx)
Sets the state low of CS pin function.
Click configuration structure definition.
Definition: c7segrgb.h:107
void c7segrgb_cfg_setup(c7segrgb_cfg_t *cfg)
Config Object Initialization function.
void c7segrgb_pwm_low(c7segrgb_t *ctx)
Sets the state low of PWM pin function.