Template for a new Library show just structure, basic Cmake configuration and requested informations (in Edit mode of this file) of new library
- Create a new project according to MbedCE instructions
- Add this as submodule to your project via
git submodule add https://github.com/mbed-ce-libraries-examples/LibraryTemplate LibraryTemplate
- The top level
CMakeLists.txt
(in root of your project) should be modified according to this wiki page - Create your main.cpp file and copy & paste example code below.
- Build the project
#include "mbed.h"
#include "LibraryTemplate.h"
LibraryTemplate lb(LED1);
int main()
{
printf("MbedCE_LibraryTemplate\n");
while(1) {
lb.doSomething();
thread_sleep_for(500);
}
}
Some text about this library...
This library was tested with Nucleo-F446RE, VS-Code under Win11, GCC 12.3 and MbedCE library
- Any library should not contain
ThisThread::sleep_for()
because then is not possible to use the lib in the baremetal profile. So rather usethread_sleep_for()