Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
39 #include "drv_analog_in.h"
61 #define HBRIDGE10_IN_STATUS_RESET 0x8000
62 #define HBRIDGE10_IN_OUT_LS1_ON 0x1000
63 #define HBRIDGE10_IN_OUT_HS1_ON 0x0800
64 #define HBRIDGE10_IN_OUT_LS2_ON 0x0100
65 #define HBRIDGE10_IN_OUT_HS2_ON 0x0080
66 #define HBRIDGE10_IN_OUT_LS3_ON 0x0010
67 #define HBRIDGE10_IN_OUT_HS3_ON 0x0008
68 #define HBRIDGE10_IN_OPEN_LOAD_OFF 0x0004
69 #define HBRIDGE10_IN_SHORT_SD_DELAY_12MS 0x0002
70 #define HBRIDGE10_IN_SHORT_SD_DELAY_1p5MS 0x0000
71 #define HBRIDGE10_IN_SOFT_ENABLE 0x0001
77 #define HBRIDGE10_OUT_OVER_TEMP_SD 0xFFFF
78 #define HBRIDGE10_OUT_OVER_TEMP_WARNING 0x8000
79 #define HBRIDGE10_OUT_STATUS_LS1_ON 0x1000
80 #define HBRIDGE10_OUT_STATUS_HS1_ON 0x0800
81 #define HBRIDGE10_OUT_STATUS_LS2_ON 0x0100
82 #define HBRIDGE10_OUT_STATUS_HS2_ON 0x0080
83 #define HBRIDGE10_OUT_STATUS_LS3_ON 0x0010
84 #define HBRIDGE10_OUT_STATUS_HS3_ON 0x0008
85 #define HBRIDGE10_OUT_SHORT_CIRCUIT_DETECTED 0x0004
86 #define HBRIDGE10_OUT_NORMAL_OPERATION 0x0002
87 #define HBRIDGE10_OUT_VS_UNDER_VOLTAGE 0x0001
93 #define HBRIDGE10_CHANNEL_OUT1 1
94 #define HBRIDGE10_CHANNEL_OUT2 2
95 #define HBRIDGE10_CHANNEL_OUT3 3
96 #define HBRIDGE10_OUT_OFF 0
97 #define HBRIDGE10_OUT_HIGH 1
98 #define HBRIDGE10_OUT_LOW 2
99 #define HBRIDGE10_OUT_MASK 3u
105 #define HBRIDGE10_ADC_VREF 3.3
115 #define HBRIDGE10_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
116 #define HBRIDGE10_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
134 #define HBRIDGE10_MAP_MIKROBUS( cfg, mikrobus ) \
135 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
136 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
137 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
138 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
139 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
140 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
141 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT )
357 #endif // HBRIDGE10_H
pin_name_t flt
Definition: hbridge10.h:183
void hbridge10_cfg_setup(hbridge10_cfg_t *cfg)
H-Bridge 10 configuration object setup function.
void hbridge10_disable_device(hbridge10_t *ctx)
H-Bridge 10 disable device function.
digital_out_t en
Definition: hbridge10.h:153
uint8_t hbridge10_get_fault_pin(hbridge10_t *ctx)
H-Bridge 10 get fault function.
pin_name_t cs
Definition: hbridge10.h:178
This file contains SPI specific macros, functions, etc.
uint16_t input_data
Definition: hbridge10.h:164
pin_name_t miso
Definition: hbridge10.h:175
H-Bridge 10 Click configuration object.
Definition: hbridge10.h:173
pin_name_t an
Definition: hbridge10.h:181
err_t hbridge10_read_an_pin_voltage(hbridge10_t *ctx, float *data_out)
H-Bridge 10 read AN pin voltage level function.
uint32_t spi_speed
Definition: hbridge10.h:186
pin_name_t sck
Definition: hbridge10.h:177
spi_master_t spi
Definition: hbridge10.h:160
@ HBRIDGE10_OK
Definition: hbridge10.h:201
pin_name_t chip_select
Definition: hbridge10.h:162
H-Bridge 10 Click context object.
Definition: hbridge10.h:151
spi_master_chip_select_polarity_t cs_polarity
Definition: hbridge10.h:188
err_t hbridge10_set_output_state(hbridge10_t *ctx, uint8_t channel, uint8_t state)
H-Bridge 10 set output state function.
hbridge10_return_value_t
H-Bridge 10 Click return value data.
Definition: hbridge10.h:200
err_t hbridge10_read_an_pin_value(hbridge10_t *ctx, uint16_t *data_out)
H-Bridge 10 read AN pin value function.
pin_name_t en
Definition: hbridge10.h:182
analog_in_t adc
Definition: hbridge10.h:159
digital_in_t flt
Definition: hbridge10.h:156
spi_master_mode_t spi_mode
Definition: hbridge10.h:187
pin_name_t mosi
Definition: hbridge10.h:176
analog_in_resolution_t resolution
Definition: hbridge10.h:190
@ HBRIDGE10_ERROR
Definition: hbridge10.h:202
err_t hbridge10_get_status(hbridge10_t *ctx, uint16_t *status)
H-Bridge 10 get status function.
err_t hbridge10_default_cfg(hbridge10_t *ctx)
H-Bridge 10 default configuration function.
float vref
Definition: hbridge10.h:191
err_t hbridge10_init(hbridge10_t *ctx, hbridge10_cfg_t *cfg)
H-Bridge 10 initialization function.
void hbridge10_enable_device(hbridge10_t *ctx)
H-Bridge 10 enable device function.
err_t hbridge10_transfer_data(hbridge10_t *ctx, uint16_t data_in, uint16_t *data_out)
H-Bridge 10 transfer data function.