убрала лишнее

This commit is contained in:
KLASSENTS 2025-01-27 16:12:22 +07:00
parent 27255530d2
commit c23cd3e06d

View File

@ -94,17 +94,13 @@ uint32_t analogInputToChannelNumber(uint32_t PinNumber)
// ---------------------- PWM ---------------------- // // ---------------------- PWM ---------------------- //
// use only if digitalPinHasPWM() == true // use only if digitalPinHasPWM() == true
#define PWM_PIN_TO_PORT_NUMBER(pin) (((pin) & 16) ? 1 : 0) #define PWM_PIN_TO_PORT_NUMBER(pin) (((pin) & 16) ? 1 : 0)
// use only if digitalPinHasPWM() == true
static inline uint8_t pwmPinToGpioPinShift(uint8_t digitalPin)
{
return digitalPin & 3;
}
// use only if digitalPinHasPWM() == true // use only if digitalPinHasPWM() == true
// return true if digitalPin configured as pwm // return true if digitalPin configured as pwm
bool digitalPinPwmIsOn(uint8_t digitalPin) bool digitalPinPwmIsOn(uint8_t digitalPin)
{ {
uint8_t config = 0; uint8_t config = 0;
uint8_t pinShift = pwmPinToGpioPinShift(digitalPin); uint8_t pinShift = digitalPin & 3;
if (PWM_PIN_TO_PORT_NUMBER(digitalPin) == 0) if (PWM_PIN_TO_PORT_NUMBER(digitalPin) == 0)
config = PIN_GET_PAD_CONFIG(PORT_0_CFG, pinShift); config = PIN_GET_PAD_CONFIG(PORT_0_CFG, pinShift);