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 BRUSHLESS4_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
68 cfg.fg = MIKROBUS( mikrobus, MIKROBUS_INT )
75#define BRUSHLESS4_RETVAL uint8_t
77#define BRUSHLESS4_OK 0x00
78#define BRUSHLESS4_INIT_ERROR 0xFF
85#define BRUSHLESS4_DEF_FREQ 20000
#define BRUSHLESS4_RETVAL
Definition brushless4.h:75
void brushless4_pwm_start(brushless4_t *ctx)
Start PWM module.
BRUSHLESS4_RETVAL brushless4_init(brushless4_t *ctx, brushless4_cfg_t *cfg)
Initialization function.
void brushless4_motor_parameters(brushless4_t *ctx, uint8_t poles, uint8_t slots)
Setting the number of poles and number of slots.
uint16_t brushless4_get_speed(brushless4_t *ctx, uint16_t pulse_sample)
Calculation of speed.
void brushless4_set_duty_cycle(brushless4_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
void brushless4_cfg_setup(brushless4_cfg_t *cfg)
Config Object Initialization function.
void brushless4_default_cfg(brushless4_t *ctx)
Click Default Configuration function.
void brushless4_pwm_pin(brushless4_t *ctx, uint8_t state)
Set the state of the PWM pin.
uint8_t brushless4_fg_get(brushless4_t *ctx)
The state of the interrupt pin.
void brushless4_pwm_stop(brushless4_t *ctx)
Stop PWM module.
Click configuration structure definition.
Definition brushless4.h:124
pin_name_t fg
Definition brushless4.h:131
uint32_t dev_pwm_freq
Definition brushless4.h:135
pin_name_t pwm
Definition brushless4.h:127
Click ctx object definition.
Definition brushless4.h:99
uint16_t slots_poles
Definition brushless4.h:116
uint32_t pwm_freq
Definition brushless4.h:112
uint8_t num_of_poles
Definition brushless4.h:114
uint8_t num_of_slots
Definition brushless4.h:115
digital_in_t fg
Definition brushless4.h:103
pwm_t pwm
Definition brushless4.h:107
uint16_t pwm_period
Definition brushless4.h:111