Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analogWrite(pin, 255) should be always on, but is only 99.5% on #40

Open
danieleff opened this issue Sep 4, 2017 · 1 comment
Open

Comments

@danieleff
Copy link
Owner

No description provided.

@csnol
Copy link

csnol commented Sep 15, 2017

@danieleff
It's maybe useful that change analogWrite() of STM32GENERIC/STM32/cores/arduino/stm32/stm32_PWM.c
I've tested on STM32F0.

void analogWrite(uint8_t pin, int value) {
if(value == 255) {
	stm32_pwm_disable(variant_pin_list[pin].port, variant_pin_list[pin].pin_mask);
	pinMode(pin, OUTPUT);
	digitalWrite(pin, 1);
	}
else
    pwmWrite(pin, ((uint32_t)value << 16) >> analogWriteResolutionBits, PWM_FREQUENCY_HZ, 0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants