micrftx  2.1.0.0
micrftx.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 MICRFTX_H
29 #define MICRFTX_H
30 
31 #ifdef __cplusplus
32 extern "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 
73 #define MICRFTX_TRAINING_BYTES { 0xAA, 0xAA, 0xAA, 0xAA }
74 #define MICRFTX_MAN_MSB 0x8000
75 #define MICRFTX_MAN_BIT_LEN_US 2000
76 #define MICRFTX_MAX_DATA_LEN 255
77  // micrftx_cfg
79 
94 #define MICRFTX_MAP_MIKROBUS( cfg, mikrobus ) \
95  cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
96  cfg.din = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
97  cfg.clk = MIKROBUS( mikrobus, MIKROBUS_INT )
98  // micrftx_map // micrftx
101 
106 typedef struct
107 {
108  digital_out_t en;
109  digital_out_t din;
111  digital_in_t clk;
113 } micrftx_t;
114 
119 typedef struct
120 {
121  pin_name_t en;
122  pin_name_t din;
123  pin_name_t clk;
125 } micrftx_cfg_t;
126 
131 typedef enum
132 {
134  MICRFTX_ERROR = -1
135 
137 
154 
168 err_t micrftx_init ( micrftx_t *ctx, micrftx_cfg_t *cfg );
169 
179 
189 
199 
209 
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 #endif // MICRFTX_H
224  // micrftx
226 
227 // ------------------------------------------------------------------------ END
micrftx_t::clk
digital_in_t clk
Definition: micrftx.h:111
micrftx_t::en
digital_out_t en
Definition: micrftx.h:108
micrftx_enable_device
void micrftx_enable_device(micrftx_t *ctx)
MICRF TX enable device function.
MICRFTX_OK
@ MICRFTX_OK
Definition: micrftx.h:133
micrftx_clear_data_pin
void micrftx_clear_data_pin(micrftx_t *ctx)
MICRF TX clear data pin function.
micrftx_cfg_t::en
pin_name_t en
Definition: micrftx.h:121
micrftx_set_data_pin
void micrftx_set_data_pin(micrftx_t *ctx)
MICRF TX set data pin function.
micrftx_t::din
digital_out_t din
Definition: micrftx.h:109
micrftx_return_value_t
micrftx_return_value_t
MICRF TX Click return value data.
Definition: micrftx.h:132
micrftx_get_clock_pin
uint8_t micrftx_get_clock_pin(micrftx_t *ctx)
MICRF TX get clock pin function.
micrftx_cfg_setup
void micrftx_cfg_setup(micrftx_cfg_t *cfg)
MICRF TX configuration object setup function.
micrftx_cfg_t::clk
pin_name_t clk
Definition: micrftx.h:123
micrftx_init
err_t micrftx_init(micrftx_t *ctx, micrftx_cfg_t *cfg)
MICRF TX initialization function.
MICRFTX_ERROR
@ MICRFTX_ERROR
Definition: micrftx.h:134
micrftx_cfg_t::din
pin_name_t din
Definition: micrftx.h:122
micrftx_t
MICRF TX Click context object.
Definition: micrftx.h:107
micrftx_cfg_t
MICRF TX Click configuration object.
Definition: micrftx.h:120
micrftx_disable_device
void micrftx_disable_device(micrftx_t *ctx)
MICRF TX disable device function.