Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Sep 18, 2024
1 parent cb1e053 commit 65b43e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
14 changes: 0 additions & 14 deletions examples/VoltmeterSayQ/VoltmeterSayQ.ino
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@
#define Serial SerialUSB
#endif

#if defined(ESP32)
/*
* Send serial info over Bluetooth
* Use the Serial Bluetooth Terminal app and connect to ESP32_Talkie
*/
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
#define Serial SerialBT // redirect all Serial output to Bluetooth
#endif

/*
* Voice PWM output pins for different ATmegas:
* ATmega328 (Uno and Nano): non inverted at pin 3, inverted at pin 11.
Expand All @@ -85,14 +75,10 @@ Talkie Voice;
void setup() {
// pinMode(LED_BUILTIN, OUTPUT);

#if defined(ESP32) && defined(Serial)
Serial.begin("ESP32_Talkie", false);
#else
Serial.begin(115200);
while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores.

#endif
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217) || (defined (USBCON) && defined(USBD_USE_CDC))
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!
Expand Down
4 changes: 2 additions & 2 deletions src/Talkie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void Talkie::initializeHardware() {
# define APB_FREQUENCY_DIVIDER 80
if(sTalkieSampleRateTimer == NULL) {
# if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) // timerAlarm() enables it automatically
sTalkieSampleRateTimer = timerBegin(1000000); // Only 1 parameter is required. 1000000 corresponds to 1 MHz / 1 uSec
sTalkieSampleRateTimer = timerBegin(1000000); // Only 1 parameter is required. 1000000 corresponds to 1 MHz / 1 uSec. After successful setup the timer will automatically start.
timerAttachInterrupt(sTalkieSampleRateTimer, timerInterrupt);
timerAlarm(sTalkieSampleRateTimer, (getApbFrequency() / APB_FREQUENCY_DIVIDER) / SAMPLE_RATE, true, 0); // 0 in the last parameter is repeat forever
# else
Expand Down Expand Up @@ -465,7 +465,7 @@ void Talkie::terminateHardware() {
#elif defined(ESP32)
if(sTalkieSampleRateTimer != NULL) {
# if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
timerStop(sTalkieSampleRateTimer);
timerStop(sTalkieSampleRateTimer); // maybe timerEnd() is better, because it releases the hardware?
# else
timerAlarmDisable(sTalkieSampleRateTimer);
# endif
Expand Down
4 changes: 4 additions & 0 deletions src/digitalWriteFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

#include <Arduino.h> // declarations for the fallback to digitalWrite(), digitalRead() etc.

#if defined(MEGATINYCORE)
#error Do not use "#include digitalWriteFast.h" because megaTinyCore has it own digitalWriteFast function set, except digitalToggleFast().
#endif

// --- Arduino Mega and ATmega128x/256x based boards ---
#if (defined(ARDUINO_AVR_MEGA) || \
defined(ARDUINO_AVR_MEGA1280) || \
Expand Down

0 comments on commit 65b43e3

Please sign in to comment.