Go to the documentation of this file.
42 #ifdef PREINIT_SUPPORTED
46 #ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
66 #define DCMOTOR7_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.pwma = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.pwmb = MIKROBUS( mikrobus, MIKROBUS_PWM )
77 #define DCMOTOR7_RETVAL uint8_t
79 #define DCMOTOR7_OK 0x00
80 #define DCMOTOR7_INIT_ERROR 0xFF
87 #define DCMOTOR7_CMD_INPUT_PORT 0x00 // def xxxx xxxx
88 #define DCMOTOR7_CMD_OUTPUT_PORT 0x01 // def 1111 1111
89 #define DCMOTOR7_CMD_POLARITY_INVERSION 0x02 // def 0000 0000
90 #define DCMOTOR7_CMD_CONFIGURATION 0x03 // def 1111 1111
97 #define DCMOTOR7_PORT_0 0x01
98 #define DCMOTOR7_PORT_1 0x02
99 #define DCMOTOR7_PORT_2 0x04
100 #define DCMOTOR7_PORT_3 0x08
101 #define DCMOTOR7_PORT_4 0x10
102 #define DCMOTOR7_PORT_5 0x20
103 #define DCMOTOR7_PORT_6 0x40
104 #define DCMOTOR7_PORT_7 0x80
111 #define DCMOTOR7_TBLK_FOSCM_X4_CLK 0x00
112 #define DCMOTOR7_TBLK_FOSCM_X6_CLK 0x01
119 #define DCMOTOR7_HBMODE_SMALL_MODE 0x00
120 #define DCMOTOR7_HBMODE_LARGE_MODE 0x01
127 #define DCMOTOR7_MOTOR_A 0x01
128 #define DCMOTOR7_MOTOR_B 0x02
135 #define DCMOTOR7_SLAVE_ADDRESS_0_0 0x70
136 #define DCMOTOR7_SLAVE_ADDRESS_0_1 0x71
137 #define DCMOTOR7_SLAVE_ADDRESS_1_0 0x72
138 #define DCMOTOR7_SLAVE_ADDRESS_1_1 0x73
145 #define DCMOTOR7_ENABLE_ALL_OUTPUT_PORT 0x00
146 #define DCMOTOR7_DISABLE_ALL_OUTPUT_PORT 0xFF
341 #endif // _DCMOTOR7_H_
uint32_t i2c_speed
Definition: dcmotor7.h:193
void dcmotor7_set_pwm_motor_b(dcmotor7_t *ctx, uint8_t state)
Function for set PWM value for motor B.
void dcmotor7_set_pwm_motor_a(dcmotor7_t *ctx, uint8_t state)
Function for set PWM value for motor A.
digital_out_t pwma
Definition: dcmotor7.h:163
void dcmotor7_set_hb_mode(dcmotor7_t *ctx, uint8_t mode)
Functions for set H-Bridge operation mode.
#define DCMOTOR7_RETVAL
Definition: dcmotor7.h:77
uint8_t i2c_address
Definition: dcmotor7.h:194
pin_name_t pwma
Definition: dcmotor7.h:188
pin_name_t pwmb
Definition: dcmotor7.h:189
Click ctx object definition.
Definition: dcmotor7.h:160
void dcmotor7_cfg_setup(dcmotor7_cfg_t *cfg)
Config Object Initialization function.
pin_name_t sda
Definition: dcmotor7.h:184
pin_name_t scl
Definition: dcmotor7.h:183
digital_out_t pwmb
Definition: dcmotor7.h:164
void dcmotor7_set_motor(dcmotor7_t *ctx, uint8_t motor, uint8_t in1, uint8_t in2)
Functions for set Motor.
uint8_t slave_address
Definition: dcmotor7.h:172
DCMOTOR7_RETVAL dcmotor7_init(dcmotor7_t *ctx, dcmotor7_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition: dcmotor7.h:180
void dcmotor7_motor_stop(dcmotor7_t *ctx, uint8_t motor)
Motor stop function.
void dcmotor7_set_port(dcmotor7_t *ctx, uint8_t port, uint8_t value)
Functions for set port.
void dcmotor7_go_to_stand_by_mode(dcmotor7_t *ctx, uint8_t motor)
Function for setting the motor in stand mode.
void dcmotor7_generic_write(dcmotor7_t *ctx, uint8_t reg, uint8_t tmp)
Generic write function.
void dcmotor7_set_tblkab(dcmotor7_t *ctx, uint8_t tblk)
Functions for set Motor Ach and Bch Digital tBLK.
void dcmotor7_default_cfg(dcmotor7_t *ctx)
Default Confuguration.
void dcmotor7_generic_read(dcmotor7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
i2c_master_t i2c
Definition: dcmotor7.h:168