FabGL
ESP32 VGA Controller and Graphics Library
swgenerator.h
Go to the documentation of this file.
1 /*
2  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3  Copyright (c) 2019 Fabrizio Di Vittorio.
4  All rights reserved.
5 
6  This file is part of FabGL Library.
7 
8  FabGL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  FabGL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with FabGL. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #pragma once
24 
25 
26 
34 #include <stdint.h>
35 #include <stddef.h>
36 
37 #include "rom/lldesc.h"
38 
39 #include "fabglconf.h"
40 
41 
42 
43 
44 
45 namespace fabgl {
46 
47 
48 
61 
62 public:
63 
64  void begin();
65 
90  void begin(bool div1_onGPIO0, gpio_num_t div2 = GPIO_NUM_39, gpio_num_t div4 = GPIO_NUM_39, gpio_num_t div8 = GPIO_NUM_39, gpio_num_t div16 = GPIO_NUM_39, gpio_num_t div32 = GPIO_NUM_39, gpio_num_t div64 = GPIO_NUM_39, gpio_num_t div128 = GPIO_NUM_39, gpio_num_t div256 = GPIO_NUM_39);
91 
95  void end();
96 
108  void play(int freq, lldesc_t volatile * dmaBuffers = nullptr);
109 
113  void stop();
114 
115 private:
116 
117  void setupClock(int freq);
118  static void setupGPIO(gpio_num_t gpio, int bit, gpio_mode_t mode);
119 
120  bool m_DMAStarted;
121  volatile lldesc_t * m_DMABuffer;
122  volatile uint8_t * m_DMAData;
123 };
124 
125 
126 
127 
128 
129 } // end of namespace
130 
131 
132 
133 
134 extern fabgl::SquareWaveGeneratorClass SquareWaveGenerator;
135 
136 
137 
138 
void end()
Disables all outputs.
Definition: swgenerator.cpp:89
Definition: canvas.cpp:47
This file contains FabGL library configuration settings, like number of supported colors...
This is a square wave generator that uses APLL internal Audio PLL clock.
Definition: swgenerator.h:60
void stop()
Disables all outputs.
Definition: swgenerator.cpp:181
void play(int freq, lldesc_t volatile *dmaBuffers=nullptr)
Sets the main frequency.
Definition: swgenerator.cpp:115