Skip to content

Commit 48e1e01

Browse files
authored
Feature/led clock source (#148)
* feat(led): Allow clock configuration * Update LED to support clock configuration such as LEDC_USE_RC_FAST_CLK * Update LED example to showcase clock configuration * add gitattributes file for line ending consistency * doc: rebuild
1 parent d4b93b9 commit 48e1e01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+200
-186
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Normalize EOL for all files that Git considers text files.
2+
* text=auto eol=lf

components/led/example/main/led_example.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern "C" void app_main(void) {
6767
.frequency_hz = 5000,
6868
.channels = led_channels,
6969
.duty_resolution = LEDC_TIMER_10_BIT,
70+
.clock_config = LEDC_USE_RC_FAST_CLK,
7071
});
7172
espp::Gaussian gaussian({.gamma = 0.1f, .alpha = 1.0f, .beta = 0.5f});
7273
auto breathe = [&gaussian, &breathing_period]() -> float {

components/led/include/led.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class Led {
4949
ledc_timer_bit_t duty_resolution{
5050
LEDC_TIMER_13_BIT}; /**< The resolution of the duty cycle for these LEDs. @note this is
5151
inversely related to the frequency configuration. */
52+
ledc_clk_cfg_t clock_config{
53+
LEDC_AUTO_CLK}; /**< The LEDC clock configuration you want for these LED channels. */
5254
ledc_mode_t speed_mode{
5355
LEDC_LOW_SPEED_MODE}; /**< The LEDC speed mode you want for these LED channels. */
5456
Logger::Verbosity log_level{Logger::Verbosity::WARN}; /**< Log verbosity for the task. */
@@ -70,7 +72,7 @@ class Led {
7072
ledc_timer.freq_hz = config.frequency_hz;
7173
ledc_timer.speed_mode = config.speed_mode;
7274
ledc_timer.timer_num = config.timer;
73-
ledc_timer.clk_cfg = LEDC_AUTO_CLK;
75+
ledc_timer.clk_cfg = config.clock_config;
7476
ledc_timer_config(&ledc_timer);
7577

7678
logger_.info("Initializing channels");

docs/adc/adc_types.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
<li><a href="index.html">ADC APIs</a> &raquo;</li>
147147
<li>ADC Types</li>
148148
<li class="wy-breadcrumbs-aside">
149-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/adc_types.rst" class="fa fa-github"> Edit on GitHub</a>
149+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/adc_types.rst" class="fa fa-github"> Edit on GitHub</a>
150150
</li>
151151
</ul>
152152
<hr/>
@@ -163,7 +163,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
163163
<section id="header-file">
164164
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
165165
<ul class="simple">
166-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/57b5b0c/components/adc/include/adc_types.hpp">components/adc/include/adc_types.hpp</a></p></li>
166+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/e14a4b5/components/adc/include/adc_types.hpp">components/adc/include/adc_types.hpp</a></p></li>
167167
</ul>
168168
</section>
169169
</section>

docs/adc/ads1x15.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<li><a href="index.html">ADC APIs</a> &raquo;</li>
148148
<li>ADS1x15 I2C ADC</li>
149149
<li class="wy-breadcrumbs-aside">
150-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/ads1x15.rst" class="fa fa-github"> Edit on GitHub</a>
150+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/ads1x15.rst" class="fa fa-github"> Edit on GitHub</a>
151151
</li>
152152
</ul>
153153
<hr/>
@@ -164,7 +164,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
164164
<section id="header-file">
165165
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
166166
<ul class="simple">
167-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/8bb04df/components/ads1x15/include/ads1x15.hpp">components/ads1x15/include/ads1x15.hpp</a></p></li>
167+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/97fac41/components/ads1x15/include/ads1x15.hpp">components/ads1x15/include/ads1x15.hpp</a></p></li>
168168
</ul>
169169
</section>
170170
<section id="classes">

docs/adc/ads7138.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<li><a href="index.html">ADC APIs</a> &raquo;</li>
148148
<li>ADS7138 I2C ADC</li>
149149
<li class="wy-breadcrumbs-aside">
150-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/ads7138.rst" class="fa fa-github"> Edit on GitHub</a>
150+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/ads7138.rst" class="fa fa-github"> Edit on GitHub</a>
151151
</li>
152152
</ul>
153153
<hr/>
@@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
169169
<section id="header-file">
170170
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
171171
<ul class="simple">
172-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/8bb04df/components/ads7138/include/ads7138.hpp">components/ads7138/include/ads7138.hpp</a></p></li>
172+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/97fac41/components/ads7138/include/ads7138.hpp">components/ads7138/include/ads7138.hpp</a></p></li>
173173
</ul>
174174
</section>
175175
<section id="classes">

docs/adc/continuous_adc.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<li><a href="index.html">ADC APIs</a> &raquo;</li>
148148
<li>Continuous ADC</li>
149149
<li class="wy-breadcrumbs-aside">
150-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/continuous_adc.rst" class="fa fa-github"> Edit on GitHub</a>
150+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/continuous_adc.rst" class="fa fa-github"> Edit on GitHub</a>
151151
</li>
152152
</ul>
153153
<hr/>
@@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
169169
<section id="header-file">
170170
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
171171
<ul class="simple">
172-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/8bb04df/components/adc/include/continuous_adc.hpp">components/adc/include/continuous_adc.hpp</a></p></li>
172+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/97fac41/components/adc/include/continuous_adc.hpp">components/adc/include/continuous_adc.hpp</a></p></li>
173173
</ul>
174174
</section>
175175
<section id="classes">

docs/adc/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
140140
<li>ADC APIs</li>
141141
<li class="wy-breadcrumbs-aside">
142-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/index.rst" class="fa fa-github"> Edit on GitHub</a>
142+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/index.rst" class="fa fa-github"> Edit on GitHub</a>
143143
</li>
144144
</ul>
145145
<hr/>

docs/adc/oneshot_adc.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<li><a href="index.html">ADC APIs</a> &raquo;</li>
148148
<li>Oneshot ADC</li>
149149
<li class="wy-breadcrumbs-aside">
150-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/oneshot_adc.rst" class="fa fa-github"> Edit on GitHub</a>
150+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/oneshot_adc.rst" class="fa fa-github"> Edit on GitHub</a>
151151
</li>
152152
</ul>
153153
<hr/>
@@ -168,7 +168,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
168168
<section id="header-file">
169169
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
170170
<ul class="simple">
171-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/8bb04df/components/adc/include/oneshot_adc.hpp">components/adc/include/oneshot_adc.hpp</a></p></li>
171+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/97fac41/components/adc/include/oneshot_adc.hpp">components/adc/include/oneshot_adc.hpp</a></p></li>
172172
</ul>
173173
</section>
174174
<section id="classes">

docs/adc/tla2528.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<li><a href="index.html">ADC APIs</a> &raquo;</li>
148148
<li>TLA2528 I2C ADC</li>
149149
<li class="wy-breadcrumbs-aside">
150-
<a href="https://github.com/esp-cpp/espp/blob/8bb04df/docs/en/adc/tla2528.rst" class="fa fa-github"> Edit on GitHub</a>
150+
<a href="https://github.com/esp-cpp/espp/blob/97fac41/docs/en/adc/tla2528.rst" class="fa fa-github"> Edit on GitHub</a>
151151
</li>
152152
</ul>
153153
<hr/>
@@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
169169
<section id="header-file">
170170
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
171171
<ul class="simple">
172-
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/8bb04df/components/tla2528/include/tla2528.hpp">components/tla2528/include/tla2528.hpp</a></p></li>
172+
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/97fac41/components/tla2528/include/tla2528.hpp">components/tla2528/include/tla2528.hpp</a></p></li>
173173
</ul>
174174
</section>
175175
<section id="classes">

0 commit comments

Comments
 (0)