Update core_esp8266_wiring_pwm.cpp

This commit is contained in:
stefanbode 2020-07-03 09:04:14 +02:00 committed by GitHub
parent d3a9413a7c
commit 041be8882e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 14 deletions

View File

@ -49,18 +49,13 @@ extern void __analogWriteFreq(uint32_t freq) {
}
extern void __analogWriteCCyPeriod(uint8_t pin, int val, uint32_t period) {
extern void __analogWrite(uint8_t pin, int val) {
if (pin > 16) {
return;
}
uint32_t analogPeriod;
if (period == 0) {
analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
} else {
analogPeriod = period;
}
//uint32_t analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
{
uint32_t analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
if (val < 0) {
val = 0;
} else if (val > analogScale) {
@ -80,14 +75,8 @@ extern void __analogWriteCCyPeriod(uint8_t pin, int val, uint32_t period) {
if (startWaveformClockCycles(pin, high, low, 0, phaseReference, 0, true)) {
analogMap |= (1 << pin);
}
//Serial.printf("phase: %d, high %d, low %d, drift %d, apr: %u\n", phaseReference,high,low, analogDrift, analogPeriod );
}
extern void __analogWrite(uint8_t pin, int val) {
__analogWriteCCyPeriod( pin, val, 0);
}
extern void analogWriteCCyPeriod(uint8_t pin, int val, uint32_t priod) __attribute__((weak, alias("__analogWriteCCyPeriod")));
extern void analogWrite(uint8_t pin, int val) __attribute__((weak, alias("__analogWrite")));
extern void analogWriteFreq(uint32_t freq) __attribute__((weak, alias("__analogWriteFreq")));
extern void analogWriteRange(uint32_t range) __attribute__((weak, alias("__analogWriteRange")));