39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
73#define ISMTX_REG_CFG1 0x00
74#define ISMTX_REG_CFG2 0x01
75#define ISMTX_REG_CFG3 0x02
76#define ISMTX_REG_CFG4 0x03
77#define ISMTX_REG_CFG5 0x04
78#define ISMTX_REG_SHDN 0x05
79#define ISMTX_REG_PA1 0x06
80#define ISMTX_REG_PA2 0x07
81#define ISMTX_REG_PLL1 0x08
82#define ISMTX_REG_PLL2 0x09
83#define ISMTX_REG_CFG6 0x0A
84#define ISMTX_REG_PLL3 0x0B
85#define ISMTX_REG_PLL4 0x0C
86#define ISMTX_REG_PLL5 0x0D
87#define ISMTX_REG_PLL6 0x0E
88#define ISMTX_REG_PLL7 0x0F
89#define ISMTX_REG_CFG7 0x10
90#define ISMTX_REG_CFG8 0x17
91#define ISMTX_REG_CFG9 0x18
92#define ISMTX_REG_ADDL1 0x19
93#define ISMTX_REG_ADDL2 0x1A
111#define ISM_TX_MODULATION_NULL 0
112#define ISM_TX_MODULATION_ASK 1
113#define ISM_TX_MODULATION_FSK 2
119#define ISMTX_CFG_XO_CLK_DELAY 30
120#define ISMTX_CFG_XO_CLK_DIV 31
121#define ISMTX_CFG_FSK_SHAPE 32
122#define ISMTX_CFG_SYNC 33
123#define ISMTX_CFG_MODE 34
124#define ISMTX_CFG_CLKOUT_DELAY 35
125#define ISMTX_CFG_BCLK_POSTDIV 36
126#define ISMTX_CFG_BCLK_PREDIV 37
127#define ISMTX_CFG_PWDN_MODE 38
128#define ISMTX_CFG_PA_MODE 39
129#define ISMTX_CFG_PA_DRIVERS 40
130#define ISMTX_CFG_PA_SHUNT 41
131#define ISMTX_CFG_PA_OFFSET_CUR 42
132#define ISMTX_CFG_PA_PLL_N 43
133#define ISMTX_CFG_PA_LCVCO_DIV 44
134#define ISMTX_CFG_PA_LCVCO_MODE 45
135#define ISMTX_CFG_CP_CURRENT 46
136#define ISMTX_CFG_SPITXEN1 47
137#define ISMTX_CFG_FOURWIRE1 48
138#define ISMTX_CFG_SPITXEN2 49
139#define ISMTX_CFG_FOURWIRE2 50
140#define ISMTX_CFG_DELTAF 51
141#define ISMTX_CFG_DELTAF_SHAPE 52
142#define ISMTX_CFG_TSTEP 53
143#define ISMTX_CFG_EN_LDO 54
144#define ISMTX_CFG_DIS_LDO_FUNC_EN 55
145#define ISMTX_CFG_PLL_LOOP_BAND 56
146#define ISMTX_CFG_LCVCO_FAST_START 57
147#define ISMTX_CFG_LCVCO_PWR 58
153#define ISMTX_XO_CLK_DELAY_NO_CYC 0x00
154#define ISMTX_XO_CLK_DELAY_16_CYC 0x01
155#define ISMTX_XO_CLK_DELAY_32_CYC 0x02
156#define ISMTX_XO_CLK_DELAY_64_CYC 0x03
158#define ISMTX_XO_CLK_DIV_4 0x00
159#define ISMTX_XO_CLK_DIV_5 0x01
160#define ISMTX_XO_CLK_DIV_6 0x02
161#define ISMTX_XO_CLK_DIV_7 0x03
163#define ISMTX_FSK_SHAPE_DISABLED 0x00
164#define ISMTX_FSK_SHAPE_ENABLED 0x01
166#define ISMTX_SYNC_DISABLE 0x00
167#define ISMTX_SYNC_ENABLE 0x01
169#define ISMTX_MODE_ASK 0x00
170#define ISMTX_MODE_FSK 0x01
172#define ISMTX_CLKOUT_DELAY_64_CYC 0x00
173#define ISMTX_CLKOUT_DELAY_128_CYC 0x01
174#define ISMTX_CLKOUT_DELAY_256_CYC 0x02
175#define ISMTX_CLKOUT_DELAY_512_CYC 0x03
177#define ISMTX_PWDN_MODE_SHUTDOWN 0x00
178#define ISMTX_PWDN_MODE_STAMDBY 0x01
179#define ISMTX_PWDN_MODE_FAST_WAKEUP 0x02
180#define ISMTX_PWDN_MODE_FAST_WAKEUP_ 0x03
182#define ISMTX_PA_MODE_NORMAL 0x00
183#define ISMTX_PA_MODE_BOOST 0x01
185#define ISMTX_PA_DRIVERS_1 0x00
186#define ISMTX_PA_DRIVERS_2 0x01
187#define ISMTX_PA_DRIVERS_3 0x02
188#define ISMTX_PA_DRIVERS_4 0x03
189#define ISMTX_PA_DRIVERS_5 0x04
190#define ISMTX_PA_DRIVERS_6 0x05
191#define ISMTX_PA_DRIVERS_7 0x06
192#define ISMTX_PA_DRIVERS_8 0x07
194#define ISMTX_PA_SHUNT_0 0x00
195#define ISMTX_PA_SHUNT_175 0x01
196#define ISMTX_PA_SHUNT_350 0x02
197#define ISMTX_PA_SHUNT_525 0x03
198#define ISMTX_PA_SHUNT_700 0x04
199#define ISMTX_PA_SHUNT_875 0x05
200#define ISMTX_PA_SHUNT_1050 0x06
201#define ISMTX_PA_SHUNT_1225 0x07
202#define ISMTX_PA_SHUNT_1400 0x08
203#define ISMTX_PA_SHUNT_1575 0x09
204#define ISMTX_PA_SHUNT_1750 0x0A
205#define ISMTX_PA_SHUNT_1925 0x0B
206#define ISMTX_PA_SHUNT_2100 0x0C
207#define ISMTX_PA_SHUNT_2275 0x0D
208#define ISMTX_PA_SHUNT_2450 0x0E
209#define ISMTX_PA_SHUNT_2625 0x0F
210#define ISMTX_PA_SHUNT_2800 0x10
211#define ISMTX_PA_SHUNT_2975 0x11
212#define ISMTX_PA_SHUNT_3150 0x12
213#define ISMTX_PA_SHUNT_3325 0x13
214#define ISMTX_PA_SHUNT_3500 0x14
215#define ISMTX_PA_SHUNT_3675 0x15
216#define ISMTX_PA_SHUNT_3850 0x16
217#define ISMTX_PA_SHUNT_4025 0x17
218#define ISMTX_PA_SHUNT_4200 0x18
219#define ISMTX_PA_SHUNT_4375 0x19
220#define ISMTX_PA_SHUNT_4550 0x1A
221#define ISMTX_PA_SHUNT_4725 0x1B
222#define ISMTX_PA_SHUNT_4900 0x1C
223#define ISMTX_PA_SHUNT_5075 0x1D
224#define ISMTX_PA_SHUNT_5250 0x1E
225#define ISMTX_PA_SHUNT_5425 0x1F
227#define ISMTX_PA_OFFSET_CUR_NO 0x00
228#define ISMTX_PA_OFFSET_CUR_5_PCT 0x01
229#define ISMTX_PA_OFFSET_CUR_10_PCT 0x02
230#define ISMTX_PA_OFFSET_CUR_15_PCT 0x03
232#define ISMTX_PA_PLL_N_INT 0x00
233#define ISMTX_PA_PLL_N_FRAC 0x01
235#define ISMTX_PA_LCVCO_DIV_NO 0x00
236#define ISMTX_PA_LCVCO_DIV_4 0x01
237#define ISMTX_PA_LCVCO_DIV_8 0x02
238#define ISMTX_PA_LCVCO_DIV_12 0x03
240#define ISMTX_PA_LCVCO_MODE_RING 0x00
241#define ISMTX_PA_LCVCO_MODE_LC 0x01
243#define ISMTX_CP_CURRENT_5uA 0x00
244#define ISMTX_CP_CURRENT_10uA 0x01
245#define ISMTX_CP_CURRENT_15uA 0x02
246#define ISMTX_CP_CURRENT_20uA 0x03
248#define ISMTX_SPITXEN1_DISABLED 0x00
249#define ISMTX_SPITXEN1_ENABLED 0x01
251#define ISMTX_FOURWIRE1_DISABLED 0x00
252#define ISMTX_FOURWIRE1_ENABLED 0x01
254#define ISMTX_SPITXEN2_DISABLED 0x00
255#define ISMTX_SPITXEN2_ENABLED 0x01
257#define ISMTX_FOURWIRE2_DISABLED 0x00
258#define ISMTX_FOURWIRE2_ENABLED 0x01
260#define ISMTX_BCLK_POSTDIV_1 0x01
261#define ISMTX_BCLK_POSTDIV_2 0x02
262#define ISMTX_BCLK_POSTDIV_3 0x03
263#define ISMTX_BCLK_POSTDIV_4 0x04
264#define ISMTX_BCLK_POSTDIV_5 0x05
282#define ISMTX_MAP_MIKROBUS( cfg, mikrobus ) \
283 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
284 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
285 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
286 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
err_t ismtx_set_frequency(ismtx_t *ctx, uint32_t freq)
Setting specific frequency for transmission.
err_t ismtx_adjust_man_bitrate(ismtx_t *ctx, uint32_t baud)
Adjust manchester baudrate.
err_t ismtx_get_cfg(ismtx_t *ctx, uint8_t cfg_macro, uint8_t *cfg_value)
ISM TX reading configuration.
void ismtx_cfg_setup(ismtx_cfg_t *cfg)
ISM TX configuration object setup function.
err_t ismtx_set_cfg(ismtx_t *ctx, uint8_t cfg_macro, uint8_t cfg_value)
ISM TX writing configuration.
err_t ismtx_transmit_raw_data(ismtx_t *ctx, uint8_t *tx_data, uint8_t tx_len)
Function for trinsmiting data.
err_t ismtx_init(ismtx_t *ctx, ismtx_cfg_t *cfg)
ISM TX initialization function.
err_t ismtx_generic_write(ismtx_t *ctx, uint8_t reg, uint8_t data_in)
ISM TX data writing function.
void ismtx_soft_reset(ismtx_t *ctx)
ISM TX software reset.
err_t ismtx_default_cfg(ismtx_t *ctx)
ISM TX default configuration function.
err_t ismtx_generic_read(ismtx_t *ctx, uint8_t reg, uint8_t *data_out)
ISM TX data reading function.
err_t ismtx_adjust_freq_deviation(ismtx_t *ctx, uint32_t deviation_freq)
Adjust frequency for transmission.
err_t ismtx_transmit_data(ismtx_t *ctx, uint8_t preamble_byte, uint8_t *tx_data, uint8_t tx_data_len)
Function for transmitting data with preamble byte and lenght.
uint32_t ismtx_get_frequency(ismtx_t *ctx)
Getting current frequency for transmission .
ismtx_return_value_t
ISM TX Click return value data.
Definition ismtx.h:335
@ ISMTX_OK
Definition ismtx.h:336
@ ISMTX_ERROR
Definition ismtx.h:337
@ ISMTX_PARAMETER_ERROR
Definition ismtx.h:338
ISM TX Click configuration object.
Definition ismtx.h:316
spi_master_chip_select_polarity_t cs_polarity
Definition ismtx.h:326
pin_name_t sck
Definition ismtx.h:320
spi_master_mode_t spi_mode
Definition ismtx.h:325
pin_name_t mosi
Definition ismtx.h:319
uint32_t spi_speed
Definition ismtx.h:324
pin_name_t miso
Definition ismtx.h:318
pin_name_t cs
Definition ismtx.h:321
ISM TX Click context object.
Definition ismtx.h:296
spi_master_t spi
Definition ismtx.h:301
uint8_t modulation
Definition ismtx.h:307
digital_out_t mosi
Definition ismtx.h:298
spi_master_config_t spi_config
Definition ismtx.h:302
pin_name_t chip_select
Definition ismtx.h:304
pin_name_t tx_data
Definition ismtx.h:305