38 #include "drv_digital_out.h" 39 #include "drv_spi_master.h" 53 #define DCMOTOR10_MAP_MIKROBUS( cfg, mikrobus ) \ 54 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \ 55 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \ 56 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \ 57 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \ 58 cfg.inh = MIKROBUS( mikrobus, MIKROBUS_INT ) 65 #define DCMOTOR10_RETVAL uint8_t 67 #define DCMOTOR10_OK 0x00 68 #define DCMOTOR10_INIT_ERROR 0xFF 75 #define DCMOTOR10_STATUS_REG_RST 0x0001 76 #define DCMOTOR10_LS_SWITCH_1 0x0002 77 #define DCMOTOR10_HS_SWITCH_1 0x0004 78 #define DCMOTOR10_LS_SWITCH_2 0x0008 79 #define DCMOTOR10_HS_SWITCH_2 0x0010 80 #define DCMOTOR10_LS_SWITCH_3 0x0020 81 #define DCMOTOR10_HS_SWITCH_3 0x0040 82 #define DCMOTOR10_LS_SWITCH_4 0x0080 83 #define DCMOTOR10_HS_SWITCH_4 0x0100 84 #define DCMOTOR10_LS_SWITCH_5 0x0200 85 #define DCMOTOR10_HS_SWITCH_5 0x0400 86 #define DCMOTOR10_LS_SWITCH_6 0x0800 87 #define DCMOTOR10_HS_SWITCH_6 0x1000 88 #define DCMOTOR10_OVERCURRENT_SHUT_DOWN 0x2000 89 #define DCMOTOR10_UNDERLOAD_SHUT_DOWN 0x4000 90 #define DCMOTOR10_OVER_VOLT_LOCKOUT 0x8000 97 #define DCMOTOR10_TEMP_PREWARNING 0x0001 98 #define DCMOTOR10_STATUS_LS_SWITCH_1 0x0002 99 #define DCMOTOR10_STATUS_HS_SWITCH_1 0x0004 100 #define DCMOTOR10_STATUS_LS_SWITCH_2 0x0008 101 #define DCMOTOR10_STATUS_HS_SWITCH_2 0x0010 102 #define DCMOTOR10_STATUS_LS_SWITCH_3 0x0020 103 #define DCMOTOR10_STATUS_HS_SWITCH_3 0x0040 104 #define DCMOTOR10_STATUS_LS_SWITCH_4 0x0080 105 #define DCMOTOR10_STATUS_HS_SWITCH_4 0x0100 106 #define DCMOTOR10_STATUS_LS_SWITCH_5 0x0200 107 #define DCMOTOR10_STATUS_HS_SWITCH_5 0x0400 108 #define DCMOTOR10_STATUS_LS_SWITCH_6 0x0800 109 #define DCMOTOR10_STATUS_HS_SWITCH_6 0x1000 110 #define DCMOTOR10_OVERLOAD 0x2000 111 #define DCMOTOR10_UNDERLOAD 0x4000 112 #define DCMOTOR10_POWER_SUPPLY_FAIL 0x8000 119 #define DCMOTOR10_OVERCURRENT_FAULT 0x2000 120 #define DCMOTOR10_GND_SHORT_CIRCUIT 0x2000 121 #define DCMOTOR10_VS_SHORT_CIRCUIT 0x2000 122 #define DCMOTOR10_TEMP_WARNING 0x0001 123 #define DCMOTOR10_OPENLOAD_FAULT 0x4000 124 #define DCMOTOR10_UNDERLOAD_FAULT 0x4000 125 #define DCMOTOR10_UNDER_VOLT_LOCKOUT_FAULT 0x8000 126 #define DCMOTOR10_OVER_VOLT_LOCKOUT_FAULT 0x8000 133 #define DCMOTOR10_RESET_STATUS_REG 0x0001 134 #define DCMOTOR10_ENABLE_1 0x000E 135 #define DCMOTOR10_ENABLE_2 0x0038 136 #define DCMOTOR10_ENABLE_3 0x00E0 137 #define DCMOTOR10_ENABLE_4 0x0380 138 #define DCMOTOR10_ENABLE_5 0x0E00 139 #define DCMOTOR10_ENABLE_6 0x3800 140 #define DCMOTOR10_ENABLE_ALL 0x1FFE 147 #define DCMOTOR10_HB_ENABLE_1_CV 0x000C 148 #define DCMOTOR10_HB_ENABLE_1_CCV 0x0012 149 #define DCMOTOR10_HB_ENABLE_2_CV 0x0030 150 #define DCMOTOR10_HB_ENABLE_2_CCV 0x0048 151 #define DCMOTOR10_HB_ENABLE_3_CV 0x00C0 152 #define DCMOTOR10_HB_ENABLE_3_CCV 0x0120 153 #define DCMOTOR10_HB_ENABLE_4_CV 0x0300 154 #define DCMOTOR10_HB_ENABLE_4_CCV 0x0480 155 #define DCMOTOR10_HB_ENABLE_5_CV 0x0C00 156 #define DCMOTOR10_HB_ENABLE_5_CCV 0x1200 163 #define DCMOTOR10_8_BIT_DATA 0xFF 164 #define DCMOTOR10_INHIBIT 0x00 165 #define DCMOTOR10_UNINHIBIT 0x01 287 #endif // _DCMOTOR10_H_ uint32_t spi_speed
Definition: dcmotor10.h:214
digital_out_t cs
Definition: dcmotor10.h:182
pin_name_t inh
Definition: dcmotor10.h:210
Click configuration structure definition.
Definition: dcmotor10.h:199
uint8_t slave_address
Definition: dcmotor10.h:191
pin_name_t mosi
Definition: dcmotor10.h:204
pin_name_t cs
Definition: dcmotor10.h:206
void dcmotor10_inhibit(dcmotor10_t *ctx, uint8_t state)
Inhibit device function.
pin_name_t miso
Definition: dcmotor10.h:203
void dcmotor10_cfg_setup(dcmotor10_cfg_t *cfg)
Config Object Initialization function.
spi_master_t spi
Definition: dcmotor10.h:187
pin_name_t chip_select
Definition: dcmotor10.h:192
spi_master_chip_select_polarity_t cs_polarity
Definition: dcmotor10.h:216
Click ctx object definition.
Definition: dcmotor10.h:178
spi_master_mode_t spi_mode
Definition: dcmotor10.h:215
uint16_t dcmotor10_read_status(dcmotor10_t *ctx)
Read status function.
void dcmotor10_send_cmd(dcmotor10_t *ctx, uint16_t wr_data)
Send command function.
digital_out_t inh
Definition: dcmotor10.h:183
DCMOTOR10_RETVAL dcmotor10_init(dcmotor10_t *ctx, dcmotor10_cfg_t *cfg)
Initialization function.
#define DCMOTOR10_RETVAL
Definition: dcmotor10.h:65
pin_name_t sck
Definition: dcmotor10.h:205