Skip to content

Commit 5889c49

Browse files
committed
some comments and small typo for atmega328
1 parent 3704a14 commit 5889c49

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/drivers/hardware_api.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
#include "../common/foc_utils.h"
55
#include "../common/time_utils.h"
66

7+
// flag returned if driver init fails
78
#define SIMPLEFOC_DRIVER_INIT_FAILED ((void*)-1)
89

10+
// generic implementation of the hardware specific structure
11+
// containing all the necessary driver parameters
12+
// will be returned as a void pointer from the _configurexPWM functions
13+
// will be provided to the _writeDutyCyclexPWM() as a void pointer
914
typedef struct GenericDriverParams {
1015
int pins[6];
1116
long pwm_frequency;

src/drivers/hardware_specific/atmega328_mcu.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){
7272
// function setting the high pwm frequency to the supplied pins
7373
// - Stepper motor - 4PWM setting
7474
// - hardware speciffic
75-
// supports Arudino/ATmega328
75+
// supports Arduino/ATmega328
7676
void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const int pin2A, const int pin2B) {
7777
// High PWM frequency
7878
// - always max 32kHz
@@ -128,7 +128,7 @@ int _configureComplementaryPair(int pinH, int pinL) {
128128
}
129129

130130
// Configuring PWM frequency, resolution and alignment
131-
// - BLDC driver - 6PWM setting
131+
// - BLDC driver - setting
132132
// - hardware specific
133133
// supports Arudino/ATmega328
134134
void* _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) {
@@ -140,8 +140,8 @@ void* _configure6PWM(long pwm_frequency, float dead_zone, const int pinA_h, cons
140140
ret_flag += _configureComplementaryPair(pinC_h, pinC_l);
141141
if (ret_flag!=0) return SIMPLEFOC_DRIVER_INIT_FAILED;
142142
GenericDriverParams* params = new GenericDriverParams {
143-
.pins = { pinA_h,, pinA_l, pinB_h, pinB_l, pinC_h, pinC_l },
144-
.pwm_frequency = pwm_frequency
143+
.pins = { pinA_h, pinA_l, pinB_h, pinB_l, pinC_h, pinC_l },
144+
.pwm_frequency = pwm_frequency,
145145
.dead_zone = dead_zone
146146
};
147147
return params;

0 commit comments

Comments
 (0)