Update xsns_01_counter.ino

This commit is contained in:
stefanbode 2020-07-03 09:01:02 +02:00 committed by GitHub
parent fa4680bb61
commit 6bd4edcdae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,11 @@ void CounterUpdate(uint8_t index)
uint32_t steps = (current_cycle-last_cycle+100000)/(clockCyclesPerMicrosecond() * 10000);
cycle_time = (current_cycle-last_cycle)/steps;
#ifdef ESP8266
analogWriteCCyPeriod(Pin(GPIO_PWM1, index), 5, cycle_time );
pinMode(Pin(GPIO_PWM1, index), OUTPUT);
uint32_t high = (cycle_time * 5) / 1023;
uint32_t low = cycle_time - high;
// Find the first GPIO being generated by checking GCC's find-first-set (returns 1 + the bit of the first 1 in an int32_t
startWaveformClockCycles(Pin(GPIO_PWM1, index), high, low, 0, -1, 0, true);
#else
analogWrite(Pin(GPIO_PWM1, index), 5);
#endif