@@ -97,16 +97,17 @@ ClockDivAndRange getClockDivAndRange(uint32_t pwm_frequency, uint8_t timer_chann
9797 else {
9898 SimpleFOCDebug::println (" DRV: PWM frequency too low" );
9999 }
100-
101100 return result;
102101};
103102
104103
105- bool configureTimerPin (RenesasHardwareDriverParams* params, uint8_t index) {
104+ bool configureTimerPin (RenesasHardwareDriverParams* params, uint8_t index, bool active_high, bool complementary = false , bool complementary_active_high = true ) {
106105 uint8_t pin = params->pins [index];
106+ uint8_t pin_C;
107107 std::array<uint16_t , 3 > pinCfgs = getPinCfgs (pin, PIN_CFG_REQ_PWM);
108+ std::array<uint16_t , 3 > pinCfgs_C;
108109 if (pinCfgs[0 ] == 0 ) {
109- SIMPLEFOC_DEBUG (" DRV: no PWM on pin" );
110+ SIMPLEFOC_DEBUG (" DRV: no PWM on pin " , pin );
110111 return false ;
111112 }
112113 if (IS_PIN_AGT_PWM (pinCfgs[0 ])) {
@@ -121,24 +122,46 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index) {
121122 return false ;
122123 }
123124
125+ if (complementary) {
126+ pin_C = params->pins [index+1 ];
127+ pinCfgs_C = getPinCfgs (pin_C, PIN_CFG_REQ_PWM);
128+ if (pinCfgs_C[0 ] == 0 ) {
129+ SIMPLEFOC_DEBUG (" DRV: no PWM on pin " , pin_C);
130+ return false ;
131+ }
132+ if (IS_PIN_AGT_PWM (pinCfgs_C[0 ]) || GET_CHANNEL (pinCfgs_C[0 ])!=timer_channel) {
133+ SIMPLEFOC_DEBUG (" DRV: comp. channel different" );
134+ return false ;
135+ }
136+ }
137+ TimerPWMChannel_t pwm_output = IS_PWM_ON_A (pinCfgs[0 ]) ? CHANNEL_A : CHANNEL_B;
138+ if (complementary) {
139+ TimerPWMChannel_t pwm_output_C = IS_PWM_ON_A (pinCfgs_C[0 ]) ? CHANNEL_A : CHANNEL_B;
140+ if (pwm_output != CHANNEL_A || pwm_output_C != CHANNEL_B) {
141+ SIMPLEFOC_DEBUG (" DRV: output A/B mismatch" );
142+ return false ;
143+ }
144+ }
145+
124146 // configure GPIO pin
125- // pinMode(pin, OUTPUT);
126147 fsp_err_t err = R_IOPORT_PinCfg (&g_ioport_ctrl, g_pin_cfg[pin].pin , (uint32_t ) (IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_GPT1));
148+ if ((err == FSP_SUCCESS) && complementary)
149+ err = R_IOPORT_PinCfg (&g_ioport_ctrl, g_pin_cfg[pin_C].pin , (uint32_t ) (IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_GPT1));
127150 if (err != FSP_SUCCESS) {
128151 SIMPLEFOC_DEBUG (" DRV: pin config failed" );
129152 return false ;
130153 }
131154
132- TimerPWMChannel_t pwm_output = IS_PWM_ON_A (pinCfgs[0 ]) ? CHANNEL_A : CHANNEL_B;
133-
134155
135156 // configure timer channel - frequency / top value
136157 ClockDivAndRange timings = getClockDivAndRange (params->pwm_frequency , timer_channel);
137158 #if defined(SIMPLEFOC_RENESAS_DEBUG)
138159 SimpleFOCDebug::println (" ---PWM Config---" );
139160 SimpleFOCDebug::println (" DRV: pwm pin: " , pin);
161+ if (complementary)
162+ SimpleFOCDebug::println (" DRV: compl. pin: " , pin_C);
140163 SimpleFOCDebug::println (" DRV: pwm channel: " , timer_channel);
141- SimpleFOCDebug::print (" DRV: pwm A/B: " ); SimpleFOCDebug::println (( pwm_output==CHANNEL_A)?" A" :" B" );
164+ SimpleFOCDebug::print (" DRV: pwm A/B: " ); SimpleFOCDebug::println (complementary? " A+B " :(( pwm_output==CHANNEL_A)?" A" :" B" ) );
142165 SimpleFOCDebug::println (" DRV: pwm freq: " , (int )params->pwm_frequency );
143166 SimpleFOCDebug::println (" DRV: pwm range: " , (int )timings.range );
144167 SimpleFOCDebug::println (" DRV: pwm clkdiv: " , timings.clk_div );
@@ -171,35 +194,45 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index) {
171194 t->pwm_cfg .interrupt_skip_adc = GPT_INTERRUPT_SKIP_ADC_NONE;
172195 t->pwm_cfg .gtioca_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED;
173196 t->pwm_cfg .gtiocb_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED;
197+ // configure dead-time if both outputs are used
198+ if (complementary) {
199+ uint32_t dt = params->dead_zone * timings.range ;
200+ t->pwm_cfg .dead_time_count_up = dt;
201+ t->pwm_cfg .dead_time_count_down = dt;
202+ }
174203
175-
176-
177- // configure timer channel - polarity
204+ // configure timer channel - outputs and polarity
178205 t->ext_cfg .gtior_setting .gtior = 0L ;
179- if (pwm_output == CHANNEL_A) {
180- t->duty_pin = GPT_IO_PIN_GTIOCA;
181- t->ext_cfg .gtioca .output_enabled = true ;
182- t->ext_cfg .gtiocb .output_enabled = false ;
183- t->ext_cfg .gtior_setting .gtior_b .gtioa = 0x03 | (SIMPLEFOC_PWM_ACTIVE_HIGH ? 0x00 : 0x08 );
184- t->ext_cfg .gtior_setting .gtior_b .oadflt = SIMPLEFOC_PWM_ACTIVE_HIGH ? 0x00 : 0x01 ;
185- t->ext_cfg .gtior_setting .gtior_b .oahld = 0x0 ;
186- t->ext_cfg .gtior_setting .gtior_b .oadf = 0x0 ;
187- t->ext_cfg .gtior_setting .gtior_b .nfaen = 0x0 ;
188- }
206+ if (!complementary) {
207+ if (pwm_output == CHANNEL_A) {
208+ t->duty_pin = GPT_IO_PIN_GTIOCA;
209+ t->ext_cfg .gtioca .output_enabled = true ;
210+ t->ext_cfg .gtiocb .output_enabled = false ;
211+ t->ext_cfg .gtior_setting .gtior_b .gtioa = 0x03 | (active_high ? 0x00 : 0x10 );
212+ t->ext_cfg .gtior_setting .gtior_b .oadflt = active_high ? 0x00 : 0x01 ;
213+ // t->ext_cfg.gtior_setting.gtior_b.oahld = 0x0;
214+ // t->ext_cfg.gtior_setting.gtior_b.oadf = 0x0;
215+ // t->ext_cfg.gtior_setting.gtior_b.nfaen = 0x0;
216+ }
217+ else {
218+ t->duty_pin = GPT_IO_PIN_GTIOCB;
219+ t->ext_cfg .gtiocb .output_enabled = true ;
220+ t->ext_cfg .gtioca .output_enabled = false ;
221+ t->ext_cfg .gtior_setting .gtior_b .gtiob = 0x03 | (active_high ? 0x00 : 0x10 );
222+ t->ext_cfg .gtior_setting .gtior_b .obdflt = active_high ? 0x00 : 0x01 ;
223+ }
224+ }
189225 else {
190- t->duty_pin = GPT_IO_PIN_GTIOCB;
191- t->ext_cfg .gtiocb .output_enabled = true ;
192- t->ext_cfg .gtioca .output_enabled = false ;
193- t->ext_cfg .gtior_setting .gtior_b .gtiob = 0x03 | (SIMPLEFOC_PWM_ACTIVE_HIGH ? 0x00 : 0x08 );
194- t->ext_cfg .gtior_setting .gtior_b .obdflt = SIMPLEFOC_PWM_ACTIVE_HIGH ? 0x00 : 0x01 ;
195- t->ext_cfg .gtior_setting .gtior_b .obhld = 0x0 ;
196- t->ext_cfg .gtior_setting .gtior_b .obdf = 0x0 ;
197- t->ext_cfg .gtior_setting .gtior_b .nfben = 0x0 ;
198- }
199- // t->duty_pin = GPT_IO_PIN_GTIOCA_AND_GTIOCB;
200- // TODO configure timer channel - dead-time if both outputs are used
201- memset (&(t->ctrl ), 0 , sizeof (gpt_instance_ctrl_t ));
226+ t->duty_pin = GPT_IO_PIN_GTIOCA_AND_GTIOCB;
227+ t->ext_cfg .gtioca .output_enabled = true ;
228+ t->ext_cfg .gtiocb .output_enabled = true ;
229+ t->ext_cfg .gtior_setting .gtior_b .gtioa = 0x03 | (active_high ? 0x00 : 0x10 );
230+ t->ext_cfg .gtior_setting .gtior_b .oadflt = active_high ? 0x00 : 0x01 ;
231+ t->ext_cfg .gtior_setting .gtior_b .gtiob = 0x03 | (complementary_active_high ? 0x00 : 0x10 );
232+ t->ext_cfg .gtior_setting .gtior_b .obdflt = complementary_active_high ? 0x00 : 0x01 ;
233+ }
202234
235+ memset (&(t->ctrl ), 0 , sizeof (gpt_instance_ctrl_t ));
203236 err = R_GPT_Open (&(t->ctrl ),&(t->timer_cfg ));
204237 if ((err != FSP_ERR_ALREADY_OPEN) && (err != FSP_SUCCESS)) {
205238 SIMPLEFOC_DEBUG (" DRV: open failed" );
@@ -210,11 +243,6 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index) {
210243 SimpleFOCDebug::println (" DRV: timer already open" );
211244 }
212245 #endif
213- // err = R_GPT_Enable(&(t->ctrl));
214- // if (err != FSP_SUCCESS) {
215- // SIMPLEFOC_DEBUG("DRV: enable failed");
216- // return false;
217- // }
218246 err = R_GPT_PeriodSet (&(t->ctrl ), t->timer_cfg .period_counts );
219247 if (err != FSP_SUCCESS) {
220248 SIMPLEFOC_DEBUG (" DRV: period set failed" );
@@ -225,17 +253,21 @@ bool configureTimerPin(RenesasHardwareDriverParams* params, uint8_t index) {
225253 SIMPLEFOC_DEBUG (" DRV: pin enable failed" );
226254 return false ;
227255 }
256+
257+ channel_used[timer_channel] = true ;
228258 params->timer_config [index] = t;
229259 params->channels [index] = timer_channel;
230- channel_used[timer_channel] = true ;
260+ if (complementary) {
261+ params->timer_config [index+1 ] = t;
262+ params->channels [index+1 ] = timer_channel;
263+ }
231264
232265 return true ;
233266}
234267
235268
269+ // start the timer channels for the motor, synchronously
236270bool startTimerChannels (RenesasHardwareDriverParams* params, int num_channels) {
237-
238- // start the channels
239271 uint32_t mask = 0 ;
240272 for (int i = 0 ; i < num_channels; i++) {
241273 RenesasTimerConfig* t = params->timer_config [i];
@@ -256,6 +288,18 @@ bool startTimerChannels(RenesasHardwareDriverParams* params, int num_channels) {
256288}
257289
258290
291+ // check if the given pins are on the same timer channel
292+ bool isHardware6Pwm (const int pin1, const int pin2) {
293+ std::array<uint16_t , 3 > pinCfgs1 = getPinCfgs (pin1, PIN_CFG_REQ_PWM);
294+ std::array<uint16_t , 3 > pinCfgs2 = getPinCfgs (pin2, PIN_CFG_REQ_PWM);
295+ if (pinCfgs1[0 ] == 0 || pinCfgs2[0 ] == 0 )
296+ return false ;
297+ if (IS_PIN_AGT_PWM (pinCfgs1[0 ]) || IS_PIN_AGT_PWM (pinCfgs2[0 ]))
298+ return false ;
299+ uint8_t timer_channel1 = GET_CHANNEL (pinCfgs1[0 ]);
300+ uint8_t timer_channel2 = GET_CHANNEL (pinCfgs2[0 ]);
301+ return timer_channel1==timer_channel2;
302+ }
259303
260304
261305
@@ -264,7 +308,7 @@ void* _configure1PWM(long pwm_frequency, const int pinA) {
264308 params->pins [0 ] = pinA;
265309 params->pwm_frequency = (pwm_frequency==NOT_SET)?RENESAS_DEFAULT_PWM_FREQUENCY:pwm_frequency;
266310 bool success = true ;
267- success = configureTimerPin (params, 0 );
311+ success = configureTimerPin (params, 0 , SIMPLEFOC_PWM_ACTIVE_HIGH );
268312 if (success)
269313 success = startTimerChannels (params, 1 );
270314 if (!success)
@@ -278,11 +322,10 @@ void* _configure2PWM(long pwm_frequency,const int pinA, const int pinB) {
278322 params->pins [0 ] = pinA; params->pins [1 ] = pinB;
279323 params->pwm_frequency = (pwm_frequency==NOT_SET)?RENESAS_DEFAULT_PWM_FREQUENCY:pwm_frequency;
280324 bool success = true ;
281- success = configureTimerPin (params, 0 );
282- if (success)
283- success = configureTimerPin (params, 1 );
284- if (success)
285- success = startTimerChannels (params, 2 );
325+ success = configureTimerPin (params, 0 , SIMPLEFOC_PWM_ACTIVE_HIGH);
326+ success &= configureTimerPin (params, 1 , SIMPLEFOC_PWM_ACTIVE_HIGH);
327+ if (!success)
328+ success &= startTimerChannels (params, 2 );
286329 if (!success)
287330 return SIMPLEFOC_DRIVER_INIT_FAILED;
288331 return params;
@@ -294,11 +337,9 @@ void* _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const in
294337 params->pins [0 ] = pinA; params->pins [1 ] = pinB; params->pins [2 ] = pinC;
295338 params->pwm_frequency = (pwm_frequency==NOT_SET)?RENESAS_DEFAULT_PWM_FREQUENCY:pwm_frequency;
296339 bool success = true ;
297- success = configureTimerPin (params, 0 );
298- if (success)
299- success = configureTimerPin (params, 1 );
300- if (success)
301- success = configureTimerPin (params, 2 );
340+ success = configureTimerPin (params, 0 , SIMPLEFOC_PWM_ACTIVE_HIGH);
341+ success &= configureTimerPin (params, 1 , SIMPLEFOC_PWM_ACTIVE_HIGH);
342+ success &= configureTimerPin (params, 2 , SIMPLEFOC_PWM_ACTIVE_HIGH);
302343 if (success)
303344 success = startTimerChannels (params, 3 );
304345 if (!success)
@@ -312,13 +353,10 @@ void* _configure4PWM(long pwm_frequency, const int pin1A, const int pin1B, const
312353 params->pins [0 ] = pin1A; params->pins [1 ] = pin1B; params->pins [2 ] = pin2A; params->pins [3 ] = pin2B;
313354 params->pwm_frequency = (pwm_frequency==NOT_SET)?RENESAS_DEFAULT_PWM_FREQUENCY:pwm_frequency;
314355 bool success = true ;
315- success = configureTimerPin (params, 0 );
316- if (success)
317- success = configureTimerPin (params, 1 );
318- if (success)
319- success = configureTimerPin (params, 2 );
320- if (success)
321- success = configureTimerPin (params, 3 );
356+ success = configureTimerPin (params, 0 , SIMPLEFOC_PWM_ACTIVE_HIGH);
357+ success &= configureTimerPin (params, 1 , SIMPLEFOC_PWM_ACTIVE_HIGH);
358+ success &= configureTimerPin (params, 2 , SIMPLEFOC_PWM_ACTIVE_HIGH);
359+ success &= configureTimerPin (params, 3 , SIMPLEFOC_PWM_ACTIVE_HIGH);
322360 if (success)
323361 success = startTimerChannels (params, 4 );
324362 if (!success)
@@ -328,10 +366,38 @@ void* _configure4PWM(long pwm_frequency, const int pin1A, const int pin1B, const
328366
329367
330368void * _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){
331- GenericDriverParams* params = new GenericDriverParams {
332- .pins = { pinA_h, pinA_l, pinB_h, pinB_l, pinC_h, pinC_l },
333- .pwm_frequency = pwm_frequency
334- };
369+ RenesasHardwareDriverParams* params = new RenesasHardwareDriverParams;
370+ params->pins [0 ] = pinA_h; params->pins [1 ] = pinA_l; params->pins [2 ] = pinB_h; params->pins [3 ] = pinB_l; params->pins [4 ] = pinC_h; params->pins [5 ] = pinC_l;
371+ params->pwm_frequency = (pwm_frequency==NOT_SET)?RENESAS_DEFAULT_PWM_FREQUENCY:pwm_frequency;
372+ params->dead_zone = (dead_zone==NOT_SET)?RENESAS_DEFAULT_DEAD_ZONE:dead_zone;
373+
374+ bool success = true ;
375+ if (isHardware6Pwm (pinA_h, pinA_l)) {
376+ success &= configureTimerPin (params, 0 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH, true , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH));
377+ }
378+ else {
379+ success &= configureTimerPin (params, 0 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH);
380+ success &= configureTimerPin (params, 1 , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH)); // reverse polarity on low side gives desired active high/low behaviour
381+ }
382+ if (isHardware6Pwm (pinB_h, pinB_l)) {
383+ success &= configureTimerPin (params, 2 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH, true , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH));
384+ }
385+ else {
386+ success &= configureTimerPin (params, 2 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH);
387+ success &= configureTimerPin (params, 3 , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH));
388+ }
389+ if (isHardware6Pwm (pinC_h, pinC_l)) {
390+ success &= configureTimerPin (params, 4 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH, true , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH));
391+ }
392+ else {
393+ success &= configureTimerPin (params, 4 , SIMPLEFOC_PWM_HIGHSIDE_ACTIVE_HIGH);
394+ success &= configureTimerPin (params, 5 , !(SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH));
395+ }
396+
397+ if (success)
398+ success = startTimerChannels (params, 6 );
399+ if (!success)
400+ return SIMPLEFOC_DRIVER_INIT_FAILED;
335401 return params;
336402}
337403
@@ -364,24 +430,18 @@ void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){
364430void _writeDutyCycle3PWM (float dc_a, float dc_b, float dc_c, void * params){
365431 RenesasTimerConfig* t = ((RenesasHardwareDriverParams*)params)->timer_config [0 ];
366432 uint32_t duty_cycle_counts = (uint32_t )(dc_a * (float )(t->timer_cfg .period_counts ));
367- // SimpleFOCDebug::println("Duty A: ", (int)duty_cycle_counts);
368433 if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts, t->duty_pin ) != FSP_SUCCESS) {
369434 // error
370- Serial.println (" pwm set error A" );
371435 }
372436 t = ((RenesasHardwareDriverParams*)params)->timer_config [1 ];
373437 duty_cycle_counts = (uint32_t )(dc_b * (float )(t->timer_cfg .period_counts ));
374- // SimpleFOCDebug::println("Duty B: ", (int)duty_cycle_counts);
375438 if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts, t->duty_pin ) != FSP_SUCCESS) {
376439 // error
377- Serial.println (" pwm set error B" );
378440 }
379441 t = ((RenesasHardwareDriverParams*)params)->timer_config [2 ];
380442 duty_cycle_counts = (uint32_t )(dc_c * (float )(t->timer_cfg .period_counts ));
381- // SimpleFOCDebug::println("Duty C: ", (int)duty_cycle_counts);
382443 if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts, t->duty_pin ) != FSP_SUCCESS) {
383444 // error
384- Serial.println (" pwm set error C" );
385445 }
386446}
387447
@@ -410,7 +470,50 @@ void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, vo
410470}
411471
412472
473+ // TODO phase-state
413474void _writeDutyCycle6PWM (float dc_a, float dc_b, float dc_c, PhaseState *phase_state, void * params){
475+ RenesasTimerConfig* t = ((RenesasHardwareDriverParams*)params)->timer_config [0 ];
476+ uint32_t dt = (uint32_t )(((RenesasHardwareDriverParams*)params)->dead_zone * (float )(t->timer_cfg .period_counts ));
477+ uint32_t duty_cycle_counts = (uint32_t )(dc_a * (float )(t->timer_cfg .period_counts ));
478+ bool hw_deadtime = ((RenesasHardwareDriverParams*)params)->channels [0 ] == ((RenesasHardwareDriverParams*)params)->channels [1 ];
479+ uint32_t dt_act = (duty_cycle_counts>0 && !hw_deadtime)?dt:0 ;
480+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts - dt_act, t->duty_pin ) != FSP_SUCCESS) {
481+ // error
482+ }
483+ if (!hw_deadtime) {
484+ t = ((RenesasHardwareDriverParams*)params)->timer_config [1 ];
485+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts + dt_act, t->duty_pin ) != FSP_SUCCESS) {
486+ // error
487+ }
488+ }
489+
490+ t = ((RenesasHardwareDriverParams*)params)->timer_config [2 ];
491+ duty_cycle_counts = (uint32_t )(dc_b * (float )(t->timer_cfg .period_counts ));
492+ hw_deadtime = ((RenesasHardwareDriverParams*)params)->channels [2 ] == ((RenesasHardwareDriverParams*)params)->channels [3 ];
493+ dt_act = (duty_cycle_counts>0 && !hw_deadtime)?dt:0 ;
494+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts - dt_act, t->duty_pin ) != FSP_SUCCESS) {
495+ // error
496+ }
497+ if (!hw_deadtime) {
498+ t = ((RenesasHardwareDriverParams*)params)->timer_config [3 ];
499+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts + dt_act, t->duty_pin ) != FSP_SUCCESS) {
500+ // error
501+ }
502+ }
503+
504+ t = ((RenesasHardwareDriverParams*)params)->timer_config [4 ];
505+ duty_cycle_counts = (uint32_t )(dc_c * (float )(t->timer_cfg .period_counts ));
506+ hw_deadtime = ((RenesasHardwareDriverParams*)params)->channels [4 ] == ((RenesasHardwareDriverParams*)params)->channels [5 ];
507+ dt_act = (duty_cycle_counts>0 && !hw_deadtime)?dt:0 ;
508+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts, t->duty_pin ) != FSP_SUCCESS) {
509+ // error
510+ }
511+ if (!hw_deadtime) {
512+ t = ((RenesasHardwareDriverParams*)params)->timer_config [5 ];
513+ if (R_GPT_DutyCycleSet (&(t->ctrl ), duty_cycle_counts + dt_act, t->duty_pin ) != FSP_SUCCESS) {
514+ // error
515+ }
516+ }
414517
415518}
416519
0 commit comments