tb6612fng.h
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef TB6612FNG_H
#define TB6612FNG_H
#include "periph/pwm.h"
#include "periph/gpio.h"
#include "xtimer.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
pwm_t device; /**< the PWM device driving the motor */
int channel; /**< the channel the motor is connected to */
gpio_t in1;
gpio_t in2;
gpio_t stby;
} motor_t;
int motor_init(motor_t *dev, pwm_t pwm, int pwm_channel, gpio_t in1, gpio_t in2, gpio_t stby);
void motor_drive(const motor_t *dev, uint16_t speed, int direction);
void motor_fw(const motor_t *dev, uint16_t speed);
void motor_rev(const motor_t *dev, uint16_t speed);
void motor_brake(const motor_t *dev1, motor_t *dev2);
void motor_forward(const motor_t *dev1, const motor_t *dev2, uint16_t speed);
void motor_back(const motor_t *dev1, const motor_t *dev2, uint16_t speed);
void motor_left(const motor_t *dev1, const motor_t *dev2, uint16_t speed);
void motor_right(const motor_t *dev1,const motor_t *dev2, uint16_t speed);
void motor_stby(const motor_t *dev);
#ifdef __cplusplus
}
#endif
#endif /* TB6612FNG_H */
/** @} */