1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

16 Commits

Author SHA1 Message Date
Earle F. Philhower, III
ebda795f34
Support multiple tone(), analogWrite(), and Servo (#4640)
Remove and rewrite all the parts of the core/libraries using TIMER1
and consolidate into a single, shared waveform generation interrupt
structure.  Tone, analogWrite(), Servo all now just call into this
shared resource to perform their tasks so are all compatible
and can be used simultaneously.

This setup enables multiple tones, analogWrites, servos, and stepper
motors to be controlled with reasonable accuracy.  It uses both TIMER1
and the internal ESP cycle counter to handle timing of waveform edges.
TIMER1 is used in non-reload mode and only edges cause interrupts.  The
interrupt is started and stopped as required, minimizing overhead when
these features are not being used.

A generic "startWaveform(pin, high-US, low-US, runtime-US)" and
"stopWaveform(pin)" allow for further types of interfaces.  Minimum
high or low period is ~1 us.

Add a tone(float) method, useful when working with lower frequencies.

Fixes #4321.  Fixes 4349.
2018-06-07 18:38:58 -07:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
Earle F. Philhower, III
f9ac524b13
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
2018-02-17 18:47:10 -08:00
devyte
303a71deea Servo: fix arg types for std::min/max 2017-11-05 14:46:36 +08:00
Ivan Grokhotkov
633e48f3ae Servo: use peripheral clock frequency when calculating FRC1 tick count (#1789) 2016-03-24 01:48:23 +03:00
Ivan Grokhotkov
8d43c40311 Move some Servo functions into IRAM (#1742) 2016-03-10 13:24:14 +03:00
Ivan Grokhotkov
74da596183 Merge pull request #1503 from Makuna/ServoValueRoundOffFix
Servo value read and write fixes
2016-01-26 16:22:48 +03:00
Makuna
acb7dc0681 Servo value read and write fixes
Values that were written and then read would be different due to using
map.
If user defined a different min/max pulse width would cause the
read/write to incorrectly calculate the pulse width.
2016-01-25 16:01:43 -08:00
Ivan Grokhotkov
47102201a8 Merge pull request #1096 from per1234/master
Unique Built-In libraries library.properties name
2016-01-10 23:41:54 +03:00
Makuna
2425ee3413 Fix detach and attach
detaching could leave a running timer which would cause issues.
Further, detaching could truncate the last pulse causing a invalid
movement.
This change moves detaching into the ISR so it can maintain the last
pulse and not start any more timers if not needed.
2015-12-16 15:17:53 -08:00
per1234
f2949c1ee1 Unique Built-In libraries library.properties name
Use unique name values in library.properties for the esp8266 libraries
that are also Arduino IDE Built-In libraries. This solves the issue of
SD and Servo libraries always appearing as Type: Updatable in the
Arduino IDE 1.6.6 Library Manager when an esp8266 board is selected.
2015-12-01 13:07:34 -08:00
Ivan Grokhotkov
28890b39e6 Fix crash in Servo library when flash caching is disabled (#898) 2015-10-18 22:31:33 +03:00
Chris Fraser
d92f2f375e Fix to Servo allowing write() to be called before attach() 2015-09-29 17:02:24 +02:00
Makuna
57642c10b6 Interrupt cleanup
Fixes issue of reentrant calls to nointerrupts()
exposed functional replacements to cli sei and SREG when dealing with
interrupts
InterruptLock class to auto stop and restore interrupt level
Fix user ISR calls to be like Arduino with interrupts disabled fully.
2015-08-03 19:35:17 -07:00
Makuna
d882965027 Remove unneeded Serial output 2015-07-19 14:00:32 -07:00
Makuna
3c3bc0f523 Timer0 and Servo library support
This exposes the Timer0
This provides a Servo library support compatible with Arduino Servo
library but only supports the two timers the esp8266 has available
2015-05-29 13:30:15 -07:00