adswio 2.0.0.0
adswio.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef ADSWIO_H
36#define ADSWIO_H
37
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
55#include "spi_specifics.h"
56
57
58// -------------------------------------------------------------- PUBLIC MACROS
69#define ADSWIO_MAP_MIKROBUS( cfg, mikrobus ) \
70 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
71 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
72 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
73 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
74 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
75 cfg.alt = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
76 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
83#define adswio_obj_t const uint8_t*
90#define adswio_err_t uint8_t
97#define ADSWIO_RETVAL uint8_t
98
99#define ADSWIO_OK 0x00
100#define ADSWIO_INIT_ERROR 0xFF
107#define ADSWIO_FRAME_LENGTH 4
108#define ADSWIO_MASK_RD_FRAME_RESERVED_BIT 0x80
109#define ADSWIO_MASK_RD_FRAME_REG_ADDR 0x7F
110#define ADSWIO_MASK_RD_FRAME_STATUS 0x7F
117#define ADSWIO_RD_RET_INFO 0x1
124#define ADSWIO_OFFSET_REG_CONV_RES 0x25
125#define ADSWIO_OFFSET_REG_DIAG_RES 0x29
132#define DUMMY 0
133#define ADSWIO_NULL 0
140#define ADSWIO_RD_AUTO_EN 0x2
141#define ADSWIO_RD_AUTO_DIS 0x0
153#define ADSWIO_MASK_CONV_EN 0xF
154#define ADSWIO_OFFSET_CONV_EN_CH 0
155#define ADSWIO_OFFSET_CONV_EN_DIAG 4
162#define ADSWIO_MASK_DIAG_ASSIGN 0xF
163#define ADSWIO_OFFSET_ASSIGN_DIAG0 0
164#define ADSWIO_OFFSET_ASSIGN_DIAG1 4
165#define ADSWIO_OFFSET_ASSIGN_DIAG2 8
166#define ADSWIO_OFFSET_ASSIGN_DIAG3 12
173#define ADSWIO_MASK_CONV_MODE 0x300
174#define ADSWIO_OFFSET_CONV_MODE 8
181#define ADSWIO_MASK_DAC_CODE 0x1FFF
188#define ADSWIO_MASK_ALERT 0x7FFF
195#define ADSWIO_MASK_DIN_THRESH_COMP 0x3E
202#define ADSWIO_MASK_STATUS_ALRT_CAL_MEM_ERR 0x4000
203#define ADSWIO_MASK_STATUS_ALRT_SPI_CRC_ERR 0x2000
204#define ADSWIO_MASK_STATUS_ALRT_RST 0x8000
205#define ADSWIO_MASK_STATUS_ALRT_SPI_SCLK_CNT_ERR 0x1000
206#define ADSWIO_MASK_STATUS_ALRT_ADC_SAT_ERR 0x800
207#define ADSWIO_MASK_STATUS_ALRT_ADC_CONV_ERR 0x400
208#define ADSWIO_MASK_STATUS_ALRT_ALDO1V8_ERR 0x200
209#define ADSWIO_MASK_STATUS_ALRT_DVCC_ERR 0x100
210#define ADSWIO_MASK_STATUS_ALRT_AVDD_ERR 0x80
211#define ADSWIO_MASK_STATUS_ALRT_ALDO5V_ERR 0x40
212#define ADSWIO_MASK_STATUS_ALRT_CHARGE_PUMP_ERR 0x20
213#define ADSWIO_MASK_STATUS_ALRT_HI_TEMP_ERR 0x10
214#define ADSWIO_MASK_STATUS_ALRT_VI_ERR_D 0x8
215#define ADSWIO_MASK_STATUS_ALRT_VI_ERR_C 0x4
216#define ADSWIO_MASK_STATUS_ALRT_VI_ERR_B 0x2
217#define ADSWIO_MASK_STATUS_ALRT_VI_ERR_A 0x1
224#define ADSWIO_MASK_STATUS_LIVE_ADC_DRDY 0x4000
225#define ADSWIO_MASK_STATUS_LIVE_ADC_BUSY 0x2000
226#define ADSWIO_MASK_STATUS_LIVE_ADC_CURR_CH 0x1C00
227#define ADSWIO_MASK_STATUS_LIVE_ALDO1V8 0x200
228#define ADSWIO_MASK_STATUS_LIVE_DVCC 0x100
229#define ADSWIO_MASK_STATUS_LIVE_AVDD 0x80
230#define ADSWIO_MASK_STATUS_LIVE_ALDO5V 0x40
231#define ADSWIO_MASK_STATUS_LIVE_CHARGE_PUMP 0x20
232#define ADSWIO_MASK_STATUS_LIVE_HI_TEMP 0x10
233#define ADSWIO_MASK_STATUS_LIVE_VI_ERR_CURR_D 0x8
234#define ADSWIO_MASK_STATUS_LIVE_VI_ERR_CURR_C 0x4
235#define ADSWIO_MASK_STATUS_LIVE_VI_ERR_CURR_B 0x2
236#define ADSWIO_MASK_STATUS_LIVE_VI_ERR_CURR_A 0x1
243#define ADSWIO_MAX_NWORDS 4
244#define ADSWIO_MIN_NWORDS 1
247 // End offset_mask group
248
253#define ADSWIO_REG_NOP 0x0
254#define ADSWIO_REG_FUNC_SETUP_CHA 0x1
255#define ADSWIO_REG_FUNC_SETUP_CHB 0x2
256#define ADSWIO_REG_FUNC_SETUP_CHC 0x3
257#define ADSWIO_REG_FUNC_SETUP_CHD 0x4
258#define ADSWIO_REG_CFG_ADC_CHA 0x5
259#define ADSWIO_REG_CFG_ADC_CHB 0x6
260#define ADSWIO_REG_CFG_ADC_CHC 0x7
261#define ADSWIO_REG_CFG_ADC_CHD 0x8
262#define ADSWIO_REG_CFG_DIN_CHA 0x9
263#define ADSWIO_REG_CFG_DIN_CHB 0xA
264#define ADSWIO_REG_CFG_DIN_CHC 0xB
265#define ADSWIO_REG_CFG_DIN_CHD 0xC
266#define ADSWIO_REG_GPO_PARALLEL 0xD
267#define ADSWIO_REG_CFG_GPO_CHA 0xE
268#define ADSWIO_REG_CFG_GPO_CHB 0xF
269#define ADSWIO_REG_CFG_GPO_CHC 0x10
270#define ADSWIO_REG_CFG_GPO_CHD 0x11
271#define ADSWIO_REG_CFG_OUTPUT_CHA 0x12
272#define ADSWIO_REG_CFG_OUTPUT_CHB 0x13
273#define ADSWIO_REG_CFG_OUTPUT_CHC 0x14
274#define ADSWIO_REG_CFG_OUTPUT_CHD 0x15
275#define ADSWIO_REG_DAC_CODE_CHA 0x16
276#define ADSWIO_REG_DAC_CODE_CHB 0x17
277#define ADSWIO_REG_DAC_CODE_CHC 0x18
278#define ADSWIO_REG_DAC_CODE_CHD 0x19
279#define ADSWIO_REG_DAC_CODE_CLR_CHA 0x1A
280#define ADSWIO_REG_DAC_CODE_CLR_CHB 0x1B
281#define ADSWIO_REG_DAC_CODE_CLR_CHC 0x1C
282#define ADSWIO_REG_DAC_CODE_CLR_CHD 0x1D
283#define ADSWIO_REG_DAC_CODE_ACT_CHA 0x1E
284#define ADSWIO_REG_DAC_CODE_ACT_CHB 0x1F
285#define ADSWIO_REG_DAC_CODE_ACT_CHC 0x20
286#define ADSWIO_REG_DAC_CODE_ACT_CHD 0x21
287#define ADSWIO_REG_DIN_THRESH 0x22
288#define ADSWIO_REG_ADC_CONV_CTRL 0x23
289#define ADSWIO_REG_DIAG_ASSIGN 0x24
290#define ADSWIO_REG_DIN_COMP_OUT 0x25
291#define ADSWIO_REG_RESULT_ADC_CHA 0x26
292#define ADSWIO_REG_RESULT_ADC_CHB 0x27
293#define ADSWIO_REG_RESULT_ADC_CHC 0x28
294#define ADSWIO_REG_RESULT_ADC_CHD 0x29
295#define ADSWIO_REG_RESULT_DIAG1 0x2A
296#define ADSWIO_REG_RESULT_DIAG2 0x2B
297#define ADSWIO_REG_RESULT_DIAG3 0x2C
298#define ADSWIO_REG_RESULT_DIAG4 0x2D
299#define ADSWIO_REG_STATUS_ALERT 0x2E
300#define ADSWIO_REG_STATUS_LIVE 0x2F
301#define ADSWIO_REG_MASK_ALERT 0x3C
302#define ADSWIO_REG_DIN_COUNTER_CHA 0x3D
303#define ADSWIO_REG_DIN_COUNTER_CHB 0x3E
304#define ADSWIO_REG_DIN_COUNTER_CHC 0x3F
305#define ADSWIO_REG_DIN_COUNTER_CHD 0x40
306#define ADSWIO_REG_READ_SELECT 0x41
307#define ADSWIO_REG_THERM_RST 0x43
308#define ADSWIO_REG_CMD_KEY 0x44
309#define ADSWIO_REG_SCRATCH 0x45
310#define ADSWIO_REG_SILICON_REV 0x46
322#define ADSWIO_SETUP_CONV_EN_CHD 0x8
323#define ADSWIO_SETUP_CONV_EN_CHC 0x4
324#define ADSWIO_SETUP_CONV_EN_CHB 0x2
325#define ADSWIO_SETUP_CONV_EN_CHA 0x1
332#define ADSWIO_SETUP_CH_FUNC_HZ 0x0
333#define ADSWIO_SETUP_CH_FUNC_VOLT_OUTPUT 0x1
334#define ADSWIO_SETUP_CH_FUNC_CURR_OUTPUT 0x2
335#define ADSWIO_SETUP_CH_FUNC_VOLT_INPUT 0x3
336#define ADSWIO_SETUP_CH_FUNC_CURR_INPUT_PWR_EXT 0x4
337#define ADSWIO_SETUP_CH_FUNC_CURR_INPUT_PWR_LOOP 0x5
338#define ADSWIO_SETUP_CH_FUNC_RES_MEAS 0x6
339#define ADSWIO_SETUP_CH_FUNC_DIG_INPUT_LOGIC 0x7
340#define ADSWIO_SETUP_CH_FUNC_DIG_INPUT_PWR_LOOP 0x8
341#define ADSWIO_SETUP_CH_FUNC_CURR_INPUT_PWR_EXT_HART 0x9
342#define ADSWIO_SETUP_CH_FUNC_CURR_INPUT_PWR_LOOP_HART 0xA
349#define ADSWIO_SETUP_CONV_EN_DIAG3 0x8
350#define ADSWIO_SETUP_CONV_EN_DIAG2 0x4
351#define ADSWIO_SETUP_CONV_EN_DIAG1 0x2
352#define ADSWIO_SETUP_CONV_EN_DIAG0 0x1
359#define ADSWIO_SETUP_DIAG_ASSIGN_AGND 0x0
360#define ADSWIO_SETUP_DIAG_ASSIGN_TEMP 0x1
361#define ADSWIO_SETUP_DIAG_ASSIGN_AVDD 0x2
362#define ADSWIO_SETUP_DIAG_ASSIGN_VAVSS 0x3
363#define ADSWIO_SETUP_DIAG_ASSIGN_REFOUT 0x4
364#define ADSWIO_SETUP_DIAG_ASSIGN_ALDO5V 0x5
365#define ADSWIO_SETUP_DIAG_ASSIGN_ALDO1V8 0x6
366#define ADSWIO_SETUP_DIAG_ASSIGN_DLDO1V8 0x7
367#define ADSWIO_SETUP_DIAG_ASSIGN_DVCC 0x8
368#define ADSWIO_SETUP_DIAG_ASSIGN_IOVDD 0x9
369#define ADSWIO_SETUP_DIAG_ASSIGN_SENSELA 0xA
370#define ADSWIO_SETUP_DIAG_ASSIGN_SENSELB 0xB
371#define ADSWIO_SETUP_DIAG_ASSIGN_SENSELC 0xC
372#define ADSWIO_SETUP_DIAG_ASSIGN_SENSELD 0xD
373#define ADSWIO_SETUP_DIAG_ASSIGN_LVIN 0xE
380#define ADSWIO_SETUP_CONV_STOP_CONT_CONV_ADC_PWR_UP 0x0
381#define ADSWIO_SETUP_CONV_START_SING_SEQ_CONV 0x1
382#define ADSWIO_SETUP_CONV_START_CONT_CONV 0x2
383#define ADSWIO_SETUP_CONV_STOP_CONT_CONV_ADC_PWR_DWN 0x3
390#define ADSWIO_SETUP_ADC_RANGE_0V_TO_10V 0x0
391#define ADSWIO_SETUP_ADC_RANGE_2500MV_PWR_EXT 0x20
392#define ADSWIO_SETUP_ADC_RANGE_2500MV_PWR_LOOP 0x40
393#define ADSWIO_SETUP_ADC_RANGE_2500MV_NEG_TO_2500MV_POS 0x60
394#define ADSWIO_SETUP_ADC_RANGE_104MV_NEG_TO_104MV_POS 0x80
395#define ADSWIO_SETUP_ADC_SAMPLE_RATE_20SPS 0x0
396#define ADSWIO_SETUP_ADC_SAMPLE_RATE_4800SPS 0x8
397#define ADSWIO_SETUP_ADC_SAMPLE_RATE_10SPS 0x10
398#define ADSWIO_SETUP_ADC_SAMPLE_RATE_1200SPS 0x18
399#define ADSWIO_SETUP_ADC_CH_200K_TO_GND 0x4
400#define ADSWIO_SETUP_ADC_INPUT_VOLTAGE_AGND_SENSE 0x0
401#define ADSWIO_SETUP_ADC_INPUT_VOLTAGE_100_OHM_RES 0x1
408#define ADSWIO_SETUP_DIN_COUNT_EN 0x8000
409#define ADSWIO_SETUP_DIN_COMP_IN_FILTERED 0x4000
410#define ADSWIO_SETUP_DIN_COMP_OUT_INV 0x2000
411#define ADSWIO_SETUP_DIN_COMP_EN 0x1000
412#define ADSWIO_SETUP_DIN_RANGE_0 0x0
413#define ADSWIO_SETUP_DIN_RANGE_1 0x800
414#define ADSWIO_SETUP_DIN_DEBOUNCE_MODE_0 0x0
415#define ADSWIO_SETUP_DIN_DEBOUNCE_MODE_1 0x20
422#define ADSWIO_SETUP_GPO_PARALL_DATA_D 0x8
423#define ADSWIO_SETUP_GPO_PARALL_DATA_C 0x4
424#define ADSWIO_SETUP_GPO_PARALL_DATA_B 0x2
425#define ADSWIO_SETUP_GPO_PARALL_DATA_A 0x1
432#define ADSWIO_SETUP_GPO_LOGIC_LOW 0x0
433#define ADSWIO_SETUP_GPO_LOGIC_HIGH 0x8
440#define ADSWIO_SETUP_OUT_SLEW_EN_LINEAR 0x40
441#define ADSWIO_SETUP_OUT_SLEW_EN_HART 0x80
442#define ADSWIO_SETUP_OUT_SLEW_LIN_STEP_64_DEC_CODES 0x0
443#define ADSWIO_SETUP_OUT_SLEW_LIN_STEP_120_DEC_CODES 0x10
444#define ADSWIO_SETUP_OUT_SLEW_LIN_STEP_500_DEC_CODES 0x20
445#define ADSWIO_SETUP_OUT_SLEW_LIN_STEP_1820_DEC_CODES 0x30
446#define ADSWIO_SETUP_OUT_SLEW_LIN_RATE_4KHZ 0x0
447#define ADSWIO_SETUP_OUT_SLEW_LIN_RATE_64KHZ 0x4
448#define ADSWIO_SETUP_OUT_SLEW_LIN_RATE_150KHZ 0x8
449#define ADSWIO_SETUP_OUT_SLEW_LIN_RATE_240KHZ 0xC
450#define ADSWIO_SETUP_OUT_CLR_EN 0x2
451#define ADSWIO_SETUP_OUT_CURR_LIM_30MA 0x0
452#define ADSWIO_SETUP_OUT_CURR_LIM_7_5MA 0x1
459#define ADSWIO_SETUP_DIN_THRESH_GND_AND_AVDD 0x0
460#define ADSWIO_SETUP_DIN_THRESH_GND_AND_16V 0x1
467#define ADSWIO_SETUP_CONV_EN_50_60_HZ_REJ_DIAG 0x400
468
469#define ADSWIO_SETUP_CONV_EN_ALL_CH 0xF
470#define ADSWIO_SETUP_CONV_EN_ALL_DIAG 0xF
471#define ADSWIO_SETUP_CONV_DIS_ALL_CH 0x0
472#define ADSWIO_SETUP_CONV_DIS_ALL_DIAG 0x0
479#define ADSWIO_SETUP_THERM_RST_EN 0x1
486#define ADSWIO_STATUS_LIVE_ADC_CURR_CHA 0x0
487#define ADSWIO_STATUS_LIVE_ADC_CURR_CHB 0x400
488#define ADSWIO_STATUS_LIVE_ADC_CURR_CHC 0x800
489#define ADSWIO_STATUS_LIVE_ADC_CURR_CHD 0xC00
490#define ADSWIO_STATUS_LIVE_ADC_CURR_DIAG0 0x1000
491#define ADSWIO_STATUS_LIVE_ADC_CURR_DIAG1 0x1400
492#define ADSWIO_STATUS_LIVE_ADC_CURR_DIAG2 0x1800
493#define ADSWIO_STATUS_LIVE_ADC_CURR_DIAG3 0x1C00
500#define ADSWIO_CMD_NOP 0x0
501#define ADSWIO_CMD_SW_RST_KEY1 0x15FA
502#define ADSWIO_CMD_SW_RST_KEY2 0xAF51
503#define ADSWIO_CMD_LDAC_KEY 0x953A
504#define ADSWIO_CMD_DAC_CLR_KEY 0x73D1
507 // End reg_setup group
508
513#define ADSWIO_ERR_STATUS_OK 0
514#define ADSWIO_ERR_INIT_DRV 1
515#define ADSWIO_ERR_UNSUPPORTED_PIN 2
516#define ADSWIO_ERR_RD_STATUS 3
517#define ADSWIO_ERR_RD_MODE 4
518#define ADSWIO_ERR_RD_NWORDS 5
519#define ADSWIO_ERR_CMD_KEY 6
520#define ADSWIO_ERR_EN_CH 7
521#define ADSWIO_ERR_EN_DIAG 8
522#define ADSWIO_ERR_CRC 9
523#define ADSWIO_ERR_REG_ADDR 10
524#define ADSWIO_ERR_CONV_MODE 11
525#define ADSWIO_ERR_CH_FUNC 12
526#define ADSWIO_ERR_DIAG_ASSIGN 13
533#define ADSWIO_ID_SILICON_REV 0x8
544#define ADSWIO_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
545#define ADSWIO_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
546
547 // End group macro
548// --------------------------------------------------------------- PUBLIC TYPES
557typedef void ( * adswio_handler_t )( uint8_t * );
558
559
563typedef struct
564{
565 // Output pins
566
567 digital_out_t cs;
568 digital_out_t rst;
569
570 // Input pins
571
572 digital_in_t alt;
573 digital_in_t rdy;
574
575 // Modules
576
577 spi_master_t spi;
578 pin_name_t chip_select;
579
580 // static variable
581
583
584} adswio_t;
585
589typedef struct
590{
591 // static variable
592
593 uint8_t reg_addr;
594 uint16_t *data_out;
595 uint8_t rd_mode;
596 uint8_t n_words;
597
599
603typedef struct
604{
605 // Communication gpio pins
606
607 pin_name_t miso;
608 pin_name_t mosi;
609 pin_name_t sck;
610 pin_name_t cs;
611
612 // Additional gpio pins
613
614 pin_name_t rst;
615 pin_name_t alt;
616 pin_name_t rdy;
617
618 // static variable
619
620 uint32_t spi_speed;
621 spi_master_mode_t spi_mode;
622 spi_master_chip_select_polarity_t cs_polarity;
623
625
626 // End types group
627// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
628
633#ifdef __cplusplus
634extern "C"{
635#endif
636
646
656
665
677void adswio_generic_transfer ( adswio_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
678
685
696
707
717
726
738adswio_err_t adswio_generic_write ( adswio_t *ctx, uint8_t reg_addr, uint16_t data_in );
739
759adswio_err_t adswio_generic_read ( adswio_t *ctx, uint8_t reg_addr, uint16_t *data_out, uint8_t *rd_status );
760
786
797adswio_err_t adswio_exe_command ( adswio_t *ctx, uint16_t cmd_key );
798
807void adswio_mask_alert_set ( adswio_t *ctx, uint16_t alert_mask );
808
821adswio_err_t adswio_status_live ( adswio_t *ctx, uint16_t *status, uint16_t status_mask );
822
837adswio_err_t adswio_status_data_ready ( adswio_t *ctx, uint8_t *drdy, uint16_t *conv_target );
838
853adswio_err_t adswio_status_alert ( adswio_t *ctx, uint16_t *status, uint16_t status_mask );
854
872
889adswio_err_t adswio_enable_ch ( adswio_t *ctx, uint8_t channel );
890
907adswio_err_t adswio_enable_diag ( adswio_t *ctx, uint8_t diagnostic );
908
920adswio_err_t adswio_set_ch_func ( adswio_t *ctx, uint8_t channel, uint8_t ch_func );
921
940adswio_err_t adswio_assign_diag ( adswio_t *ctx, uint8_t diagnostic, uint8_t duty );
941
959adswio_err_t adswio_get_conv_results ( adswio_t *ctx, uint8_t channel, uint16_t *data_out );
960
978adswio_err_t adswio_get_diag_results ( adswio_t *ctx, uint8_t diagnostic, uint16_t *data_out );
979
980#ifdef __cplusplus
981}
982#endif
983#endif // _ADSWIO_H_
984
985 // End public_function group
987
988// ------------------------------------------------------------------------- END
#define adswio_err_t
Definition adswio.h:90
#define ADSWIO_RETVAL
Definition adswio.h:97
adswio_err_t adswio_generic_multi_read(adswio_t *ctx, adswio_read_t *rd)
Generic Multi Read function.
adswio_err_t adswio_enable_diag(adswio_t *ctx, uint8_t diagnostic)
Diagnostic Enable function.
uint8_t adswio_status_pin_alert(adswio_t *ctx)
Alert Pin Status Check function.
void adswio_mask_alert_set(adswio_t *ctx, uint16_t alert_mask)
Alert Mask function.
uint8_t adswio_status_pin_ready(adswio_t *ctx)
Ready Pin Status Check function.
void adswio_default_cfg(adswio_t *ctx)
Click Default Configuration function.
void adswio_cfg_setup(adswio_cfg_t *cfg)
Config Object Initialization function.
ADSWIO_RETVAL adswio_init(adswio_t *ctx, adswio_cfg_t *cfg)
Initialization function.
adswio_err_t adswio_status_data_ready(adswio_t *ctx, uint8_t *drdy, uint16_t *conv_target)
Data Ready Status function.
adswio_err_t adswio_set_conv_mode(adswio_t *ctx, uint8_t mode)
Conversion Mode Setup function.
adswio_err_t adswio_generic_read(adswio_t *ctx, uint8_t reg_addr, uint16_t *data_out, uint8_t *rd_status)
Generic Read function.
adswio_err_t adswio_status_live(adswio_t *ctx, uint16_t *status, uint16_t status_mask)
Live Status function.
adswio_err_t adswio_enable_ch(adswio_t *ctx, uint8_t channel)
Channel Enable function.
adswio_err_t adswio_assign_diag(adswio_t *ctx, uint8_t diagnostic, uint8_t duty)
Diagnostic Assign function.
adswio_err_t adswio_get_conv_results(adswio_t *ctx, uint8_t channel, uint16_t *data_out)
Channel Results Get function.
adswio_err_t adswio_status_alert(adswio_t *ctx, uint16_t *status, uint16_t status_mask)
Alert Status function.
adswio_err_t adswio_generic_write(adswio_t *ctx, uint8_t reg_addr, uint16_t data_in)
Generic Write function.
adswio_err_t adswio_get_diag_results(adswio_t *ctx, uint8_t diagnostic, uint16_t *data_out)
Diagnostic Results Get function.
void adswio_clear_handler(adswio_t *ctx)
Error Handler Clear function.
adswio_err_t adswio_exe_command(adswio_t *ctx, uint16_t cmd_key)
Command Execute function.
void adswio_generic_transfer(adswio_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
adswio_err_t adswio_set_ch_func(adswio_t *ctx, uint8_t channel, uint8_t ch_func)
Channel Function Setup function.
void adswio_set_handler(adswio_t *ctx, adswio_handler_t handler)
Error Handler Setup function.
void adswio_reset(adswio_t *ctx)
Click Reset function.
void(* adswio_handler_t)(uint8_t *)
Click error handler definition.
Definition adswio.h:557
This file contains SPI specific macros, functions, etc.
Click configuration structure definition.
Definition adswio.h:604
pin_name_t alt
Definition adswio.h:615
spi_master_chip_select_polarity_t cs_polarity
Definition adswio.h:622
pin_name_t sck
Definition adswio.h:609
spi_master_mode_t spi_mode
Definition adswio.h:621
pin_name_t mosi
Definition adswio.h:608
uint32_t spi_speed
Definition adswio.h:620
pin_name_t rdy
Definition adswio.h:616
pin_name_t miso
Definition adswio.h:607
pin_name_t rst
Definition adswio.h:614
pin_name_t cs
Definition adswio.h:610
Click ctx object definition.
Definition adswio.h:590
uint16_t * data_out
Definition adswio.h:594
uint8_t n_words
Definition adswio.h:596
uint8_t reg_addr
Definition adswio.h:593
uint8_t rd_mode
Definition adswio.h:595
Click ctx object definition.
Definition adswio.h:564
digital_out_t cs
Definition adswio.h:567
spi_master_t spi
Definition adswio.h:577
digital_in_t alt
Definition adswio.h:572
digital_out_t rst
Definition adswio.h:568
adswio_handler_t err_handler
Definition adswio.h:582
pin_name_t chip_select
Definition adswio.h:578
digital_in_t rdy
Definition adswio.h:573