Skip to content

Commit

Permalink
fixes for FAN1 support (issue #76)
Browse files Browse the repository at this point in the history
  • Loading branch information
aegean-odyssey committed Aug 27, 2021
1 parent dad62e8 commit b7708a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions marlin_changes/HAL_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void HAL_setup(void)
HAL_InitTick(PRIORITY_TICK);
HAL_gpio_init();
HAL_tim1_init();
#if CONFIGURE_FAN1_AND_EXTRA_IO && (PWM_A3 > 0)
#if CONFIGURE_FAN1_AND_EXTRA_IO
HAL_tim15_init();
#endif
HAL_flashstore_init();
Expand Down Expand Up @@ -448,7 +448,7 @@ void HAL_set_pwm(uint8_t pin, uint8_t v)
{
if (pin == PWM_PA8) HAL_tim1_pwm(v);

#if CONFIGURE_FAN1_AND_EXTRA_IO && (PWM_PA3 > 0)
#if CONFIGURE_FAN1_AND_EXTRA_IO
if (pin == PWM_PA3) HAL_tim15_pwm(v);
#endif
}
Expand All @@ -461,7 +461,7 @@ void HAL_set_pwm(uint8_t pin, uint8_t v)
* TMR15 (aux fan control, fan1)
*/

#if CONFIGURE_FAN1_AND_EXTRA_IO && (PWM_PA3 > 0)
#if CONFIGURE_FAN1_AND_EXTRA_IO

#define TIM15_PRESCALE 5682
#define TIM15_PWM_MAX 255
Expand Down
4 changes: 4 additions & 0 deletions marlin_changes/HAL_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ uint16_t HAL_adc_read(void);

// TIM

// FAN_PIN and FAN1_PIN are not available to HAL_stm32.c, so we explicitly
// set PWM_PA8 and PWM_PA3 here to match FAN_PIN and FAN1_PIN, respectively.
// These definitions are only used in HAL_set_pwm().
//
// must match pin description file, pins_MALYAN_M300.h
#define PWM_PA8 20 // FAN_PIN
#define PWM_PA3 35 // FAN1_PIN
Expand Down

0 comments on commit b7708a6

Please sign in to comment.