Skip to content

Commit cb1e053

Browse files
committed
Support for ESP32 3.x
1 parent e4b4b9c commit cb1e053

File tree

11 files changed

+197
-29
lines changed

11 files changed

+197
-29
lines changed

Diff for: .github/workflows/LibraryBuild.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
steps:
6363
# First of all, we clone the repo using the `checkout` action.
6464
- name: Checkout
65-
uses: actions/checkout@v3
65+
uses: actions/checkout@master
6666

6767
- name: Compile all examples using the arduino-test-compile action
6868
uses: ArminJo/arduino-test-compile@master

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Available as [Arduino library "Talkie"](https://www.arduinolibraries.info/librar
2020

2121
[![Button Install](https://img.shields.io/badge/Install-brightgreen?logoColor=white&logo=GitBook)](https://www.ardu-badge.com/Talkie)
2222
   
23-
[![Button Changelog](https://img.shields.io/badge/Changelog-blue?logoColor=white&logo=AzureArtifacts)](https://github.com/ArminJo/Talkie#revision-history)
23+
[![Button Changelog](https://img.shields.io/badge/Changelog-blue?logoColor=white&logo=AzureArtifacts)](https://github.com/ArminJo/Talkie?tab=readme-ov-file#revision-history)
2424

2525
<br/>
2626
The original version can be found [here](https://github.com/going-digital/Talkie).<br/>
@@ -104,7 +104,7 @@ The 8 kHz interrupt handling requires **8 &micro;s** for Roger Clark core and **
104104
The predefined vocabulary can be found in the [Vocab\_\*.h files](https://github.com/ArminJo/Talkie/blob/master/src), especially in [Vocab_US_Large.h](https://github.com/ArminJo/Talkie/blob/master/src/Vocab_US_Large.h).
105105

106106
# Own vocabulary
107-
To create LPC data you can use the [python_wizard](https://github.com/ptwz/python_wizard) like described [here](https://youtu.be/KQseCA0nftI) or the [BlueWizard](https://github.com/patrick99e99/BlueWizard) for Mac OS X.
107+
To create LPC data you can use the [python_wizard](https://github.com/ptwz/python_wizard) or the [BlueWizard](https://github.com/patrick99e99/BlueWizard) for Mac OS X.
108108

109109
Another way to create LPC data is to use [Qboxpro](http://ftp.whtech.com/pc%20utilities/qboxpro.zip), an unsupported old Windows application running under XP, which can produce Talkie compatible data streams. The missing BWCC.DLL (Borland Windows Custom Control Library) can be found e.g. [here](http://www.download-dll.com/dll-BWCC.dll.html).
110110
The process is described [here](http://furrtek.free.fr/index.php?a=speakandspell&ss=9&i=2) and goes like this:

Diff for: examples/TalkieVocabularyDemo/TalkieVocabularyDemo.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ Talkie voice;
5252
void setup() {
5353
pinMode(LED_BUILTIN, OUTPUT);
5454
Serial.begin(115200);
55-
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/|| defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
55+
while (!Serial)
56+
; // Wait for Serial to become available. Is optimized away for some cores.
57+
58+
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
59+
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
5660
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
5761
#endif
5862
// Just to know which program is running on my Arduino

Diff for: examples/USDistanceToVoice/HCSR04.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@
7070
//#define USE_PIN_CHANGE_INTERRUPT_D0_TO_D7 // using PCINT2_vect - PORT D
7171
//#define USE_PIN_CHANGE_INTERRUPT_D8_TO_D13 // using PCINT0_vect - PORT B - Pin 13 is feedback output
7272
//#define USE_PIN_CHANGE_INTERRUPT_A0_TO_A5 // using PCINT1_vect - PORT C
73+
#if __has_include("digitalWriteFast.h")
7374
#include "digitalWriteFast.h"
75+
#else
76+
#define pinModeFast pinMode
77+
#define digitalReadFast digitalRead
78+
#define digitalWriteFast digitalWrite
79+
#define digitalToggleFast(P) digitalWrite(P, ! digitalRead(P))
80+
#endif
81+
7482
#include "HCSR04.h"
7583

7684
//#define DEBUG
@@ -132,6 +140,7 @@ void initUSDistancePin(uint8_t aTriggerOutEchoInPin) {
132140
#if !defined (TRIGGER_OUT_PIN)
133141
sTriggerOutPin = aTriggerOutEchoInPin;
134142
#endif
143+
(void) aTriggerOutEchoInPin;
135144
sHCSR04Mode = HCSR04_MODE_USE_1_PIN;
136145
}
137146

Diff for: examples/USDistanceToVoice/USDistanceToVoice.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ void setup() {
6161
pinMode(LED_BUILTIN, OUTPUT);
6262

6363
Serial.begin(115200);
64-
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/|| defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
64+
while (!Serial)
65+
; // Wait for Serial to become available. Is optimized away for some cores.
66+
67+
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
68+
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
6569
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
6670
#endif
6771
// Just to know which program is running on my Arduino

Diff for: examples/Voltmeter/Voltmeter.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ void sayNumber(long n);
4242
void setup() {
4343
pinMode(LED_BUILTIN, OUTPUT);
4444
Serial.begin(115200);
45-
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/|| defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
45+
while (!Serial)
46+
; // Wait for Serial to become available. Is optimized away for some cores.
47+
48+
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
49+
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
4650
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
4751
#endif
4852
// Just to know which program is running on my Arduino

Diff for: examples/VoltmeterSayQ/ADCUtils.h

+20-3
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,39 @@
8585
#define ADC_TEMPERATURE_CHANNEL_MUX 15
8686
#define ADC_1_1_VOLT_CHANNEL_MUX 12
8787
#define ADC_GND_CHANNEL_MUX 13
88+
#define ADC_CHANNEL_MUX_MASK 0x0F
8889

8990
#elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
9091
#define ADC_ISCR_CHANNEL_MUX 3
9192
#define ADC_TEMPERATURE_CHANNEL_MUX 11
9293
#define ADC_1_1_VOLT_CHANNEL_MUX 12
9394
#define ADC_GND_CHANNEL_MUX 14
9495
#define ADC_VCC_4TH_CHANNEL_MUX 13
96+
#define ADC_CHANNEL_MUX_MASK 0x1F
9597

9698
#elif defined(__AVR_ATmega328P__)
9799
#define ADC_TEMPERATURE_CHANNEL_MUX 8
98100
#define ADC_1_1_VOLT_CHANNEL_MUX 14
99101
#define ADC_GND_CHANNEL_MUX 15
102+
#define ADC_CHANNEL_MUX_MASK 0x0F
103+
104+
#elif defined(__AVR_ATmega644P__)
105+
#define ADC_TEMPERATURE_CHANNEL_MUX // not existent
106+
#define ADC_1_1_VOLT_CHANNEL_MUX 0x1E
107+
#define ADC_GND_CHANNEL_MUX 0x1F
108+
#define ADC_CHANNEL_MUX_MASK 0x0F
100109

101110
#elif defined(__AVR_ATmega32U4__)
102111
#define ADC_TEMPERATURE_CHANNEL_MUX 0x27
103112
#define ADC_1_1_VOLT_CHANNEL_MUX 0x1E
104113
#define ADC_GND_CHANNEL_MUX 0x1F
114+
#define ADC_CHANNEL_MUX_MASK 0x3F
105115

106116
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
107117
#define ADC_1_1_VOLT_CHANNEL_MUX 0x1E
108118
#define ADC_GND_CHANNEL_MUX 0x1F
119+
#define ADC_CHANNEL_MUX_MASK 0x1F
120+
109121
#define INTERNAL INTERNAL1V1
110122

111123
#else
@@ -164,7 +176,10 @@ uint16_t waitAndReadADCChannelWithReferenceAndRestoreADMUXAndReference(uint8_t a
164176
uint16_t readADCChannelWithOversample(uint8_t aADCChannelNumber, uint8_t aOversampleExponent);
165177
void setADCChannelAndReferenceForNextConversion(uint8_t aADCChannelNumber, uint8_t aReference);
166178
uint16_t readADCChannelWithReferenceOversampleFast(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aOversampleExponent);
167-
uint16_t readADCChannelWithReferenceMultiSamples(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples);
179+
uint32_t readADCChannelMultiSamples(uint8_t aPrescale, uint16_t aNumberOfSamples);
180+
uint16_t readADCChannelMultiSamplesWithReference(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples);
181+
uint32_t readADCChannelMultiSamplesWithReferenceAndPrescaler(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aPrescale,
182+
uint16_t aNumberOfSamples);
168183
uint16_t readADCChannelWithReferenceMax(uint8_t aADCChannelNumber, uint8_t aReference, uint16_t aNumberOfSamples);
169184
uint16_t readADCChannelWithReferenceMaxMicros(uint8_t aADCChannelNumber, uint8_t aReference, uint16_t aMicrosecondsToAquire);
170185
uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aDelay,
@@ -192,13 +207,15 @@ float getCPUTemperatureSimple(void);
192207
float getCPUTemperature(void);
193208
float getTemperature(void) __attribute__ ((deprecated ("Renamed to getCPUTemperature()"))); // deprecated
194209

195-
bool isVCCUSBPowered() ;
210+
bool isVCCUSBPowered();
211+
bool isVCCUSBPowered(Print *aSerial);
196212
bool isVCCUndervoltageMultipleTimes();
197213
void resetCounterForVCCUndervoltageMultipleTimes();
198214
bool isVCCUndervoltage();
199215
bool isVCCEmergencyUndervoltage();
200216
bool isVCCOvervoltage();
201-
bool isVCCOvervoltageSimple();
217+
bool isVCCOvervoltageSimple(); // Version using readVCCVoltageMillivoltSimple()
218+
bool isVCCTooHighSimple(); // Version not using readVCCVoltageMillivoltSimple()
202219

203220
#endif // defined(__AVR__) ...
204221

0 commit comments

Comments
 (0)