Most
of the time we have to chance to play around with a GPS module and
somehow log its data, but no easy and quick way to visualize it. For me
the solution was to create a simple C++ class that generates a
GoogleEarth compatible KML file. This can be easily imported so that I
can visualize the path my robot has taken.
Showing posts with label Cpp. Show all posts
Showing posts with label Cpp. Show all posts
C++ debugging macro
Debugging is a must when coding, regardless of how big or complex a project is. And althought there are tons of debugging tools out there, most are overpowered for my needs or simply introduce unnecessary code even when in the release version.
Lightweight C++ logging class for Linux

Logging is not only a powerful debugging and maintenance tool, but also a basic security element. In this case I wanted to save telemetry data of a multirotor without sending it to my laptop. Thus I wrote a simple logger that stores everything on the on-board uSD card. Although it's not perfect, it has proven to work as expected and be quite lightweight.
PIC24FJ tiny remappable pin library
The PIC24FJ microcontroller family feature lots of modules to perform many common operations with hardware. The problem with is is the microcontroller needs a big enough pinout for all of them.
Because this is not possible, the PIC23FJ feature remappable pins (RP) which can be assigned to different modules. How to use this function is no secret, and perfectly explained in the user reference manual. Yet I wanted to share the tiny library I have put together to handle them. The library does only cover a few modules, but can easily be modified to cover them all.
I²C Master driver for PIC24FJ + FreeRTOS
I have written an I²C driver for my PIC24FJ32GB002 which is running with FreeRTOS. It has an easy to use API and can be easily adapted to suit any other microcontroller. Also, thanks to the RTOS, many independent threads can be queued to access the I²C bus.
Another great feature is that when a thread is performing an I²C communication, which is really slow, it blocks letting another thread use the CPU. Yet this feature is currently disabled in my driver because at 400 kHz I²C speed it took the PIC24FJ32GB002 more time to dispatch a thread than to wait for the communications to end. Thus it is only useful for 100 kHz communications or for faster microcontrollers.
For simplicities sake, the driver does only detect and report comunication errors, but does no handle them. It is up to the user to do this.
I have been using this code for a while, and I am fairly pleased whith it. Yet there could still remain some hidden bugs or optimization possibilities. Any feedback is highly welcome.
Subscribe to:
Posts
(
Atom
)



