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 LTECAT4_MAX9860_REG_INTR_STATS 0x00
75 #define LTECAT4_MAX9860_REG_MIC_NG_AGC 0x01
76 #define LTECAT4_MAX9860_REG_INTR_EN 0x02
77 #define LTECAT4_MAX9860_REG_SYS_CLK 0x03
78 #define LTECAT4_MAX9860_REG_STEREO_CLK_MSB 0x04
79 #define LTECAT4_MAX9860_REG_STEREO_CLK_LSB 0x05
80 #define LTECAT4_MAX9860_REG_AUDIO_INTERFACE_1 0x06
81 #define LTECAT4_MAX9860_REG_AUDIO_INTERFACE_2 0x07
82 #define LTECAT4_MAX9860_REG_VOICE_FILTER 0x08
83 #define LTECAT4_MAX9860_REG_DAC_ATTENUATION 0x09
84 #define LTECAT4_MAX9860_REG_ADC_OUTPUT_LEVELS 0x0A
85 #define LTECAT4_MAX9860_REG_DAC_GAIN 0x0B
86 #define LTECAT4_MAX9860_REG_MIC_GAIN 0x0C
87 #define LTECAT4_MAX9860_REG_MIC_AGC 0x0E
88 #define LTECAT4_MAX9860_REG_NOISE_GATE 0x0F
89 #define LTECAT4_MAX9860_REG_SYS_SHUTDOWN 0x10
95 #define LTECAT4_PSCLK_24MHZ 0x20
96 #define LTECAT4_LRCLK_8MHZ_MSB 0x10
97 #define LTECAT4_LRCLK_8MHZ_LSB 0x62
98 #define LTECAT4_DBCI_FALLING_EDGE 0x20
99 #define LTECAT4_HIZ_ENABLE 0x08
100 #define LTECAT4_TDM_ENABLE 0x04
101 #define LTECAT4_ABCI_FALLING_EDGE 0x20
102 #define LTECAT4_ADLY_ENABLE 0x10
103 #define LTECAT4_STEREO_ENABLE 0x08
104 #define LTECAT4_AVFLT_DISABLE 0x00
105 #define LTECAT4_DVFLT_DISABLE 0x00
106 #define LTECAT4_DVA_GAIN_0 0x06
107 #define LTECAT4_ADC_GAIN_3 0x00
108 #define LTECAT4_DAC_GAIN_0 0x00
109 #define LTECAT4_DVST_GAIN_0 0x01
110 #define LTECAT4_MIC_GAIN_30 0x60
111 #define LTECAT4_PGAM_GAIN_20 0x00
112 #define LTECAT4_AGCSRC_ENABLE 0x80
113 #define LTECAT4_AGCHLD_50 0x01
114 #define LTECAT4_ANTH_DISABLE 0x00
115 #define LTECAT4_AGCTH_MINUS_3 0x00
116 #define LTECAT4_POWER_ON 0x80
117 #define LTECAT4_DAC_ENABLE 0x08
118 #define LTECAT4_ADCL_ADCR_ENABLE 0x03
124 #define LTECAT4_CMD_AT "AT"
125 #define LTECAT4_CMD_GET_MODEL_ID "AT+CGMM"
126 #define LTECAT4_CMD_GET_SW_VERSION "AT+CGMR"
127 #define LTECAT4_CMD_GET_SERIAL_NUM "AT+CGSN"
128 #define LTECAT4_CMD_FACTORY_RESET "AT&F"
129 #define LTECAT4_CMD_SET_UE_FUNCTIONALITY "AT+CFUN"
130 #define LTECAT4_CMD_NETWORK_REGISTRATION "AT+CREG"
131 #define LTECAT4_CMD_SIGNAL_QUALITY_REPORT "AT+CSQ"
132 #define LTECAT4_CMD_OPERATOR_SELECTION "AT+COPS"
133 #define LTECAT4_CMD_SEND_SMS "AT+CMGS"
134 #define LTECAT4_CMD_SELECT_SMS_FORMAT "AT+CMGF"
135 #define LTECAT4_CMD_DEFINE_PDP_CONTEXT "AT+CGDCONT"
136 #define LTECAT4_CMD_SHOW_PDP_ADDRESS "AT+CGPADDR"
137 #define LTECAT4_CMD_ACTIVATE_PDP_CONTEXT "AT+QIACT"
138 #define LTECAT4_CMD_OPEN_SOCKET "AT+QIOPEN"
139 #define LTECAT4_CMD_CLOSE_SOCKET "AT+QICLOSE"
140 #define LTECAT4_CMD_SEND_DATA "AT+QISEND"
141 #define LTECAT4_CMD_RECEIVE_DATA "AT+QIRD"
142 #define LTECAT4_CMD_TURN_ON_GNSS "AT+QGPS"
143 #define LTECAT4_CMD_ACQUIRE_NMEA_SENTENCES "AT+QGPSGNMEA"
144 #define LTECAT4_CMD_SET_MIC_GAIN "AT+QMIC"
145 #define LTECAT4_CMD_CONFIG_AUDIO_INTERFACE "AT+QDAI"
146 #define LTECAT4_CMD_DIAL_NUMBER "ATD"
147 #define LTECAT4_CMD_TERMINATE_CALL "ATH"
148 #define LTECAT4_CMD_ANSWER_CALL "ATA"
149 #define LTECAT4_CMD_LIST_CALLS "AT+CLCC"
150 #define LTECAT4_CMD_CONFIG_URC_INDICATION "AT+QURCCFG"
156 #define LTECAT4_RSP_START "$"
157 #define LTECAT4_RSP_DELIMITER ","
158 #define LTECAT4_RSP_END "\r\n"
159 #define LTECAT4_RSP_GGA "GGA"
165 #define LTECAT4_RSP_OK "OK"
166 #define LTECAT4_RSP_ERROR "ERROR"
172 #define LTECAT4_URC_RECEIVED_DATA "+QIURC:"
173 #define LTECAT4_URC_RING "RING"
174 #define LTECAT4_URC_NO_CARRIER "NO CARRIER"
180 #define LTECAT4_POWER_STATE_OFF 0
181 #define LTECAT4_POWER_STATE_ON 1
187 #define LTECAT4_GGA_ELEMENT_SIZE 15
188 #define LTECAT4_GGA_TIME 1
189 #define LTECAT4_GGA_LATITUDE 2
190 #define LTECAT4_GGA_LATITUDE_SIDE 3
191 #define LTECAT4_GGA_LONGITUDE 4
192 #define LTECAT4_GGA_LONGITUDE_SIDE 5
193 #define LTECAT4_GGA_QUALITY_INDICATOR 6
194 #define LTECAT4_GGA_NUMBER_OF_SATELLITES 7
195 #define LTECAT4_GGA_H_DILUTION_OF_POS 8
196 #define LTECAT4_GGA_ALTITUDE 9
197 #define LTECAT4_GGA_ALTITUDE_UNIT 10
198 #define LTECAT4_GGA_GEOIDAL_SEPARATION 11
199 #define LTECAT4_GGA_GEOIDAL_SEPARATION_UNIT 12
200 #define LTECAT4_GGA_TIME_SINCE_LAST_DGPS 13
201 #define LTECAT4_GGA_DGPS_REFERENCE_STATION_ID 14
208 #define LTECAT4_TX_DRV_BUFFER_SIZE 256
209 #define LTECAT4_RX_DRV_BUFFER_SIZE 256
216 #define LTECAT4_DEVICE_ADDRESS 0x10
234 #define LTECAT4_MAP_MIKROBUS( cfg, mikrobus ) \
235 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
236 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
237 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
238 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
239 cfg.pwr = MIKROBUS( mikrobus, MIKROBUS_AN ); \
240 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
241 cfg.ring = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
242 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT );
digital_out_t rts
Definition: ltecat4.h:255
digital_out_t pwr
Definition: ltecat4.h:254
pin_name_t cts
Definition: ltecat4.h:291
void ltecat4_send_sms_text(ltecat4_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
LTE Cat.4 send SMS in text mode.
uart_stop_bits_t stop_bit
Definition: ltecat4.h:298
void ltecat4_cfg_setup(ltecat4_cfg_t *cfg)
LTE Cat.4 configuration object setup function.
void ltecat4_set_sim_apn(ltecat4_t *ctx, uint8_t *sim_apn)
Set sim card APN.
uart_parity_t parity_bit
Definition: ltecat4.h:297
pin_name_t pwr
Definition: ltecat4.h:288
#define LTECAT4_RX_DRV_BUFFER_SIZE
Definition: ltecat4.h:209
ltecat4_return_value_t
LTE Cat.4 Click return value data.
Definition: ltecat4.h:309
void ltecat4_send_cmd_par(ltecat4_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
Send command function with parameter.
err_t ltecat4_parse_gga(uint8_t *rsp_buf, uint8_t gga_element, uint8_t *element_data)
LTE Cat.4 parse GGA function.
uint8_t ltecat4_get_ring_pin(ltecat4_t *ctx)
LTE Cat.4 get RING pin function.
void ltecat4_send_cmd(ltecat4_t *ctx, uint8_t *cmd)
Send command function.
@ LTECAT4_ERROR_TIMEOUT
Definition: ltecat4.h:312
pin_name_t rx_pin
Definition: ltecat4.h:282
uint8_t slave_address
Definition: ltecat4.h:266
#define LTECAT4_TX_DRV_BUFFER_SIZE
LTE Cat.4 driver buffer size.
Definition: ltecat4.h:208
uart_t uart
Definition: ltecat4.h:263
LTE Cat.4 Click configuration object.
Definition: ltecat4.h:280
digital_in_t ring
Definition: ltecat4.h:258
uint32_t i2c_speed
Definition: ltecat4.h:299
err_t ltecat4_init(ltecat4_t *ctx, ltecat4_cfg_t *cfg)
LTE Cat.4 initialization function.
i2c_master_t i2c
Definition: ltecat4.h:262
bool uart_blocking
Definition: ltecat4.h:295
pin_name_t scl
Definition: ltecat4.h:284
uint8_t i2c_address
Definition: ltecat4.h:300
uint32_t baud_rate
Definition: ltecat4.h:294
void ltecat4_set_rts_pin(ltecat4_t *ctx, uint8_t state)
LTE Cat.4 set RTS pin function.
pin_name_t sda
Definition: ltecat4.h:285
err_t ltecat4_config_codec(ltecat4_t *ctx)
LTE Cat.4 config codec function.
err_t ltecat4_generic_write(ltecat4_t *ctx, uint8_t *data_in, uint16_t len)
LTE Cat.4 data writing function.
pin_name_t tx_pin
Definition: ltecat4.h:283
pin_name_t ring
Definition: ltecat4.h:290
err_t ltecat4_read_register(ltecat4_t *ctx, uint8_t reg, uint8_t *data_out)
LTE Cat.4 MAX9860 reading function.
err_t ltecat4_send_sms_pdu(ltecat4_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
LTE Cat.4 send SMS in PDU mode.
@ LTECAT4_ERROR_CMD
Definition: ltecat4.h:313
void ltecat4_dial_number(ltecat4_t *ctx, uint8_t *phone_number)
LTE Cat.4 dial number.
void ltecat4_set_pwr_pin(ltecat4_t *ctx, uint8_t state)
LTE Cat.4 set PWR pin function.
void ltecat4_set_power_state(ltecat4_t *ctx, uint8_t state)
LTE Cat.4 set power state function.
err_t ltecat4_generic_read(ltecat4_t *ctx, uint8_t *data_out, uint16_t len)
LTE Cat.4 data reading function.
digital_in_t cts
Definition: ltecat4.h:259
@ LTECAT4_OK
Definition: ltecat4.h:310
@ LTECAT4_ERROR_UNKNOWN
Definition: ltecat4.h:314
pin_name_t rts
Definition: ltecat4.h:289
void ltecat4_send_cmd_check(ltecat4_t *ctx, uint8_t *at_cmd_buf)
Check the sent command.
uint8_t ltecat4_get_cts_pin(ltecat4_t *ctx)
LTE Cat.4 get CTS pin function.
@ LTECAT4_ERROR
Definition: ltecat4.h:311
uart_data_bits_t data_bit
Definition: ltecat4.h:296
LTE Cat.4 Click context object.
Definition: ltecat4.h:252
err_t ltecat4_write_register(ltecat4_t *ctx, uint8_t reg, uint8_t data_in)
LTE Cat.4 MAX9860 writing function.