1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-07 06:01:35 +03:00

install a new waveform-flavouring Arduino IDE menu and a new PIO #define (#7712)

This commit is contained in:
david gauchard
2020-11-19 22:33:31 +01:00
committed by GitHub
parent 0e735e386d
commit eec4dc490b
8 changed files with 205 additions and 18 deletions

View File

@ -39,6 +39,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef WAVEFORM_LOCKED_PHASE
#include "core_esp8266_waveform.h"
#include <Arduino.h>
#include "ets_sys.h"
@ -434,3 +436,5 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
// Register access is fast and edge IRQ was configured before.
T1L = nextEventCcys;
}
#endif // WAVEFORM_LOCKED_PHASE

View File

@ -39,6 +39,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef WAVEFORM_LOCKED_PHASE
#include <Arduino.h>
#ifndef __ESP8266_WAVEFORM_H
@ -86,4 +88,6 @@ void setTimer1Callback(uint32_t (*fn)());
}
#endif
#endif
#endif // __ESP8266_WAVEFORM_H
#endif // WAVEFORM_LOCKED_PHASE

View File

@ -26,22 +26,13 @@
extern "C" {
static uint32_t analogMap = 0;
static int32_t analogScale = 255; // Match upstream default, breaking change from 2.x.x
#ifdef WAVEFORM_LOCKED_PHASE
static uint32_t analogMap = 0;
static uint16_t analogFreq = 1000;
extern void __analogWriteRange(uint32_t range) {
if ((range >= 15) && (range <= 65535)) {
analogScale = range;
}
}
extern void __analogWriteResolution(int res) {
if ((res >= 4) && (res <= 16)) {
analogScale = (1 << res) - 1;
}
}
extern void __analogWriteFreq(uint32_t freq) {
if (freq < 100) {
analogFreq = 100;
@ -82,6 +73,24 @@ extern void __analogWrite(uint8_t pin, int val) {
}
}
#endif // WAVEFORM_LOCKED_PHASE
#ifdef WAVEFORM_LOCKED_PWM
#endif // WAVEFORM_LOCKED_PWM
extern void __analogWriteRange(uint32_t range) {
if ((range >= 15) && (range <= 65535)) {
analogScale = range;
}
}
extern void __analogWriteResolution(int res) {
if ((res >= 4) && (res <= 16)) {
analogScale = (1 << res) - 1;
}
}
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")));