42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define RADIOSTATION_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.sen = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define RADIOSTATION_RETVAL uint8_t
80#define RADIOSTATION_OK 0x00
81#define RADIOSTATION_INIT_ERROR 0xFF
88#define RADIOSTATION_SLAVE_ADDR0 0x11
89#define RADIOSTATION_SLAVE_ADDR1 0x63
96#define RADIOSTATION_CTS 0x80
97#define RADIOSTATION_ERR 0x40
98#define RADIOSTATION_RDSINT 0x04
99#define RADIOSTATION_ASQINT 0x02
100#define RADIOSTATION_STCINT 0x01
109#define RADIOSTATION_CTS_INTERRUPT_ENABLE 0x04
110#define RADIOSTATION_GPO2_OUTPUT_ENABLE 0x02
111#define RADIOSTATION_PATCH_ENABLE 0x01
114#define RADIOSTATION_MIN_TUNE_FREQ 7600
115#define RADIOSTATION_MAX_TUNE_FREQ 10800
116#define RADIOSTATION_MIN_STEP 5
123#define RADIOSTATION_PROP_GPO_IEN 0x0001
124#define RADIOSTATION_GPO_IEN_ASQREP 0x0200
125#define RADIOSTATION_GPO_IEN_STCREP 0x0100
126#define RADIOSTATION_GPO_IEN_CTSIEN 0x0080
127#define RADIOSTATION_GPO_IEN_ERRIEN 0x0040
128#define RADIOSTATION_GPO_IEN_RDSIEN 0x0004
129#define RADIOSTATION_GPO_IEN_ASQIEN 0x0002
130#define RADIOSTATION_GPO_IEN_STCIENP 0x0001
132#define RADIOSTATION_PROP_REFCLK_FREQ 0x0201
134#define RADIOSTATION_PROP_REFCLK_PRESCALE 0x0202
135#define RADIOSTATION_REFCLK_PRESCALE_RCLK 0x0000 & 0x1000
136#define RADIOSTATION_REFCLK_PRESCALE_DCLK 0x1000 & 0x1000
138#define RADIOSTATION_PROP_TX_COMPONENT_ENABLE 0x2100
139#define RADIOSTATION_TX_COMPONENT_ENABLE_RDS 0x0004
140#define RADIOSTATION_TX_COMPONENT_ENABLE_LEFT_MINUS_RIGHT 0x0002
141#define RADIOSTATION_TX_COMPONENT_ENABLE_PILOT_TONE 0x0001
143#define RADIOSTATION_PROP_TX_AUDIO_DEVIATION 0x2101
145#define RADIOSTATION_PROP_TX_PILOT_DEVIATION 0x2102
147#define RADIOSTATION_PROP_TX_LINE_INPUT_LEVEL 0x2104
148#define RADIOSTATION_TX_LINE_INPUT_LEVEL_LIATTEN_1 0x0000 & 0x3000
149#define RADIOSTATION_TX_LINE_INPUT_LEVEL_LIATTEN_2 0x1000 & 0x3000
150#define RADIOSTATION_TX_LINE_INPUT_LEVEL_LIATTEN_3 0x2000 & 0x3000
151#define RADIOSTATION_TX_LINE_INPUT_LEVEL_LIATTEN_4 0x3000 & 0x3000
152#define RADIOSTATION_TX_LINE_INPUT_LEVEL_MAX_LILEVEL 636 & 0x03FF
154#define RADIOSTATION_PROP_TX_LINE_INPUT_MUTE 0x2105
155#define RADIOSTATION_TX_LINE_INPUT_MUTE_R 0x0001
156#define RADIOSTATION_TX_LINE_INPUT_MUTE_L 0x0002
158#define RADIOSTATION_PROP_TX_PREEMPHASIS 0x2106
159#define RADIOSTATION_TX_PREEMPHASIS_75 0x0000
160#define RADIOSTATION_TX_PREEMPHASIS_50 0x0001
161#define RADIOSTATION_TX_PREEMPHASIS_DISABLED 0x0002
163#define RADIOSTATION_PROP_TX_PILOT_FREQUENCY 0x2107
165#define RADIOSTATION_PROP_TX_ACOMP_ENABLE 0x2200
166#define RADIOSTATION_TX_ACOMP_ENABLE_LIMITEN 0x0002
167#define RADIOSTATION_TX_ACOMP_ENABLE_ACEN 0x0001
169#define RADIOSTATION_PROP_TX_ACOMP_THRESHOLD 0x2201
171#define RADIOSTATION_PROP_TX_ACOMP_ATTACK_TIME 0x2202
172#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_0_5_MS 0x0000
173#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_1_0_MS 0x0001
174#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_1_5_MS 0x0002
175#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_2_0_MS 0x0003
176#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_2_5_MS 0x0004
177#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_3_0_MS 0x0005
178#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_3_5_MS 0x0006
179#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_4_0_MS 0x0007
180#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_4_5_MS 0x0008
181#define RADIOSTATION_TX_ACOMP_ATTACK_TIME_5_0_MS 0x0009
183#define RADIOSTATION_PROP_TX_ACOMP_RELEASE_TIME 0x2203
184#define RADIOSTATION_TX_ACOMP_RELEASE_TIME_100_MS 0x0000
185#define RADIOSTATION_TX_ACOMP_RELEASE_TIME_200_MS 0x0001
186#define RADIOSTATION_TX_ACOMP_RELEASE_TIME_350_MS 0x0002
187#define RADIOSTATION_TX_ACOMP_RELEASE_TIME_525_MS 0x0003
188#define RADIOSTATION_TX_ACOMP_RELEASE_TIME_1000_MS 0x0004
190#define RADIOSTATION_PROP_TX_ACOMP_GAIN 0x2204
192#define RADIOSTATION_PROP_TX_LIMITER_RELEASE_TIME 0x2205
194#define RADIOSTATION_PROP_TX_ASQ_INTERRUPT_SELECT 0x2300
195#define RADIOSTATION_TX_ASQ_INTERRUPT_OVERMODIEN 0x0004
196#define RADIOSTATION_TX_ASQ_INTERRUPT_IALHIEN 0x0002
197#define RADIOSTATION_TX_ASQ_INTERRUPT_IALLIEN 0x0001
199#define RADIOSTATION_PROP_TX_ASQ_LEVEL_LOW 0x2301
201#define RADIOSTATION_PROP_TX_ASQ_LEVEL_HIGH 0x2303
203#define RADIOSTATION_PROP_TX_ASQ_DURATION_LOW 0x2302
205#define RADIOSTATION_PROP_TX_ASQ_DURATION_HIGH 0x2304
#define RADIOSTATION_RETVAL
Definition radiostation.h:78
void radiostation_write(radiostation_t *ctx, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t radiostation_get_asq_status(radiostation_t *ctx, radiostation_cmd_t *cmd, uint8_t *ret_vals)
Radio Station Click ASQ Status.
void radiostation_read(radiostation_t *ctx, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t radiostation_power_down(radiostation_t *ctx, radiostation_cmd_t *cmd)
Radio Station Click Power Down.
uint8_t radiostation_set_property(radiostation_t *ctx, radiostation_cmd_t *cmd, uint16_t property_id, uint16_t property_value)
Radio Station Click Set Property.
uint8_t radiostation_get_tune_measure(radiostation_t *ctx, radiostation_cmd_t *cmd, uint16_t freq, uint8_t capacitance)
Radio Station Click Get Tuning Measurements.
RADIOSTATION_RETVAL radiostation_init(radiostation_t *ctx, radiostation_cfg_t *cfg)
Initialization function.
uint8_t radiostation_set_tune_power(radiostation_t *ctx, radiostation_cmd_t *cmd, uint8_t voltage, uint8_t capacitance)
Radio Station Click Get Revision.
uint8_t radiostation_get_revision1(radiostation_t *ctx, uint8_t *ret_vals)
Radio Station Click Set Tune Frequency.
void radiostation_busy_wait_for_stcint(radiostation_t *ctx, radiostation_cmd_t *cmd)
Radio Station Click Busy Wait for STCINT.
uint8_t radiostation_get_tune_status(radiostation_t *ctx, radiostation_cmd_t *cmd, uint8_t clear_stc_status_bit, uint8_t *ret_vals)
Radio Station Click Get Tune Status.
uint8_t radiostation_power_up_advanced(radiostation_t *ctx, radiostation_cmd_t *cmd, uint8_t config)
Radio Station Click Power Up Advanced.
uint8_t radiostation_set_tune_frequency(radiostation_t *ctx, radiostation_cmd_t *cmd, uint16_t freq)
Radio Station Click Set Tune Frequency.
uint8_t radiostation_get_int_status(radiostation_t *ctx, radiostation_cmd_t *cmd)
Getting int pin status.
uint16_t radiostation_get_property(radiostation_t *ctx, radiostation_cmd_t *cmd, uint16_t property_id)
Radio Station Click Get Property.
void radiostation_default_cfg(radiostation_t *ctx, radiostation_cmd_t *cmd)
Click Default Configuration function.
uint8_t radiostation_power_up(radiostation_t *ctx, radiostation_cmd_t *cmd)
Radio Station Click Power Up.
void radiostation_cfg_setup(radiostation_cfg_t *cfg, bool slave_select)
Config Object Initialization function.
void radiostation_busy_wait_for_rdsint(radiostation_t *ctx, radiostation_cmd_t *cmd)
Radio Station Click Busy Wait for RDSINT.
void radiostation_busy_wait_for_asqint(radiostation_t *ctx, radiostation_cmd_t *cmd)
Radio Station Click Busy Wait for ASQINT.
uint8_t radiostation_get_revision(radiostation_t *ctx, radiostation_cmd_t *cmd, uint8_t *ret_vals)
Radio Station Click Get Revision.
Click configuration structure definition.
Definition radiostation.h:260
uint32_t i2c_speed
Definition radiostation.h:274
bool slave_select
Definition radiostation.h:275
pin_name_t scl
Definition radiostation.h:263
pin_name_t int_pin
Definition radiostation.h:270
pin_name_t sda
Definition radiostation.h:264
pin_name_t sen
Definition radiostation.h:269
pin_name_t rst
Definition radiostation.h:268
Click send command object definition.
Definition radiostation.h:246
uint8_t * ret_vals
Definition radiostation.h:251
uint8_t ret_vals_count
Definition radiostation.h:252
uint8_t * params
Definition radiostation.h:249
uint8_t params_count
Definition radiostation.h:250
Click ctx object definition.
Definition radiostation.h:219
digital_out_t sen
Definition radiostation.h:223
digital_in_t int_pin
Definition radiostation.h:227
i2c_master_t i2c
Definition radiostation.h:231
uint16_t transmit_frequency
Definition radiostation.h:237
digital_out_t rst
Definition radiostation.h:222
uint8_t slave_address
Definition radiostation.h:235
uint8_t status
Definition radiostation.h:238