-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Re-implement PWM generator logic #7231
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
Changes from 1 commit
2c010d6
122ca23
118103b
5cd145e
4ce623d
3a6f6c1
27ee6f8
5faf6be
94af195
1182cd0
7ee7d19
c12e961
143b6ae
a783621
ad3076c
dc32961
ec62ee3
a41890b
42bbede
79a7f7d
cbff7a3
4196bf8
14f4416
2002a5d
5b1f288
f42696c
2b0dde4
b0e818f
dfaa9ce
3909ada
413cd17
07f5ff1
539d0d4
df51b21
867b181
f757778
9424090
c8b53ef
e6b7aa1
28645ff
3ee638c
174d19e
a910eae
179b9d6
e44171f
7fe9a2d
e7cb533
083560d
e421d81
5be4961
051008a
6692418
606c5cd
524f047
361d4a2
975fe12
9e48706
565f21f
272dc9d
8f9af5d
2961933
e5afab0
e5ba217
f911754
1b34278
55e8abb
4cc3d8a
a353909
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Testing indicates that GP16O is just a simple 1-bit wide register in the RTC module. Instead of |= and &- (i.e. RmW), use direct assignment in PWM generator.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,7 +475,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { | |
GPOS = pwmState.mask; // Set all active pins high | ||
// GPIO16 isn't the same as the others | ||
if (pwmState.mask & (1<<16)) { | ||
GP16O |= 1; | ||
GP16O = 1; | ||
} | ||
pwmState.idx = 0; | ||
} else { | ||
|
@@ -484,7 +484,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { | |
GPOC = 1<<pwmState.pin[pwmState.idx]; | ||
// GPIO16 still needs manual work | ||
if (pwmState.pin[pwmState.idx] == 16) { | ||
GP16O &= ~1; | ||
GP16O = 0; | ||
} | ||
pwmState.idx++; | ||
// Any other pins at this same PWM value will have delta==0, drop them too. | ||
|
@@ -516,7 +516,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { | |
// Done, remove! | ||
wvfState.waveformEnabled &= ~mask; | ||
if (i == 16) { | ||
GP16O &= ~1; | ||
GP16O = 0; | ||
} else { | ||
ClearGPIO(mask); | ||
} | ||
|
@@ -533,7 +533,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { | |
wvfState.waveformState ^= mask; | ||
if (wvfState.waveformState & mask) { | ||
if (i == 16) { | ||
GP16O |= 1; // GPIO16 write slow as it's RMW | ||
GP16O = 1; // GPIO16 write slow as it's RMW | ||
} else { | ||
SetGPIO(mask); | ||
} | ||
|
@@ -546,7 +546,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { | |
nextEdgeCycles = wave->timeHighCycles; | ||
} else { | ||
if (i == 16) { | ||
GP16O &= ~1; // GPIO16 write slow as it's RMW | ||
GP16O = 0; // GPIO16 write slow as it's RMW | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No RMW now, remove the confusing comment, too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @earlephilhower The GPIO 16 macros in
Would you feel confident enough to apply the change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm pretty confident that only 1 bit is implemented at that address. Have you ever read anything but 0 for the upper bits in GP16O that makes you concerned? |
||
} else { | ||
ClearGPIO(mask); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.