Skip to content

Feature/display task stack config #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions components/display/include/display.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class Display {
gpio_num_t backlight_pin; /**< GPIO pin for the backlight. */
bool backlight_on_value{
true}; /**< Value to write to the backlight pin to turn the backlight on. */
size_t stack_size_bytes{
4096}; /**< Size of the display task stack in bytes. */
std::chrono::duration<float> update_period{
0.01}; /**< How frequently to run the update function. */
bool double_buffered{
Expand Down Expand Up @@ -85,6 +87,8 @@ class Display {
gpio_num_t backlight_pin; /**< GPIO pin for the backlight. */
bool backlight_on_value{
true}; /**< Value to write to the backlight pin to turn the backlight on. */
size_t stack_size_bytes{
4096}; /**< Size of the display task stack in bytes. */
std::chrono::duration<float> update_period{
0.01}; /**< How frequently to run the update function. */
Rotation rotation{Rotation::LANDSCAPE}; /**< Default / Initial rotation of the display. */
Expand Down Expand Up @@ -122,7 +126,7 @@ class Display {
assert(vram_1_ != NULL);
}
created_vram_ = true;
init(config.flush_callback, config.software_rotation_enabled, config.rotation);
init(config.flush_callback, config.software_rotation_enabled, config.rotation, config.stack_size_bytes);
set_brightness(1.0f);
}

Expand All @@ -146,7 +150,7 @@ class Display {
update_period_(config.update_period),
logger_({.tag = "Display", .level = config.log_level}) {
logger_.debug("Initializing with non-allocating config!");
init(config.flush_callback, config.software_rotation_enabled, config.rotation);
init(config.flush_callback, config.software_rotation_enabled, config.rotation, config.stack_size_bytes);
}

/**
Expand Down Expand Up @@ -252,8 +256,9 @@ class Display {
* @param sw_rotation_enabled Whether to use software roation (slower) or
* not.
* @param rotation Default / initial rotation of the display.
* @param stack_size_bytes Size of the task stack in bytes.
*/
void init(flush_fn flush_callback, bool sw_rotation_enabled, Rotation rotation) {
void init(flush_fn flush_callback, bool sw_rotation_enabled, Rotation rotation, size_t stack_size_bytes = 4096) {
lv_init();

// Configure the LVGL display buffer with our pixel buffers
Expand All @@ -275,7 +280,7 @@ class Display {
task_ = Task::make_unique({
.name = "Display",
.callback = std::bind(&Display::update, this, _1, _2),
.stack_size_bytes = 4096 * 2,
.stack_size_bytes = stack_size_bytes,
.priority = 20,
.core_id = 0, // pin it to a core for maximum speed
});
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/adc_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>ADC Types</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/adc_types.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/adc_types.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -163,7 +163,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/e2d5c8f/components/adc/include/adc_types.hpp">components/adc/include/adc_types.hpp</a></p></li>
<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>
</ul>
</section>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/ads1x15.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>ADS1x15 I2C ADC</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/ads1x15.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/ads1x15.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -164,7 +164,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/ads1x15/include/ads1x15.hpp">components/ads1x15/include/ads1x15.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/ads1x15/include/ads1x15.hpp">components/ads1x15/include/ads1x15.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/ads7138.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>ADS7138 I2C ADC</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/ads7138.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/ads7138.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/ads7138/include/ads7138.hpp">components/ads7138/include/ads7138.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/ads7138/include/ads7138.hpp">components/ads7138/include/ads7138.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/continuous_adc.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>Continuous ADC</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/continuous_adc.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/continuous_adc.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/adc/include/continuous_adc.hpp">components/adc/include/continuous_adc.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/adc/include/continuous_adc.hpp">components/adc/include/continuous_adc.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
2 changes: 1 addition & 1 deletion docs/adc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>ADC APIs</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/index.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/index.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/oneshot_adc.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>Oneshot ADC</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/oneshot_adc.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/oneshot_adc.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -168,7 +168,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/adc/include/oneshot_adc.hpp">components/adc/include/oneshot_adc.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/adc/include/oneshot_adc.hpp">components/adc/include/oneshot_adc.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
4 changes: 2 additions & 2 deletions docs/adc/tla2528.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<li><a href="index.html">ADC APIs</a> &raquo;</li>
<li>TLA2528 I2C ADC</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/adc/tla2528.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/adc/tla2528.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -169,7 +169,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/tla2528/include/tla2528.hpp">components/tla2528/include/tla2528.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/tla2528/include/tla2528.hpp">components/tla2528/include/tla2528.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
4 changes: 2 additions & 2 deletions docs/battery/bldc_driver.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>BLDC Driver</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/battery/bldc_driver.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/battery/bldc_driver.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -146,7 +146,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/bldc_driver/include/bldc_driver.hpp">components/bldc_driver/include/bldc_driver.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/bldc_driver/include/bldc_driver.hpp">components/bldc_driver/include/bldc_driver.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
8 changes: 4 additions & 4 deletions docs/battery/bldc_motor.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>BLDC Motor</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/battery/bldc_motor.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/battery/bldc_motor.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand Down Expand Up @@ -160,7 +160,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/bldc_motor/include/bldc_motor.hpp">components/bldc_motor/include/bldc_motor.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/bldc_motor/include/bldc_motor.hpp">components/bldc_motor/include/bldc_motor.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down Expand Up @@ -555,13 +555,13 @@ <h4>Example Usage<a class="headerlink" href="#classespp_1_1_bldc_motor_1bldc_mot
<section id="id1">
<h3>Header File<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/bldc_motor/include/bldc_types.hpp">components/bldc_motor/include/bldc_types.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/bldc_motor/include/bldc_types.hpp">components/bldc_motor/include/bldc_types.hpp</a></p></li>
</ul>
</section>
<section id="id2">
<h3>Header File<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/bldc_motor/include/sensor_direction.hpp">components/bldc_motor/include/sensor_direction.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/bldc_motor/include/sensor_direction.hpp">components/bldc_motor/include/sensor_direction.hpp</a></p></li>
</ul>
</section>
</section>
Expand Down
2 changes: 1 addition & 1 deletion docs/battery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>Battery APIs</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/battery/index.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/battery/index.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand Down
10 changes: 2 additions & 8 deletions docs/battery/max1704x.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<li><a href="index.html">Battery APIs</a> &raquo;</li>
<li>MAX1704X</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/battery/max1704x.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/battery/max1704x.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand Down Expand Up @@ -176,7 +176,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/max1704x/include/max1704x.hpp">components/max1704x/include/max1704x.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/max1704x/include/max1704x.hpp">components/max1704x/include/max1704x.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down Expand Up @@ -305,12 +305,6 @@ <h4>MAX1704X Example<a class="headerlink" href="#classespp_1_1_max1704x_1max1704
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N4espp8Max1704xD0Ev">
<span id="_CPPv3N4espp8Max1704xD0Ev"></span><span id="_CPPv2N4espp8Max1704xD0Ev"></span><span id="espp::Max1704x::~Max1704x"></span><span class="target" id="classespp_1_1_max1704x_1ab46c5ff3471e4e18950dffb67d89d026"></span><span class="sig-name descname"><span class="n"><span class="pre">~Max1704x</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N4espp8Max1704xD0Ev" title="Permalink to this definition"></a><br /></dt>
<dd><p>Delete the <a class="reference internal" href="#classespp_1_1_max1704x"><span class="std std-ref">Max1704x</span></a> object. </p>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N4espp8Max1704x9initalizeERNSt10error_codeE">
<span id="_CPPv3N4espp8Max1704x9initalizeERNSt10error_codeE"></span><span id="_CPPv2N4espp8Max1704x9initalizeERNSt10error_codeE"></span><span id="espp::Max1704x::initalize__std::error_codeR"></span><span class="target" id="classespp_1_1_max1704x_1a96e6bc852ad2681f634ca67ebb66fc92"></span><span class="k"><span class="pre">inline</span></span><span class="w"> </span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">initalize</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">error_code</span></span><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">ec</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N4espp8Max1704x9initalizeERNSt10error_codeE" title="Permalink to this definition"></a><br /></dt>
Expand Down
4 changes: 2 additions & 2 deletions docs/bldc/bldc_driver.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<li><a href="index.html">BLDC APIs</a> &raquo;</li>
<li>BLDC Driver</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/esp-cpp/espp/blob/0450934/docs/en/bldc/bldc_driver.rst" class="fa fa-github"> Edit on GitHub</a>
<a href="https://github.com/esp-cpp/espp/blob/289d326/docs/en/bldc/bldc_driver.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
Expand All @@ -160,7 +160,7 @@ <h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/0450934/components/bldc_driver/include/bldc_driver.hpp">components/bldc_driver/include/bldc_driver.hpp</a></p></li>
<li><p><a class="reference external" href="https://github.com/esp-cpp/espp/blob/289d326/components/bldc_driver/include/bldc_driver.hpp">components/bldc_driver/include/bldc_driver.hpp</a></p></li>
</ul>
</section>
<section id="classes">
Expand Down
Loading