SimpleFOClibrary  2.1
drivers/hardware_api.h File Reference

Go to the source code of this file.

Functions

void _configure2PWM (long pwm_frequency, const int pinA, const int pinB)
 
void _configure3PWM (long pwm_frequency, const int pinA, const int pinB, const int pinC)
 
void _configure4PWM (long pwm_frequency, const int pin1A, const int pin1B, const int pin2A, const int pin2B)
 
int _configure6PWM (long pwm_frequency, float dead_zone, const int pinA_h, const int pinA_l, const int pinB_h, const int pinB_l, const int pinC_h, const int pinC_l)
 
void _writeDutyCycle2PWM (float dc_a, float dc_b, int pinA, int pinB)
 
void _writeDutyCycle3PWM (float dc_a, float dc_b, float dc_c, int pinA, int pinB, int pinC)
 
void _writeDutyCycle4PWM (float dc_1a, float dc_1b, float dc_2a, float dc_2b, int pin1A, int pin1B, int pin2A, int pin2B)
 
void _writeDutyCycle6PWM (float dc_a, float dc_b, float dc_c, float dead_zone, int pinA_h, int pinA_l, int pinB_h, int pinB_l, int pinC_h, int pinC_l)
 

Function Documentation

◆ _configure2PWM()

void _configure2PWM ( long  pwm_frequency,
const int  pinA,
const int  pinB 
)

Configuring PWM frequency, resolution and alignment

  • Stepper driver - 2PWM setting
  • hardware specific
Parameters
pwm_frequency- frequency in hertz - if applicable
pinApinA bldc driver
pinBpinB bldc driver

Definition at line 23 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _configure3PWM()

void _configure3PWM ( long  pwm_frequency,
const int  pinA,
const int  pinB,
const int  pinC 
)

Configuring PWM frequency, resolution and alignment

  • BLDC driver - 3PWM setting
  • hardware specific
Parameters
pwm_frequency- frequency in hertz - if applicable
pinApinA bldc driver
pinBpinB bldc driver
pinCpinC bldc driver

Definition at line 31 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _configure4PWM()

void _configure4PWM ( long  pwm_frequency,
const int  pin1A,
const int  pin1B,
const int  pin2A,
const int  pin2B 
)

Configuring PWM frequency, resolution and alignment

  • Stepper driver - 4PWM setting
  • hardware specific
Parameters
pwm_frequency- frequency in hertz - if applicable
pin1Apin1A stepper driver
pin1Bpin1B stepper driver
pin2Apin2A stepper driver
pin2Bpin2B stepper driver

Definition at line 40 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _configure6PWM()

int _configure6PWM ( long  pwm_frequency,
float  dead_zone,
const int  pinA_h,
const int  pinA_l,
const int  pinB_h,
const int  pinB_l,
const int  pinC_h,
const int  pinC_l 
)

Configuring PWM frequency, resolution and alignment

  • BLDC driver - 6PWM setting
  • hardware specific
Parameters
pwm_frequency- frequency in hertz - if applicable
dead_zoneduty cycle protection zone [0, 1] - both low and high side low - if applicable
pinA_hpinA high-side bldc driver
pinA_lpinA low-side bldc driver
pinB_hpinA high-side bldc driver
pinB_lpinA low-side bldc driver
pinC_hpinA high-side bldc driver
pinC_lpinA low-side bldc driver
Returns
0 if config good, -1 if failed

Definition at line 47 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _writeDutyCycle2PWM()

void _writeDutyCycle2PWM ( float  dc_a,
float  dc_b,
int  pinA,
int  pinB 
)

Function setting the duty cycle to the pwm pin (ex. analogWrite())

  • Stepper driver - 2PWM setting
  • hardware specific
Parameters
dc_aduty cycle phase A [0, 1]
dc_bduty cycle phase B [0, 1]
pinAphase A hardware pin number
pinBphase B hardware pin number

Definition at line 55 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _writeDutyCycle3PWM()

void _writeDutyCycle3PWM ( float  dc_a,
float  dc_b,
float  dc_c,
int  pinA,
int  pinB,
int  pinC 
)

Function setting the duty cycle to the pwm pin (ex. analogWrite())

  • BLDC driver - 3PWM setting
  • hardware specific
Parameters
dc_aduty cycle phase A [0, 1]
dc_bduty cycle phase B [0, 1]
dc_cduty cycle phase C [0, 1]
pinAphase A hardware pin number
pinBphase B hardware pin number
pinCphase C hardware pin number

Definition at line 64 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _writeDutyCycle4PWM()

void _writeDutyCycle4PWM ( float  dc_1a,
float  dc_1b,
float  dc_2a,
float  dc_2b,
int  pin1A,
int  pin1B,
int  pin2A,
int  pin2B 
)

Function setting the duty cycle to the pwm pin (ex. analogWrite())

  • Stepper driver - 4PWM setting
  • hardware specific
Parameters
dc_1aduty cycle phase 1A [0, 1]
dc_1bduty cycle phase 1B [0, 1]
dc_2aduty cycle phase 2A [0, 1]
dc_2bduty cycle phase 2B [0, 1]
pin1Aphase 1A hardware pin number
pin1Bphase 1B hardware pin number
pin2Aphase 2A hardware pin number
pin2Bphase 2B hardware pin number

Definition at line 74 of file drivers/hardware_specific/generic_mcu.cpp.

◆ _writeDutyCycle6PWM()

void _writeDutyCycle6PWM ( float  dc_a,
float  dc_b,
float  dc_c,
float  dead_zone,
int  pinA_h,
int  pinA_l,
int  pinB_h,
int  pinB_l,
int  pinC_h,
int  pinC_l 
)

Function setting the duty cycle to the pwm pin (ex. analogWrite())

  • BLDC driver - 6PWM setting
  • hardware specific
Parameters
dc_aduty cycle phase A [0, 1]
dc_bduty cycle phase B [0, 1]
dc_cduty cycle phase C [0, 1]
dead_zoneduty cycle protection zone [0, 1] - both low and high side low
pinA_hphase A high-side hardware pin number
pinA_lphase A low-side hardware pin number
pinB_hphase B high-side hardware pin number
pinB_lphase B low-side hardware pin number
pinC_hphase C high-side hardware pin number
pinC_lphase C low-side hardware pin number

Definition at line 86 of file drivers/hardware_specific/generic_mcu.cpp.