Go to the documentation of this file.
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_i2c_master.h"
74 #define LTECAT12_MAX9860_REG_INTR_STATS 0x00
75 #define LTECAT12_MAX9860_REG_MIC_NG_AGC 0x01
76 #define LTECAT12_MAX9860_REG_INTR_EN 0x02
77 #define LTECAT12_MAX9860_REG_SYS_CLK 0x03
78 #define LTECAT12_MAX9860_REG_STEREO_CLK_MSB 0x04
79 #define LTECAT12_MAX9860_REG_STEREO_CLK_LSB 0x05
80 #define LTECAT12_MAX9860_REG_AUDIO_INTERFACE_1 0x06
81 #define LTECAT12_MAX9860_REG_AUDIO_INTERFACE_2 0x07
82 #define LTECAT12_MAX9860_REG_VOICE_FILTER 0x08
83 #define LTECAT12_MAX9860_REG_DAC_ATTENUATION 0x09
84 #define LTECAT12_MAX9860_REG_ADC_OUTPUT_LEVELS 0x0A
85 #define LTECAT12_MAX9860_REG_DAC_GAIN 0x0B
86 #define LTECAT12_MAX9860_REG_MIC_GAIN 0x0C
87 #define LTECAT12_MAX9860_REG_MIC_AGC 0x0E
88 #define LTECAT12_MAX9860_REG_NOISE_GATE 0x0F
89 #define LTECAT12_MAX9860_REG_SYS_SHUTDOWN 0x10
95 #define LTECAT12_CMD_AT "AT"
96 #define LTECAT12_CMD_ATI "ATI"
97 #define LTECAT12_CMD_CFUN "AT+CFUN"
98 #define LTECAT12_CMD_CREG "AT+CREG"
99 #define LTECAT12_CMD_CGDCONT "AT+CGDCONT"
100 #define LTECAT12_CMD_CESQ "AT+CESQ"
101 #define LTECAT12_CMD_COPS "AT+COPS"
102 #define LTECAT12_CMD_CMGS "AT+CMGS"
103 #define LTECAT12_CMD_CMGF "AT+CMGF"
104 #define LTECAT12_CMD_CGPADDR "AT+CGPADDR"
105 #define LTECAT12_CMD_SICA "AT^SICA"
106 #define LTECAT12_CMD_SISS "AT^SISS"
107 #define LTECAT12_CMD_SISO "AT^SISO"
108 #define LTECAT12_CMD_SISW "AT^SISW"
109 #define LTECAT12_CMD_SISR "AT^SISR"
110 #define LTECAT12_CMD_SISC "AT^SISC"
111 #define LTECAT12_CMD_SGPSC "AT^SGPSC"
112 #define LTECAT12_CMD_CHUP "AT+CHUP"
113 #define LTECAT12_CMD_SCFG "AT^SCFG"
114 #define LTECAT12_CMD_SAIC "AT^SAIC"
115 #define LTECAT12_CMD_SNFS "AT^SNFS"
116 #define LTECAT12_CMD_ATD "ATD"
122 #define LTECAT12_PSCLK_12MHZ 0x10
123 #define LTECAT12_LRCLK_8MHZ_MSB 0x10
124 #define LTECAT12_LRCLK_8MHZ_LSB 0x00
125 #define LTECAT12_DBCI_FALLING_EDGE 0x20
126 #define LTECAT12_HIZ_ENABLE 0x08
127 #define LTECAT12_TDM_ENABLE 0x04
128 #define LTECAT12_ABCI_FALLING_EDGE 0x20
129 #define LTECAT12_ADLY_ENABLE 0x10
130 #define LTECAT12_STEREO_ENABLE 0x08
131 #define LTECAT12_AVFLT_DISABLE 0x00
132 #define LTECAT12_DVFLT_DISABLE 0x00
133 #define LTECAT12_DVA_GAIN_0 0x06
134 #define LTECAT12_ADC_GAIN_3 0x00
135 #define LTECAT12_DAC_GAIN_0 0x00
136 #define LTECAT12_DVST_GAIN_0 0x01
137 #define LTECAT12_MIC_GAIN_0 0x20
138 #define LTECAT12_PGAM_GAIN_0 0x14
139 #define LTECAT12_AGCSRC_ENABLE 0x80
140 #define LTECAT12_ANTH_DISABLE 0x00
141 #define LTECAT12_AGCTH_MINUS_3 0x00
142 #define LTECAT12_POWER_ON 0x80
143 #define LTECAT12_DAC_ENABLE 0x08
144 #define LTECAT12_ADCL_ADCR_ENABLE 0x03
150 #define LTECAT12_PIN_STATE_HIGH 0x01
151 #define LTECAT12_PIN_STATE_LOW 0x00
157 #define LTECAT12_RSP_OK "OK"
158 #define LTECAT12_RSP_ERROR "ERROR"
159 #define LTECAT12_RSP_SYSSTART "^SYSSTART"
165 #define LTECAT12_POWER_STATE_SWITCH 0
166 #define LTECAT12_POWER_STATE_ON 1
167 #define LTECAT12_POWER_STATE_REBOOT 2
174 #define LTECAT12_TX_DRV_BUFFER_SIZE 300
175 #define LTECAT12_RX_DRV_BUFFER_SIZE 300
182 #define LTECAT12_ADDRESS 0x10
200 #define LTECAT12_MAP_MIKROBUS( cfg, mikrobus ) \
201 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
202 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
203 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
204 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
205 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
206 cfg.fsd = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
207 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT );
void ltecat12_send_cmd_with_params(ltecat12_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
LTE Cat.1 2 send command function with parameter.
void ltecat12_send_cmd_parameter_check(ltecat12_t *ctx, uint8_t *at_cmd_buf)
LTE Cat.1 2 check the command parameters.
pin_name_t rx_pin
Definition: ltecat12.h:245
@ LTECAT12_OK
Definition: ltecat12.h:272
err_t ltecat12_init(ltecat12_t *ctx, ltecat12_cfg_t *cfg)
LTE Cat.1 2 initialization function.
ltecat12_return_value_t
LTE Cat.1 2 Click return value data.
Definition: ltecat12.h:271
pin_name_t cts
Definition: ltecat12.h:251
uart_t uart
Definition: ltecat12.h:227
err_t ltecat12_generic_write(ltecat12_t *ctx, uint8_t *data_in, uint16_t len)
LTE Cat.1 2 data writing function.
@ LTECAT12_ERROR
Definition: ltecat12.h:273
#define LTECAT12_RX_DRV_BUFFER_SIZE
Definition: ltecat12.h:175
#define LTECAT12_TX_DRV_BUFFER_SIZE
LTE Cat.1 2 driver buffer size.
Definition: ltecat12.h:174
bool uart_blocking
Definition: ltecat12.h:257
uart_data_bits_t data_bit
Definition: ltecat12.h:258
@ LTECAT12_ERROR_UNKNOWN
Definition: ltecat12.h:276
void ltecat12_set_fsd_pin(ltecat12_t *ctx, uint8_t state)
LTE Cat.1 2 set fsd pin function.
uart_parity_t parity_bit
Definition: ltecat12.h:259
void ltecat12_send_cmd_check(ltecat12_t *ctx, uint8_t *at_cmd_buf)
LTE Cat.1 2 check the sent command.
uint32_t baud_rate
Definition: ltecat12.h:256
@ LTECAT12_ERROR_TIMEOUT
Definition: ltecat12.h:274
err_t ltecat12_generic_read(ltecat12_t *ctx, uint8_t *data_out, uint16_t len)
LTE Cat.1 2 data reading function.
digital_out_t rts
Definition: ltecat12.h:219
pin_name_t tx_pin
Definition: ltecat12.h:246
void ltecat12_send_cmd(ltecat12_t *ctx, uint8_t *cmd)
LTE Cat.1 2 send command function.
err_t ltecat12_send_sms_pdu(ltecat12_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
LTE Cat.1 2 send SMS in PDU mode.
uart_stop_bits_t stop_bit
Definition: ltecat12.h:260
pin_name_t rts
Definition: ltecat12.h:253
void ltecat12_send_sms_text(ltecat12_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
LTE Cat.1 2 send SMS in text mode.
uint8_t i2c_address
Definition: ltecat12.h:262
void ltecat12_set_sim_apn(ltecat12_t *ctx, uint8_t *sim_apn)
LTE Cat.1 2 set sim card APN.
@ LTECAT12_ERROR_CMD
Definition: ltecat12.h:275
pin_name_t scl
Definition: ltecat12.h:247
digital_in_t cts
Definition: ltecat12.h:223
err_t ltecat12_read_register(ltecat12_t *ctx, uint8_t reg, uint8_t *data_out)
LTE Cat.1 2 MAX9860 reading function.
void ltecat12_cfg_setup(ltecat12_cfg_t *cfg)
LTE Cat.1 2 configuration object setup function.
uint32_t i2c_speed
Definition: ltecat12.h:261
uint8_t slave_address
Definition: ltecat12.h:230
pin_name_t sda
Definition: ltecat12.h:248
digital_out_t fsd
Definition: ltecat12.h:220
LTE Cat.1 2 Click configuration object.
Definition: ltecat12.h:243
err_t ltecat12_write_register(ltecat12_t *ctx, uint8_t reg, uint8_t data_in)
LTE Cat.1 2 MAX9860 writing function.
i2c_master_t i2c
Definition: ltecat12.h:226
pin_name_t fsd
Definition: ltecat12.h:252
LTE Cat.1 2 Click context object.
Definition: ltecat12.h:217
void ltecat12_set_rts_pin(ltecat12_t *ctx, uint8_t state)
LTE Cat.1 2 set rts pin function.
err_t ltecat12_max9860_cfg(ltecat12_t *ctx)
LTE Cat.1 2 MAX9860 configuration function.
uint8_t ltecat12_get_cts_pin(ltecat12_t *ctx)
LTE Cat.1 2 get cts pin function.