arduino-audio-tools
Loading...
Searching...
No Matches
AudioRuntime.h
1#pragma once
2
3#include <string.h>
4#include <stdint.h>
5#include <assert.h>
6
7#include "AudioToolsConfig.h"
8
9namespace audio_tools {
10
18inline void stop() {
19 #ifdef EXIT_ON_STOP
20 exit(0);
21 #else
22 while(true){
23 delay(1000);
24 }
25 #endif
26}
27
29inline static void checkMemory(bool printMemory=false) {
30 #if defined(ESP32) && defined(ARDUINO)
31 assert(heap_caps_check_integrity_all(true));
32 if (printMemory) Serial.printf("==> Available stack: %d - heap: %u - psram: %u\n",(int) uxTaskGetStackHighWaterMark(NULL), (unsigned)ESP.getFreeHeap(),(unsigned)ESP.getFreePsram());
33 #endif
34}
35
36#ifdef ARDUINO
37inline void printNChar(char ch, int n){
38 for (int j=0;j<n;j++) Serial.print(ch);
39 Serial.println();
40}
41
42#ifndef ESP_ARDUINO_VERSION_STR
43# define df2xstr(s) #s
44# define df2str(s) df2xstr(s)
45# define ESP_ARDUINO_VERSION_STR df2str(ESP_ARDUINO_VERSION_MAJOR) "." df2str(ESP_ARDUINO_VERSION_MINOR) "." df2str(ESP_ARDUINO_VERSION_PATCH)
46#endif
47
49inline void printVersionInfo() {
50 printNChar('*',50);
51 Serial.print("AudioTools: ");
52 Serial.println(AUDIOTOOLS_VERSION);
53 Serial.print("Arduino: ");
54 Serial.println(ARDUINO);
55#ifdef ESP32
56 Serial.print("Arduino ESP Core Version: ");
57 Serial.println(ESP_ARDUINO_VERSION_STR);
58 Serial.print("IDF Version: ");
59 Serial.println(IDF_VER);
60#endif
61 printNChar('*',50);
62}
63
64#endif
65
66}
void stop()
Public generic methods.
Definition AudioRuntime.h:18
static void checkMemory(bool printMemory=false)
Executes heap_caps_check_integrity_all()
Definition AudioRuntime.h:29
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10