STM32F1: M43 PINS_DEBUGGING (#14072)

This commit is contained in:
Tanguy Pruvot
2019-06-21 08:20:17 +02:00
committed by Scott Lahteine
parent 81d550754a
commit 52383633e7
6 changed files with 150 additions and 7 deletions

View File

@@ -32,9 +32,10 @@
// --------------------------------------------------------------------------
#include "HAL.h"
#include <STM32ADC.h>
#include "../../inc/MarlinConfig.h"
#include <STM32ADC.h>
// --------------------------------------------------------------------------
// Externals
// --------------------------------------------------------------------------
@@ -314,4 +315,15 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
uint16_t HAL_adc_get_result(void) { 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) && IS_OUTPUT(pin))
analogWrite(uint8_t(pin), pwm_val8);
}
#endif // __STM32F1__