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 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
59 #define MICRFTX_TRAINING_BYTES { 0xAA, 0xAA, 0xAA, 0xAA }
60 #define MICRFTX_MAN_MSB 0x8000
61 #define MICRFTX_MAN_BIT_LEN_US 2000
62 #define MICRFTX_MAX_DATA_LEN 255
63  // micrftx_cfg
65 
80 #define MICRFTX_MAP_MIKROBUS( cfg, mikrobus ) \
81  cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
82  cfg.din = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
83  cfg.clk = MIKROBUS( mikrobus, MIKROBUS_INT )
84  // micrftx_map // micrftx
87 
92 typedef struct
93 {
94  digital_out_t en;
95  digital_out_t din;
97  digital_in_t clk;
99 } micrftx_t;
100 
105 typedef struct
106 {
107  pin_name_t en;
108  pin_name_t din;
109  pin_name_t clk;
111 } micrftx_cfg_t;
112 
117 typedef enum
118 {
120  MICRFTX_ERROR = -1
121 
123 
140 
154 err_t micrftx_init ( micrftx_t *ctx, micrftx_cfg_t *cfg );
155 
165 
175 
185 
195 
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 #endif // MICRFTX_H
210  // micrftx
212 
213 // ------------------------------------------------------------------------ END
micrftx_t::clk
digital_in_t clk
Definition: micrftx.h:97
micrftx_t::en
digital_out_t en
Definition: micrftx.h:94
micrftx_enable_device
void micrftx_enable_device(micrftx_t *ctx)
MICRF TX enable device function.
MICRFTX_OK
@ MICRFTX_OK
Definition: micrftx.h:119
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:107
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:95
micrftx_return_value_t
micrftx_return_value_t
MICRF TX Click return value data.
Definition: micrftx.h:118
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:109
micrftx_init
err_t micrftx_init(micrftx_t *ctx, micrftx_cfg_t *cfg)
MICRF TX initialization function.
MICRFTX_ERROR
@ MICRFTX_ERROR
Definition: micrftx.h:120
micrftx_cfg_t::din
pin_name_t din
Definition: micrftx.h:108
micrftx_t
MICRF TX Click context object.
Definition: micrftx.h:93
micrftx_cfg_t
MICRF TX Click configuration object.
Definition: micrftx.h:106
micrftx_disable_device
void micrftx_disable_device(micrftx_t *ctx)
MICRF TX disable device function.