ESPNode
audiomodul.h
Go to the documentation of this file.
1 #ifdef USE_AUDIOMODUL
2 
3 #ifndef _AUDIOMODUL_H_
4 #define _AUDIOMODUL_H_
5 
6 #define USE_SWITCH_ONOFF
7 #include "switch_onoff.h"
8 
9 // Settings for Webradio-Stations definitions
10 #define MAXSTATIONS 10
11 #define STATION_NAME_LENGTH 30
12 #define STATION_URL_LENGTH 128
13 
14 
15 
16 #if defined(CONFIG_IDF_TARGET_ESP32)
17 #ifdef USE_AUDIODISPLAY_GC9A01A
18 #warning "Compiling Display GC9A01A with Settings for ESP32"
19 #ifndef TFT_SCK
20 #define TFT_SCK 18
21 #endif
22 #ifndef TFT_MOSI
23 #define TFT_MOSI 23
24 #endif
25 #ifndef TFT_CS
26 #define TFT_CS 17
27 #endif
28 #ifndef TFT_DC
29 #define TFT_DC 16
30 #endif
31 #endif //USE_Display_GC9A01A
32 
33 #ifdef USE_SDCARD
34 #ifndef SD_CS
35 #define SD_CS 8
36 #endif
37 #ifndef SD_SCK
38 #define SD_SCK 12
39 #endif
40 #ifndef SD_MOSI
41 #define SD_MOSI 11
42 #endif
43 #ifndef SD_MISO
44 #define SD_MISO 13
45 #endif
46 #endif //Use_SDCard
47 
48 #ifdef USE_ROTARY
49 #ifndef ROT_KEY
50 #define ROT_KEY 35
51 #endif
52 #ifndef ROT_S!
53 #define ROT_S1 36
54 #endif
55 #ifndef ROT_S2
56 #define ROT_S2 37
57 #endif
58 #endif //USE_Rotary
59 
60 #define I2S_BCLK 5
61 #define I2S_LRC 4
62 #define I2S_DOUT 6
63 #endif //CONFIG_IDF_TARGET_ESP32
64 
65 #ifdef CONFIG_IDF_TARGET_ESP32S3
66 #ifdef USE_AUDIODISPLAY_GC9A01A
67 #warning "Compiling Display GC9A01A with Settings for ESP32-S3"
68 #ifndef TFT_SCK
69 #define TFT_SCK 12
70 #endif
71 #ifndef TFT_MOSI
72 #define TFT_MOSI 11
73 #endif
74 #ifndef TFT_CS
75 #define TFT_CS 8
76 #endif
77 #ifndef TFT_DC
78 #define TFT_DC 9
79 #endif
80 #ifndef TFT_ROT
81 #define TFT_ROT 3
82 #endif
83 #endif //USE_Display_GC9A01A
84 
85 #ifdef USE_SDCARD
86 #ifndef SD_CS
87 #define SD_CS 8
88 #endif
89 #ifndef SD_SCK
90 #define SD_SCK 12
91 #endif
92 #ifndef SD_MOSI
93 #define SD_MOSI 11
94 #endif
95 #ifndef SD_MISO
96 #define SD_MISO 13
97 #endif
98 #endif //Use_SDCard
99 
100 #ifdef USE_ROTARY
101 #ifndef ROT_KEY
102 #define ROT_KEY 35
103 #endif
104 #ifndef ROT_S!
105 #define ROT_S1 36
106 #endif
107 #ifndef ROT_S2
108 #define ROT_S2 37
109 #endif
110 #endif //USE_Rotary
111 
112 #define I2S_BCLK 5
113 #define I2S_LRC 4
114 #define I2S_DOUT 6
115 #endif //CONFIG_IDF_TARGET_ESP32S3
116 
117 
119 typedef struct {
121  char name[STATION_NAME_LENGTH];
123  char url[STATION_URL_LENGTH];
124 } station_t;
125 
127 typedef enum {
128  Off = 0,
129  Radio,
130  Media,
131  Speaker,
132  Settings,
133  MusicUpdate,
134  LastApp
135 } mymode_t;
136 
137 
138 
139 
140 
141 
142 
144 class AudioModul : public Switch_OnOff {
145 
146 public:
152  void begin(const char* html_place, const char* label, const char* mqtt_name, const char* keyword);
153  bool set(const String& _cmnd, const String& _val);
154  void html_init();
155  void loop(time_t now);
156 private:
158  mymode_t mode;
160  mymode_t last_mode;
162  uint16_t audio_vol;
163 /*
164  uint16_t audio_bas;
165  uint16_t audio_tre;
166 */
167  void html_upd_data();
168  void audio_set_mode(mymode_t new_mode);
169  void audio_off();
170  //void audio_web_stat();
171 
172 #ifdef USE_AUDIO_RADIO
173 
175  station_t audio_radio_station[MAXSTATIONS];
177  uint8_t audio_radio_cur_station;
178 
180  void audio_radio_on();
181 
183  void audio_radio_off();
184 
186  void audio_radio_load_stations();
187 
188  void audio_radio_save_stations();
189 
190 #endif
191 
192 
193 };
194 
195 
196 
197 
198 #endif //_AUDIOMODUL_H_
199 #endif //USE_AUDIOMODUL
time_t now
Eine Variable für Zeitinformationen.
Definition: main.h:115
void loop()
Die Hauptschleife.
Definition: main.cpp:564