mirror of https://github.com/arendst/Tasmota.git
Update core_esp8266_wiring_pwm.cpp
This commit is contained in:
parent
d3a9413a7c
commit
041be8882e
|
@ -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) {
|
if (pin > 16) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t analogPeriod;
|
uint32_t analogPeriod;
|
||||||
if (period == 0) {
|
{
|
||||||
analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
|
uint32_t analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
|
||||||
} else {
|
|
||||||
analogPeriod = period;
|
|
||||||
}
|
|
||||||
|
|
||||||
//uint32_t analogPeriod = microsecondsToClockCycles(1000000UL) / analogFreq;
|
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
val = 0;
|
val = 0;
|
||||||
} else if (val > analogScale) {
|
} 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)) {
|
if (startWaveformClockCycles(pin, high, low, 0, phaseReference, 0, true)) {
|
||||||
analogMap |= (1 << pin);
|
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 analogWrite(uint8_t pin, int val) __attribute__((weak, alias("__analogWrite")));
|
||||||
extern void analogWriteFreq(uint32_t freq) __attribute__((weak, alias("__analogWriteFreq")));
|
extern void analogWriteFreq(uint32_t freq) __attribute__((weak, alias("__analogWriteFreq")));
|
||||||
extern void analogWriteRange(uint32_t range) __attribute__((weak, alias("__analogWriteRange")));
|
extern void analogWriteRange(uint32_t range) __attribute__((weak, alias("__analogWriteRange")));
|
||||||
|
|
Loading…
Reference in New Issue