ooktx  2.0.0.0
ooktx.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 OOKTX_H
36 #define OOKTX_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define OOKTX_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_CS ); \
53  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_PWM )
54 
60 #define OOKTX_RETVAL uint8_t
61 
62 #define OOKTX_OK 0x00
63 #define OOKTX_INIT_ERROR 0xFF
64 
70 #define OOKTX_CALIBRATION_ENABLE 0x01
71 #define OOKTX_CALIBRATION_DISABLE 0x00
72 #define OOKTX_CONFIGURATION_ENABLE 0x01
73 #define OOKTX_CONFIGURATION_DISABLE 0x00
74 #define OOKTX_CFG_DEFAULT 0xF6F0
75 #define OOKTX_CFG_F_433MHZ 0xF000
76 #define OOKTX_CFG_CX_18PF 0x0600
77 #define OOKTX_CFG_P_13DB 0x00F0
78 #define OOKTX_CFG_P_10DB 0x00C0
79 #define OOKTX_CFG_P_7DB 0x0090
80 #define OOKTX_CFG_P_3DB 0x0050
81 #define OOKTX_CFG_P_0DB 0x0020
82 #define OOKTX_CFG_CT_0PF 0x0000
83 #define OOKTX_PREAMBULE 0xAA
84  // End group macro
87 // --------------------------------------------------------------- PUBLIC TYPES
96 typedef struct
97 {
98  // Output pins
99 
100  digital_out_t sda;
101  digital_out_t scl;
102 
103 } ooktx_t;
104 
108 typedef struct
109 {
110  // Additional gpio pins
111 
112  pin_name_t sda;
113  pin_name_t scl;
114 
115 } ooktx_cfg_t;
116  // End types group
118 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
119 
125 #ifdef __cplusplus
126 extern "C"{
127 #endif
128 
137 void ooktx_cfg_setup ( ooktx_cfg_t *cfg );
138 
147 
158 void ooktx_communication_init ( ooktx_t *ctx, uint8_t calibration,
159  uint8_t configuration, uint16_t cfg_settings );
167 void ooktx_communication_stop ( ooktx_t *ctx );
168 
177 void ooktx_communication_transmit ( ooktx_t *ctx, uint8_t transmit_data );
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 #endif // _OOKTX_H_
183  // End public_function group
186 
187 // ------------------------------------------------------------------------- END
pin_name_t scl
Definition: ooktx.h:113
digital_out_t sda
Definition: ooktx.h:100
digital_out_t scl
Definition: ooktx.h:101
OOKTX_RETVAL ooktx_init(ooktx_t *ctx, ooktx_cfg_t *cfg)
Initialization function.
pin_name_t sda
Definition: ooktx.h:112
void ooktx_communication_init(ooktx_t *ctx, uint8_t calibration, uint8_t configuration, uint16_t cfg_settings)
Communication initiation function.
#define OOKTX_RETVAL
Definition: ooktx.h:60
Click ctx object definition.
Definition: ooktx.h:96
void ooktx_communication_stop(ooktx_t *ctx)
Communication stop function.
Click configuration structure definition.
Definition: ooktx.h:108
void ooktx_cfg_setup(ooktx_cfg_t *cfg)
Config Object Initialization function.
void ooktx_communication_transmit(ooktx_t *ctx, uint8_t transmit_data)
Communication transmit function.