<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Software</title><link>https://community.element14.com/products/devtools/software/</link><description> </description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/227429</link><pubDate>Thu, 13 Mar 2025 20:41:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:489a241e-a019-4525-8306-aa8f7b09c724</guid><dc:creator>Jan Cumps</dc:creator><description>Is this expensive? The callback manager class consumes 20 bytes The code that&amp;#39;s executed does not change. If you have to perform the logic, the code has to be there, regardless if you use the callback. There is a price of using std::function. Not flyweight but still light. A few calls between invoking the callback and executing the actual callback handler. Not impacting on an ARM controller, even the tiny ones. If you use a real time system and you worry about using this in a tight loop: the clock ticks to invoke the handler are deterministic and hard. Your profiler can check if your code can perform in the available timeslot. Using one of the smaller ATMELs? Performance impact is not relevant. There&amp;#39;s no C toolchain for those controllers that supports this design.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/227420</link><pubDate>Thu, 13 Mar 2025 17:39:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4ddc7d73-31eb-4926-9f7b-62b0a2a94993</guid><dc:creator>Jan Cumps</dc:creator><description>example: Raspberry Pico Blinky using this design #include #include #include &amp;quot;pico/stdlib.h&amp;quot; import callbackmanager; const uint32_t delay_ms = 250 ; callbackmanager ::Callback cb; int main () { gpio_init ( PICO_DEFAULT_LED_PIN ); gpio_set_dir ( PICO_DEFAULT_LED_PIN , GPIO_OUT ); cb . set ([]() { static bool state = false ; gpio_put ( PICO_DEFAULT_LED_PIN , state = ! state ); }); while ( true ) { cb (); sleep_ms ( delay_ms ); } } vscode project: community.element14.com/.../pico_5F00_callback_5F00_blink.zip</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/227339</link><pubDate>Fri, 07 Mar 2025 15:38:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:e939fd64-382c-4ba1-b1f0-78abca0e770e</guid><dc:creator>Jan Cumps</dc:creator><description>Just checked it on an Arduino MKR 1400, with some hardware manipulation. The callbacks do the job. Until your Arduino Board Manager ships with GCC 10 or later, comment this line in the callbackmanager class definition: // requires std :: is_void ::value || std ::is_arithmetic_v This isn&amp;#39;t supported in the (at the time of writing) version that ships with the MKR boards. The code isn&amp;#39;t needed to operate. It&amp;#39;s a compile time construct that gives a clear error when you try to set a callback handler that isn&amp;#39;t supported*. Without this line, you &amp;#39;ll get a compile error too, but it will throw that error at a location where it&amp;#39;s not very clear what&amp;#39;s wrong. So: result is the same: compiler throws an error as it should. But that extra line makes it easier to find what&amp;#39;s wrong and remediate. * the callback manager supports handlers that return a bool, any type of number, most objects that have a default creator and have &amp;quot;return-me capability, or void.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/223643</link><pubDate>Sun, 01 Sep 2024 17:46:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1a175058-3c9d-47be-81c1-c63c137d7722</guid><dc:creator>Jan Cumps</dc:creator><description>I used the mechanism in the GPS library that I designed for a ST Micro Teseo GPS IC . It&amp;#39;s used to call a device specific read, write and reset function, in a device independent library.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222643</link><pubDate>Mon, 22 Jul 2024 12:57:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:13b23538-e4fb-482e-9a23-c7cd11a09d75</guid><dc:creator>Jan Cumps</dc:creator><description>this library now also works for Arduino (tested with IDE2, and an Arduino MKT GSM 1400) For Arduino, you can download callbackmanager.h to your computer, then use Sketch -&amp;gt; Add File ... to get the callbackmanager included to your project. Add this line to your sketch: #include &amp;quot;callbackmanager.h&amp;quot; I added a sketch to test the callback manager as a GitHub GIST: test_arduino.ino I expect this will work on the newer ADO boards. The AVR compiler for Arduino UNO / Nano (both use avr-gcc) does not support this. But the Nano IoT (uses arm-gcc) does. A Zero and the MKR family work.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222598</link><pubDate>Fri, 19 Jul 2024 18:55:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8d7adcf5-6eb4-421f-81ad-410aa189432f</guid><dc:creator>Jan Cumps</dc:creator><description>latest version on github gist allows compilation with lower version GCC (including the Renesas and Arduino toolchains). There is no difference at runtime. You &amp;#39;ll only get a little more cryptic error if you use unsupported template types: an error when the compiler detects that the code can&amp;#39;t handle your type, instead of an error right at the declaration where you define what parameter types you want to use.</description></item><item><title>Forum Post: RE: GitHub: automate Raspberry Pico project build verification with GitHub Actions</title><link>https://community.element14.com/products/devtools/software/f/forum/54818/github-automate-raspberry-pico-project-build-verification-with-github-actions/222537</link><pubDate>Mon, 15 Jul 2024 11:57:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:3dd2505e-a144-4eeb-9414-ec0983467fc2</guid><dc:creator>Jan Cumps</dc:creator><description>cstanton , can you delete this forum post? It&amp;#39;s now GitHub: automate Raspberry Pico project build verification with GitHub Actions</description></item><item><title>Forum Post: GitHub: automate Raspberry Pico project build verification with GitHub Actions</title><link>https://community.element14.com/products/devtools/software/f/forum/54818/github-automate-raspberry-pico-project-build-verification-with-github-actions</link><pubDate>Mon, 15 Jul 2024 09:44:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:74c26e56-04b1-4b10-ace7-c8f788accf64</guid><dc:creator>Jan Cumps</dc:creator><description>Moved to GitHub: automate Raspberry Pico project build verification with GitHub Actions You can Make GitHub build your project. I&amp;#39;m using an Action to check out branches and build them, when a pull request is submitted. I adapted an existing flow from the Raspberry organisation. Here&amp;#39;s what it does check out the branch that&amp;#39;s the source for the pull request check out Pico-SDK, the current development branch install CMake install the arm bare metal GNU toolchain build the SDK build the project react on pull request creation on the main and develop branch. make successful compilation a mandatory check for the pull request. If the build fails, the pull request fails. That&amp;#39;s what I try to achieve in this exercise: developers can check in non-working in feature branches. once ready to ask merging with one of the two protected branches (develop or main), code should meet quality requirements and should build. That&amp;#39;s the moment that you deem your work done, and should be ready for a code review. If your code breaks the build at this point, you impact others - and maybe the production release. It&amp;#39;s a fail. Code reviewers don&amp;#39;t have to spend time validating non-funcioning code. The script I&amp;#39;m using is based on the Raspberrry MacOS build for Pico . I adapted it for Linux. Script source of build.yml: name: Build on ubuntu against pico-sdk develop on: workflow_dispatch: #push: # branches: # - &amp;#39;develop&amp;#39; # - &amp;#39;main&amp;#39; pull_request: types: [opened, reopened] branches: - &amp;#39;develop&amp;#39; - &amp;#39;main&amp;#39; jobs: build: runs-on: ubuntu-latest steps: - name: Clean workspace run: | echo &amp;quot;Cleaning up previous run&amp;quot; rm -rf &amp;quot;${{ github.workspace }}&amp;quot; mkdir -p &amp;quot;${{ github.workspace }}&amp;quot; - name: Checkout pico_gps_teseo_i2c uses: actions/checkout@v4 with: path: pico_gps_teseo_i2c - name: Checkout pico-sdk/develop uses: actions/checkout@v4 with: repository: raspberrypi/pico-sdk ref: develop path: pico-sdk - name: Checkout pico-sdk submodules working-directory: ${{github.workspace}}/pico-sdk run: git submodule update --init - name: Install dependencies run: | sudo apt-get install cmake #curl -Lo gcc-arm-none-eabi.tar.bz2 &amp;quot;https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2?rev=78196d3461ba4c9089a67b5f33edf82a&amp;amp;hash=5631ACEF1F8F237389F14B41566964EC&amp;quot; #sudo mkdir /opt/gcc-arm-none-eabi #sudo tar xf gcc-arm-none-eabi.tar.bz2 --strip-components=1 -C /opt/gcc-arm-none-eabi #echo &amp;#39;export PATH=$PATH:/opt/gcc-arm-none-eabi/bin&amp;#39; | sudo tee -a /etc/profile.d/gcc-arm-none-eabi.sh #export PATH=$PATH:/opt/gcc-arm-none-eabi/bin #export PICO_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi/bin #source /etc/profile #arm-none-eabi-gcc --version sudo apt install gcc-arm-none-eabi - name: Build Project Excuses for the formatting. The code editor does not want to accept this code. Click on this link for a better view . When you create this script in the .github/workflows folder, it &amp;#39;ll kick off each time a pull rrequest is opened for main or develop. But it will not impact the pull request. If you want to make pull requests dependent on successful build, you &amp;#39;ll also hav to create a ruleset for the branch. On your repository&amp;#39;s web page on GitHub, select settings -&amp;gt; Rules -&amp;gt; Rulesets. If the branch(es) you want to protect don&amp;#39;t have a ruleset yet, create one. Else you can update the existing one. The first checkbox will take care that the branches you want to protect, can only accept commits via a pull request. When you work together as a team, it&amp;#39;s good that branch owners can check code before it&amp;#39;s merged in the code base. The second check also adds the condition, that the build job must complete in good order. A developer that submits a pull request, gets this page: They don&amp;#39;t have to wait for this to complete. They &amp;#39;d get an email if it failed. Once the job is completed, the reviewer sees the screen capture I posted at the start of this blog. If the job was successful, code review and merge can happen. How does it fit in my workflow: I created another action earlier: GitHub: automate project documentation with DoxyGen, and publish online after pushing commits . Together, the 2 automate a decent part of code management: the build validation described here, when a pull request is made to development or main when a pull request to main is accepted and merged by the branch manager (me :) ), the doucmentation is regenerated and published to github.io. Future improvements: I&amp;#39;m considering to let the job create a project release, when a new Version TAG is created in the repository. I&amp;#39;d have to make these changes: add trigger on TAG creation event. Filter on tags that start with &amp;#39;v&amp;#39;. change the build type from Debug to Release use a GitHub Action to create a release in the repository, and upload the .uf2 file as asset to that release. Link to all posts .</description><category domain="https://community.element14.com/products/devtools/software/tags/doxygen">doxygen</category><category domain="https://community.element14.com/products/devtools/software/tags/yaml">yaml</category><category domain="https://community.element14.com/products/devtools/software/tags/github-io">github.io</category><category domain="https://community.element14.com/products/devtools/software/tags/github">github</category><category domain="https://community.element14.com/products/devtools/software/tags/teseo_5F00_c_2B002B00_">teseo_c++</category></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222225</link><pubDate>Thu, 27 Jun 2024 15:57:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f5ec40f8-9567-4ccb-9b94-d1cf88e5c16b</guid><dc:creator>Jan Cumps</dc:creator><description>comment out this requires line in the template definition. requires std::is_void ::value || std::is_arithmetic_v It&amp;#39;s code that doesn&amp;#39;t execute anything but helps the developer to use supported attributes. The current GNU toolchain for Renesas is 1 version too low for this. If you don&amp;#39;t have this line, and use a non-supported return type for the callback, you &amp;#39;ll get a compile error anyway. But it &amp;#39;ll be a more cryptic one, at the first line where the code tries to do an operation that your type doesn&amp;#39;t support. In my template, that will be at the return 0; line. That&amp;#39;s the only line that doesn&amp;#39;t work for any type of return value.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222213</link><pubDate>Thu, 27 Jun 2024 15:21:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a02c18a9-434e-4c46-80f8-3f784e24fc2c</guid><dc:creator>flyingbean</dc:creator><description>I just got a new board from Renesas. Will try e2 studio after my vacation this Summer.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222095</link><pubDate>Fri, 21 Jun 2024 19:22:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:03079649-33b1-4772-8eef-a1f75426c57e</guid><dc:creator>Jan Cumps</dc:creator><description>Most of this design only has compile time cost. The only thing that has some runtime cost is the std::function invocation. This part of code: (*_callback)(args...); There are four function calls in between this call and the actual execution of the callback function registered. Not a lot of code is executed, but four calls nonetheless. I&amp;#39;d consider C++ abstractions cheap. But if 4 calls are too much for the design you are working on, this is not your solution. We&amp;#39;re not talking a lot of clock ticks though - this is all lean. The cheapest way will most likely be to write callback functionality in assembler or using C style (both without type safety and object awareness). On a controller like the Pico, I think that the cost is ignorable in the majority of firmware designs.</description></item><item><title>Forum Post: C++ and templates: callbacks that return a value, or a void</title><link>https://community.element14.com/products/devtools/software/f/forum/54742/c-and-templates-callbacks-that-return-a-value-or-a-void</link><pubDate>Fri, 21 Jun 2024 16:38:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4e1bda44-73fd-4193-bb9b-e6c83c5309f4</guid><dc:creator>Jan Cumps</dc:creator><description>In C(++), a function can return a value. Or a void. A function with a return value ends with return X ; . A function that returns void , has a last line return; . Without value. (and you don&amp;#39;t have to write that return; , but that doesn&amp;#39;t matter in this discussion) When using templates, this needs consideration, if you allow the return type to be &amp;quot;templated&amp;quot; and you want to support void as one of the options for a return value of a member. A void function (named a procedure in a lot of programming languages) is different than a function that returns something. Internally and conceptually. internally : the return value is a position on the stack. void functions don&amp;#39;t have that position. conceptually : ignoring the internally difference, and returning something in a void() function anyways, breaks the C(++) language. Also not returning a value (of the correct type) in a function that does require a return value, fails to compile. I wrote a templated class that can call a callback . And I wanted it to support returning numbers / bools. The thing is: when no callback function is set, the class had to work too. It has to return a value in that case .So I wrote this code: inline R call(Args... args) { if (_callback == nullptr) { return 0; // R can only be a arithmetic type. 0 should work as default. } return (*_callback)(args...); } This works great for boolean, integer, float return values. But it you want to support callbacks that don&amp;#39;t have a return value, it will fail. If R is type void, the compilation will not allow r eturn 0; . And if R is a number, compilation will not allow return; . solution: constant expressions In C++ , we can write constant expressions. A condition that&amp;#39;s checked at compile time. If it&amp;#39;s true, the containing block will be compiled. If it&amp;#39;s false, not. A bit related to the C style #ifdef , but context aware. A constant expression knows the code it&amp;#39;s acting upon (including parameter types). These constant expressions understand C++ source code. What they have in common with defines: they both are static: they resolve everything during compilation. They have no runtime cost. I use this construct to have different behaviour if the return type of my callback function is void, and when it&amp;#39;s an arithmetic (number) type: /* * R can either be an arithmetic type, or void */ inline R call(Args... args) { if constexpr (std::is_void ::value) { if (_callback == nullptr) { return; } (*_callback)(args...); } if constexpr (! std::is_void ::value) { if (_callback == nullptr) { return 0; // R can only be a arithmetic type. 0 should work as default. } return (*_callback)(args...); } } You can see that when my templated code is configured for a callback function that returns a bool or a number, it &amp;#39;ll use the lower part, and always return a value. When the template is configured for a void() type of callback (a procedure), it just returns, without a return value. This compiles, runs, is type safe and has no runtime impact. if constexpr gets resolved when you build the code. If your code doesn&amp;#39;t have void() callbacks, the top part doesn&amp;#39;t get compiled. If it doesn&amp;#39;t have callbacks that expect a return value, the bottom part doesn&amp;#39;t get compiled. Check my set of test cases below, to see how this works: #include #include &amp;quot;callbackmanager.h&amp;quot; #include class MyClass { public: inline int handler(const int&amp;amp; num1, const int&amp;amp; num2) const { return num1 + num2; } static inline int staticHandler(const int&amp;amp; num1, const int&amp;amp; num2) { return num1 + num2; } }; int functionHandler(const int&amp;amp; num1, const int&amp;amp; num2) { return num1 + num2; } int main() { int a = 4; int b = 5; { // scenario: call object method MyClass myClass; Callback cb; // Use a lambda to capture myClass and call the object method cb.set([&amp;amp;myClass](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; int { return myClass.handler(num1, num2); }); int o = cb.call(a, b); printf(&amp;quot;Value: %i\n&amp;quot;, o); fflush(stdout); } { // scenario: call static method Callback cb; // Use a lambda to call the static method cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; int { return MyClass::staticHandler(num1, num2); }); int o = cb.call(a, b); printf(&amp;quot;Value: %i\n&amp;quot;, o); fflush(stdout); } { // scenario: call C function Callback cb; // Use a lambda to call the classic C function cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; int { return functionHandler(num1, num2); }); int o = cb.call(a, b); printf(&amp;quot;Value: %i\n&amp;quot;, o); fflush(stdout); } { // scenario: call pure lambda Callback cb; // Use a lambda to execute anonymous C code cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; int { return num1 + num2; }); int o = cb.call(a, b); printf(&amp;quot;Value: %i\n&amp;quot;, o); fflush(stdout); } { // scenario: return a bool Callback cb; // Use a lambda to execute anonymous C code cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; bool { return num1 == num2; }); printf(&amp;quot;Value: %s\n&amp;quot;, cb.call(a, b) ? &amp;quot;true&amp;quot; : &amp;quot;false&amp;quot;); fflush(stdout); } { // scenario: use a callback that returns void Callback cb; // Use a lambda to execute anonymous C code cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) { printf(&amp;quot;void gets num1: %i, num2: %i\n&amp;quot;, num1, num2); fflush(stdout); return; }); cb.call(a, b); } { // scenario: use a callback that returns void, and has no attributes Callback cb; // Use a lambda to execute anonymous C code cb.set([]() { printf(&amp;quot;void with no parameters\n&amp;quot;); fflush(stdout); return; }); cb.call(); } /* { // scenario: use an unsupported (non-fundamental) type for return value R // this will generate a compile error Callback cb; } */ } a constexpr knows &amp;quot;everything&amp;quot; about your code. When you use it in a template class, it will know for what types your project will use that template class. Then it &amp;#39;ll take care that it &amp;#39;ll only send that part of the code to the compiler, that is needed for your project. For classes like the one that I&amp;#39;m writing, this is great. My class has no clue how it &amp;#39;ll be used. But I provide logic for a set of scenarios that I want to support. C++ constructs like constexpr will take care that this flexibility has no cost when executing the code. All code gets checked at compilation, and needs to pass the strict C++ type checks. But at no cost for the final firmware.</description><category domain="https://community.element14.com/products/devtools/software/tags/template">template</category><category domain="https://community.element14.com/products/devtools/software/tags/OO">OO</category><category domain="https://community.element14.com/products/devtools/software/tags/c_2B002B00_">c++</category><category domain="https://community.element14.com/products/devtools/software/tags/callback">callback</category></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222086</link><pubDate>Fri, 21 Jun 2024 08:19:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f41bda2f-0f0f-4a6d-968b-369a02db3c93</guid><dc:creator>Jan Cumps</dc:creator><description>I added the option to use a callback that doesn&amp;#39;t return anything , e.g.: void handler(...) First, I allowed the template constraint to accept both arithmetic and void return values. template // restrict to arithmetic data types for return value, or void requires std::is_void ::value || std::is_arithmetic_v class Callback { And altered the call() function in the template, to not return a value if the return type is void: /* * R can either be an arithmetic type, or void */ inline R call(Args... args) { if constexpr (std::is_void ::value) { if (_callback == nullptr) { return; } (*_callback)(args...); } if constexpr (! std::is_void ::value) { if (_callback == nullptr) { return 0; // R can only be a arithmetic type. 0 should work as default. } return (*_callback)(args...); } } Here&amp;#39;s an example that uses a bool handler, // scenario: return a bool Callback cb; // Use a lambda to execute anonymous C code cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) -&amp;gt; bool { return num1 == num2; }); printf(&amp;quot;Value: %s\n&amp;quot;, cb.call(a, b) ? &amp;quot;true&amp;quot; : &amp;quot;false&amp;quot;); fflush(stdout); } and a void handler: // scenario: use void Callback cb; // Use a lambda to execute anonymous C code cb.set([](const int&amp;amp; num1, const int&amp;amp; num2) { return; }); cb.call(a, b); There are more lines of code in the template class definition. But all of that is compile time resolved. No executable code is added.</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222062</link><pubDate>Wed, 19 Jun 2024 19:38:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:cb32b162-079e-445e-aa2e-db226399e85a</guid><dc:creator>Jan Cumps</dc:creator><description>I&amp;#39;ve been testing it with toolchains. Works with: NXP MCUXpresso Pico C/C++ SDK 1.5 Renesas e2 studio with gcc toolchain (everything, except the optional clause requires std::is_arithmetic ::value ) Eclipse with the arm linux cross-compiler (for Raspberry Pi, BB, ...) Does not work with: Arduino IDE 2.0 avr-gcc: compiler version 7.3 is too low Arduino IDE 2.0 arm-gcc: compiler version 7.2 is too low</description></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222061</link><pubDate>Wed, 19 Jun 2024 18:14:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7c34c687-05d7-45fa-b7c5-be506f7cdcc0</guid><dc:creator>Jan Cumps</dc:creator><description>shabaz I found where you can set it for Arduino IDE 2.X on windows: C:\Users\ jancu \AppData\Local\Arduino15\packages\arduino\hardware\ avr\1.8.4 \platform.txt You need to replace jancu with your windows user name, and controller family with the board you are working for. And std=gnu++11 with std=c++20 compiler. cpp .flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto edit: I don&amp;#39;t think that this is useful for code that you want to share with others. edit edit: the setting gets overwritten when updating the IDE edit edit edit: and avr-gcc 7.x does not support c++20</description></item><item><title>Forum Post: RE: C++ callbacks and templates</title><link>https://community.element14.com/products/devtools/software/f/forum/54719/c-callbacks-and-templates/222055</link><pubDate>Wed, 19 Jun 2024 14:45:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:720c6b30-61b4-4ca6-8857-a3cfbb23c918</guid><dc:creator>flyingbean</dc:creator><description>Great tip. I could use the template in my projects here.</description></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222034</link><pubDate>Tue, 18 Jun 2024 19:09:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:d620466e-b741-489d-913f-006ea6151215</guid><dc:creator>Jan Cumps</dc:creator><description>no, the option is not there</description></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222030</link><pubDate>Tue, 18 Jun 2024 19:03:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f6e5827b-3878-45de-9ab9-561ea3296057</guid><dc:creator>shabaz</dc:creator><description>Ahh thanks for the tip! Simpler to remember than the compile-line option I was using for Pico SDK.</description></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222029</link><pubDate>Tue, 18 Jun 2024 18:58:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8352efa7-1ba4-4ce0-a51b-bb11b3962a45</guid><dc:creator>Jan Cumps</dc:creator><description>when you press ctl+shift+p in Arduino IDE2, you get a command pallet. There you can set preferences user/workspace (with a form or directly in settings.json) If the dialect can be set, I&amp;#39;d suspect it&amp;#39;s there ...</description></item><item><title>Forum Post: RE: C++ and templates: restrict what types can be used in a template</title><link>https://community.element14.com/products/devtools/software/f/forum/54725/c-and-templates-restrict-what-types-can-be-used-in-a-template/222023</link><pubDate>Tue, 18 Jun 2024 15:51:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:ed53081e-9871-419b-bc43-99ced99bebf6</guid><dc:creator>Jan Cumps</dc:creator><description>for pico C sdk: for eclipse: No idea how to set in Arduino IDE V2. V1 had a platform file, that you could edit.</description></item></channel></rss>