@@ -79,7 +79,7 @@
|
||||
#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
|
||||
|
||||
// ------------------------
|
||||
// Serial ports
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
|
||||
@@ -112,21 +112,72 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint16_t HAL_adc_result;
|
||||
|
||||
// ------------------------
|
||||
// ADC
|
||||
// Private Variables
|
||||
// ------------------------
|
||||
STM32ADC adc(ADC1);
|
||||
|
||||
uint16_t analogRead(pin_t pin) {
|
||||
const bool is_analog = _GET_MODE(pin) == GPIO_INPUT_ANALOG;
|
||||
return is_analog ? analogRead(uint8_t(pin)) : 0;
|
||||
}
|
||||
|
||||
// Wrapper to maple unprotected analogWrite
|
||||
void analogWrite(pin_t pin, int pwm_val8) {
|
||||
if (PWM_PIN(pin)) analogWrite(uint8_t(pin), pwm_val8);
|
||||
}
|
||||
|
||||
uint16_t MarlinHAL::adc_result;
|
||||
const uint8_t adc_pins[] = {
|
||||
#if HAS_TEMP_ADC_0
|
||||
TEMP_0_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_PROBE
|
||||
TEMP_PROBE_PIN,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
TEMP_BED_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
TEMP_CHAMBER_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
TEMP_COOLER_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_1
|
||||
TEMP_1_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_2
|
||||
TEMP_2_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
TEMP_3_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
TEMP_4_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
TEMP_5_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
TEMP_6_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
TEMP_7_PIN,
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEYPAD_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
JOY_X_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
JOY_Y_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
JOY_Z_PIN,
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
POWER_MONITOR_CURRENT_PIN,
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_VOLTAGE)
|
||||
POWER_MONITOR_VOLTAGE_PIN,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum TempPinIndex : char {
|
||||
#if HAS_TEMP_ADC_0
|
||||
@@ -194,16 +245,15 @@ uint16_t HAL_adc_results[ADC_PIN_COUNT];
|
||||
// ------------------------
|
||||
// Private functions
|
||||
// ------------------------
|
||||
|
||||
static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
|
||||
uint32_t reg_value;
|
||||
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); // only values 0..7 are used
|
||||
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */
|
||||
|
||||
reg_value = SCB->AIRCR; // read old register configuration
|
||||
reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); // clear bits to change
|
||||
reg_value = SCB->AIRCR; /* read old register configuration */
|
||||
reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */
|
||||
reg_value = (reg_value |
|
||||
((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
|
||||
(PriorityGroupTmp << 8)); // Insert write key & priority group
|
||||
(PriorityGroupTmp << 8)); /* Insert write key & priority group */
|
||||
SCB->AIRCR = reg_value;
|
||||
}
|
||||
|
||||
@@ -211,8 +261,6 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
void flashFirmware(const int16_t) { hal.reboot(); }
|
||||
|
||||
//
|
||||
// Leave PA11/PA12 intact if USBSerial is not used
|
||||
//
|
||||
@@ -232,11 +280,7 @@ void flashFirmware(const int16_t) { hal.reboot(); }
|
||||
|
||||
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
|
||||
|
||||
// ------------------------
|
||||
// MarlinHAL class
|
||||
// ------------------------
|
||||
|
||||
void MarlinHAL::init() {
|
||||
void HAL_init() {
|
||||
NVIC_SetPriorityGrouping(0x3);
|
||||
#if PIN_EXISTS(LED)
|
||||
OUT_WRITE(LED_PIN, LOW);
|
||||
@@ -255,7 +299,7 @@ void MarlinHAL::init() {
|
||||
}
|
||||
|
||||
// HAL idle task
|
||||
void MarlinHAL::idletask() {
|
||||
void HAL_idletask() {
|
||||
#if HAS_SHARED_MEDIA
|
||||
// If Marlin is using the SD card we need to lock it to prevent access from
|
||||
// a PC via USB.
|
||||
@@ -270,7 +314,14 @@ void MarlinHAL::idletask() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void MarlinHAL::reboot() { nvic_sys_reset(); }
|
||||
void HAL_clear_reset_source() { }
|
||||
|
||||
/**
|
||||
* TODO: Check this and change or remove.
|
||||
*/
|
||||
uint8_t HAL_get_reset_source() { return RST_POWER_ON; }
|
||||
|
||||
void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
extern "C" {
|
||||
extern unsigned int _ebss; // end of bss section
|
||||
@@ -304,70 +355,11 @@ extern "C" {
|
||||
}
|
||||
*/
|
||||
|
||||
// ------------------------
|
||||
// ADC
|
||||
|
||||
// ------------------------
|
||||
// Init the AD in continuous capture mode
|
||||
void MarlinHAL::adc_init() {
|
||||
static const uint8_t adc_pins[] = {
|
||||
#if HAS_TEMP_ADC_0
|
||||
TEMP_0_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_PROBE
|
||||
TEMP_PROBE_PIN,
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
TEMP_BED_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
TEMP_CHAMBER_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
TEMP_COOLER_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_1
|
||||
TEMP_1_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_2
|
||||
TEMP_2_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
TEMP_3_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
TEMP_4_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
TEMP_5_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
TEMP_6_PIN,
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
TEMP_7_PIN,
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEYPAD_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
JOY_X_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
JOY_Y_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
JOY_Z_PIN,
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
POWER_MONITOR_CURRENT_PIN,
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_VOLTAGE)
|
||||
POWER_MONITOR_VOLTAGE_PIN,
|
||||
#endif
|
||||
};
|
||||
static STM32ADC adc(ADC1);
|
||||
void HAL_adc_init() {
|
||||
// configure the ADC
|
||||
adc.calibrate();
|
||||
#if F_CPU > 72000000
|
||||
@@ -382,10 +374,10 @@ void MarlinHAL::adc_init() {
|
||||
adc.startConversion();
|
||||
}
|
||||
|
||||
void MarlinHAL::adc_start(const pin_t pin) {
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
//TEMP_PINS pin_index;
|
||||
TempPinIndex pin_index;
|
||||
switch (pin) {
|
||||
switch (adc_pin) {
|
||||
default: return;
|
||||
#if HAS_TEMP_ADC_0
|
||||
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
||||
@@ -448,4 +440,20 @@ void MarlinHAL::adc_start(const pin_t pin) {
|
||||
HAL_adc_result = HAL_adc_results[(int)pin_index] >> (12 - HAL_ADC_RESOLUTION); // shift out unused bits
|
||||
}
|
||||
|
||||
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||
|
||||
uint16_t analogRead(pin_t pin) {
|
||||
const bool is_analog = _GET_MODE(pin) == GPIO_INPUT_ANALOG;
|
||||
return is_analog ? analogRead(uint8_t(pin)) : 0;
|
||||
}
|
||||
|
||||
// Wrapper to maple unprotected analogWrite
|
||||
void analogWrite(pin_t pin, int pwm_val8) {
|
||||
if (PWM_PIN(pin)) analogWrite(uint8_t(pin), pwm_val8);
|
||||
}
|
||||
|
||||
void HAL_reboot() { nvic_sys_reset(); }
|
||||
|
||||
void flashFirmware(const int16_t) { HAL_reboot(); }
|
||||
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -66,10 +66,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Serial ports
|
||||
// ------------------------
|
||||
|
||||
#ifdef SERIAL_USB
|
||||
typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
|
||||
extern DefaultSerial1 MSerial0;
|
||||
@@ -145,6 +141,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set interrupt grouping for this MCU
|
||||
void HAL_init();
|
||||
#define HAL_IDLETASK 1
|
||||
void HAL_idletask();
|
||||
|
||||
/**
|
||||
* TODO: review this to return 1 for pins that are not analog input
|
||||
*/
|
||||
@@ -157,7 +158,15 @@
|
||||
#define NO_COMPILE_TIME_PWM
|
||||
#endif
|
||||
|
||||
// Reset Reason
|
||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); (void)__iCliRetVal()
|
||||
#define CRITICAL_SECTION_END() if (!primask) (void)__iSeiRetVal()
|
||||
#define ISRS_ENABLED() (!__get_primask())
|
||||
#define ENABLE_ISRS() ((void)__iSeiRetVal())
|
||||
#define DISABLE_ISRS() ((void)__iCliRetVal())
|
||||
|
||||
// On AVR this is in math.h?
|
||||
#define square(x) ((x)*(x))
|
||||
|
||||
#define RST_POWER_ON 1
|
||||
#define RST_EXTERNAL 2
|
||||
#define RST_BROWN_OUT 4
|
||||
@@ -172,66 +181,46 @@
|
||||
|
||||
typedef int8_t pin_t;
|
||||
|
||||
// ------------------------
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
// Result of last ADC conversion
|
||||
extern uint16_t HAL_adc_result;
|
||||
|
||||
// ------------------------
|
||||
// Interrupts
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
#define CRITICAL_SECTION_START() const bool irqon = !__get_primask(); (void)__iCliRetVal()
|
||||
#define CRITICAL_SECTION_END() if (!primask) (void)__iSeiRetVal()
|
||||
// Disable interrupts
|
||||
#define cli() noInterrupts()
|
||||
|
||||
// Enable interrupts
|
||||
#define sei() interrupts()
|
||||
|
||||
// ------------------------
|
||||
// ADC
|
||||
// ------------------------
|
||||
|
||||
#ifdef ADC_RESOLUTION
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
|
||||
#else
|
||||
#define HAL_ADC_RESOLUTION 12
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_VREF 3.3
|
||||
|
||||
uint16_t analogRead(pin_t pin); // need HAL_ANALOG_SELECT() first
|
||||
void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
|
||||
|
||||
//
|
||||
// Pin Mapping for M42, M43, M226
|
||||
//
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||
|
||||
#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY)
|
||||
#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
|
||||
|
||||
#define PLATFORM_M997_SUPPORT
|
||||
void flashFirmware(const int16_t);
|
||||
|
||||
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||
#ifndef PWM_FREQUENCY
|
||||
#define PWM_FREQUENCY 1000 // Default PWM Frequency
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Class Utilities
|
||||
// ------------------------
|
||||
|
||||
// Memory related
|
||||
#define __bss_end __bss_end__
|
||||
|
||||
void _delay_ms(const int ms);
|
||||
// Clear reset reason
|
||||
void HAL_clear_reset_source();
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
// Reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
void HAL_reboot();
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
/*
|
||||
extern "C" {
|
||||
int freeMemory();
|
||||
}
|
||||
*/
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
|
||||
static inline int freeMemory() {
|
||||
volatile char top;
|
||||
@@ -240,71 +229,58 @@ static inline int freeMemory() {
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// ------------------------
|
||||
// MarlinHAL Class
|
||||
// ------------------------
|
||||
//
|
||||
// ADC
|
||||
//
|
||||
|
||||
class MarlinHAL {
|
||||
public:
|
||||
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG);
|
||||
|
||||
// Earliest possible init, before setup()
|
||||
MarlinHAL() {}
|
||||
void HAL_adc_init();
|
||||
|
||||
static void init(); // Called early in setup()
|
||||
static inline void init_board() {} // Called less early in setup()
|
||||
static void reboot(); // Restart the firmware from 0x0
|
||||
#ifdef ADC_RESOLUTION
|
||||
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
|
||||
#else
|
||||
#define HAL_ADC_RESOLUTION 12
|
||||
#endif
|
||||
|
||||
static inline bool isr_state() { return !__get_primask(); }
|
||||
static inline void isr_on() { ((void)__iSeiRetVal()); }
|
||||
static inline void isr_off() { ((void)__iCliRetVal()); }
|
||||
#define HAL_ADC_VREF 3.3
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
static inline void delay_ms(const int ms) { delay(ms); }
|
||||
void HAL_adc_start_conversion(const uint8_t adc_pin);
|
||||
uint16_t HAL_adc_get_result();
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask();
|
||||
uint16_t analogRead(pin_t pin); // need HAL_ANALOG_SELECT() first
|
||||
void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
|
||||
|
||||
// Reset
|
||||
static inline uint8_t get_reset_source() { return RST_POWER_ON; }
|
||||
static inline void clear_reset_source() {}
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||
|
||||
// Free SRAM
|
||||
static inline int freeMemory() { return ::freeMemory(); }
|
||||
#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY)
|
||||
#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
|
||||
|
||||
//
|
||||
// ADC Methods
|
||||
//
|
||||
#define PLATFORM_M997_SUPPORT
|
||||
void flashFirmware(const int16_t);
|
||||
|
||||
static uint16_t adc_result;
|
||||
#ifndef PWM_FREQUENCY
|
||||
#define PWM_FREQUENCY 1000 // Default PWM Frequency
|
||||
#endif
|
||||
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||
|
||||
// Called by Temperature::init once at startup
|
||||
static void adc_init();
|
||||
/**
|
||||
* set_pwm_frequency
|
||||
* Set the frequency of the timer corresponding to the provided pin
|
||||
* All Timer PWM pins run at the same frequency
|
||||
*/
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired);
|
||||
|
||||
// Called by Temperature::init for each sensor at startup
|
||||
static inline void adc_enable(const pin_t pin) { pinMode(pin, INPUT_ANALOG); }
|
||||
|
||||
// Begin ADC sampling on the given channel
|
||||
static void adc_start(const pin_t pin);
|
||||
|
||||
// Is the ADC ready for reading?
|
||||
static inline bool adc_ready() { return true; }
|
||||
|
||||
// The current value of the ADC register
|
||||
static uint16_t adc_value() { return adc_result; }
|
||||
|
||||
/**
|
||||
* Set the PWM duty cycle for the pin to the given value.
|
||||
* Optionally invert the duty cycle [default = false]
|
||||
* Optionally change the maximum size of the provided value to enable finer PWM duty control [default = 255]
|
||||
* The timer must be pre-configured with set_pwm_frequency() if the default frequency is not desired.
|
||||
*/
|
||||
static inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false);
|
||||
|
||||
/**
|
||||
* Set the frequency of the timer for the given pin.
|
||||
* All Timer PWM pins run at the same frequency.
|
||||
*/
|
||||
static void set_pwm_frequency(const pin_t pin, int f_desired);
|
||||
|
||||
};
|
||||
|
||||
extern MarlinHAL hal;
|
||||
/**
|
||||
* set_pwm_duty
|
||||
* Set the PWM duty cycle of the provided pin to the provided value
|
||||
* Optionally allows inverting the duty cycle [default = false]
|
||||
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
|
||||
* The timer must be pre-configured with set_pwm_frequency() if the default frequency is not desired.
|
||||
*/
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
#define SERVO_DEFAULT_MIN_ANGLE 0
|
||||
#define SERVO_DEFAULT_MAX_ANGLE 180
|
||||
|
||||
class libServo;
|
||||
typedef libServo hal_servo_t;
|
||||
#define HAL_SERVO_LIB libServo
|
||||
|
||||
class libServo {
|
||||
public:
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <pwm.h>
|
||||
#include "HAL.h"
|
||||
#include "timers.h"
|
||||
|
||||
#define NR_TIMERS TERN(STM32_XL_DENSITY, 14, 8) // Maple timers, 14 for STM32_XL_DENSITY (F/G chips), 8 for HIGH density (C D E)
|
||||
|
||||
@@ -36,7 +38,7 @@ inline uint8_t timer_and_index_for_pin(const pin_t pin, timer_dev **timer_ptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
if (!PWM_PIN(pin)) return;
|
||||
|
||||
timer_dev *timer; UNUSED(timer);
|
||||
@@ -49,7 +51,7 @@ void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v
|
||||
timer_set_mode(timer, channel, TIMER_PWM); // PWM Output Mode
|
||||
}
|
||||
|
||||
void MarlinHAL::set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer
|
||||
|
||||
timer_dev *timer; UNUSED(timer);
|
||||
|
||||
@@ -188,7 +188,7 @@ FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
||||
}
|
||||
}
|
||||
|
||||
#define HAL_timer_isr_epilogue(T) NOOP
|
||||
#define HAL_timer_isr_epilogue(T)
|
||||
|
||||
// No command is available in framework to turn off ARPE bit, which is turned on by default in libmaple.
|
||||
// Needed here to reset ARPE=0 for stepper timer
|
||||
|
||||
Reference in New Issue
Block a user