42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
66#define DCMOTOR_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
68 cfg. slp = MIKROBUS( mikrobus, MIKROBUS_AN ); \
69 cfg. sl1 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg. sl2 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg. flt = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define DCMOTOR_RETVAL uint8_t
80#define DCMOTOR_OK 0x00
81#define DCMOTOR_INIT_ERROR 0xFF
88#define DCMOTOR_DEF_FREQ 20000
#define DCMOTOR_RETVAL
Definition dcmotor.h:78
void dcmotor_right_direction_fast(dcmotor_t *ctx)
Select right direction, fast decay function.
void dcmotor_left_direction_slow(dcmotor_t *ctx)
Select left direction, slow decay function.
void dcmotor_sleep_mode(dcmotor_t *ctx)
Set sleep mode function.
uint8_t dcmotor_get_diagnostic(dcmotor_t *ctx)
Get diagnostic function.
DCMOTOR_RETVAL dcmotor_init(dcmotor_t *ctx, dcmotor_cfg_t *cfg)
Initialization function.
void dcmotor_set_duty_cycle(dcmotor_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
void dcmotor_right_direction_slow(dcmotor_t *ctx)
Select right direction, slow decay function.
void dcmotor_pwm_stop(dcmotor_t *ctx)
Stop PWM module.
void dcmotor_cfg_setup(dcmotor_cfg_t *cfg)
Config Object Initialization function.
void dcmotor_pwm_start(dcmotor_t *ctx)
Start PWM module.
void dcmotor_enable(dcmotor_t *ctx)
Enable the motor function.
void dcmotor_left_direction_fast(dcmotor_t *ctx)
Select left direction, fast decay function.
Click configuration structure definition.
Definition dcmotor.h:129
pin_name_t sl2
Definition dcmotor.h:138
pin_name_t slp
Definition dcmotor.h:136
uint32_t dev_pwm_freq
Definition dcmotor.h:143
pin_name_t flt
Definition dcmotor.h:139
pin_name_t pwm
Definition dcmotor.h:132
pin_name_t sl1
Definition dcmotor.h:137
Click ctx object definition.
Definition dcmotor.h:102
digital_out_t sl2
Definition dcmotor.h:108
digital_in_t flt
Definition dcmotor.h:112
digital_out_t slp
Definition dcmotor.h:106
uint32_t pwm_freq
Definition dcmotor.h:121
digital_out_t sl1
Definition dcmotor.h:107
pwm_t pwm
Definition dcmotor.h:116
uint16_t pwm_period
Definition dcmotor.h:120