Do you use C++ for device drivers in embedded systems?

Status
Not open for further replies.
Joined
Mar 14, 2022
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
56
Do you use C++ for low level device drivers like accessing registers of peripherals like UART, I2C, GPIO, 1-WIRE, hardware timers etc... ?

Also, just to clarify, by embedded system I mean Cortex-M0, M3/4 devices etc... not Cortex-A or any equivalent that can run embedded linux.
 

Hello!
I do!
When properly done, there is no speed penalty. Basically configuring a peripheral is just about writing configs.
For instance if you configure a SPI port, you will write register specifying its speed, polarity, phase, etc. So first
for the configuration, writing it in assembler, C or C++ doesn't change anything.
Next, as for exchanging data, everything is made by the hardware, therefore there is no speed issue either.
I usually setup the hardware to use DMA, so I get a callback function called when a buffer is ready.
But I suppose you will have as many different opinions as there are users on this site.

Dora.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…