17#include <zephyr/drivers/gpio.h>
18#include <zephyr/drivers/pwm.h>
21#define NXP_HBRIDGE_NUM_GPIOS 2
24#define NXP_HBRIDGE_MAX_SPEED 100
34#define NXP_HBRIDGE_MOTOR_INVERT BIT(0)
int nxp_hbridge_init(struct nxp_hbridge *hbridge)
Initialize the L298 H-BRIDGE module.
Definition hbridge.c:141
#define NXP_HBRIDGE_NUM_GPIOS
Definition hbridge.h:21
int nxp_hbridge_set_speed(struct nxp_hbridge *hbridge, uint32_t speed)
Set the speed of the car's motors.
Definition hbridge.c:175
nxp_hbridge_direction
Represents the spinning direction of a motor.
Definition hbridge.h:69
@ NXP_HBRIDGE_DIRECTION_OFF
Definition hbridge.h:71
@ NXP_HBRIDGE_DIRECTION_BACKWARDS
Definition hbridge.h:75
@ NXP_HBRIDGE_DIRECTION_FORWARD
Definition hbridge.h:73
int nxp_hbridge_set_direction(struct nxp_hbridge *hbridge, int direction)
Set the spinning direction of the car's motors.
Definition hbridge.c:109
Represents the L298N H-BRIDGE module.
Definition hbridge.h:44
int lgpios[2]
Definition hbridge.h:52
uint32_t lflags
Definition hbridge.h:60
const struct device * pwm_dev
Definition hbridge.h:48
int lchan
Definition hbridge.h:56
int rgpios[2]
Definition hbridge.h:54
int rchan
Definition hbridge.h:58
const struct device * gpio_dev
Definition hbridge.h:46
uint32_t period
Definition hbridge.h:50
uint32_t rflags
Definition hbridge.h:62