I say, a persons job is the job she/he has been doing for last 6 mounts..
For last 12 mounts, I've been using:
- C++ for %90, for any embedded project (I don't know if it is 90, but I feel like it..
- Assembly for critical sections
- Assembly for checking how C++ compiler is performing. (So far so good)
- Python for quick fixes
- .net (mono) for PC related, including Linux and OSX..
About C++, actually it is C compiler with additions of namespaces, templates, classes etc.. And for me, it is a lot more powerful than C.. The code written by it is much more reusable.. For me reuse is the much much more important than the performance and resource usage..
I always write nearly any part of project with C++, apart from reusability, it is syntactically better than c.. For instance:
core.init is better than initCore..
i2c1.start() is better than i2cStart, or startI2C..
uart.open() is better than openUart..
etc..
Actually you are writing in C++ if you are doing:
openUart(UART0);
you are passing a parameter that defines which resource to work on to driver software.. In C++ it is passed as
this and C++ is better than you in doing that.. except from virtual methods, only addition is
this.. if you are calling a static method, the generated code is same as C generates..
for instance, core.init compiles same to initCore..
I use overloading and inline methods frequently, which enables cleaner code..
Inheritance is really powerful, and also helpful.. For instance my SPI system is based on Spi and SpiNode class that are abstract.. Some MCU's have USART that may work as SPI and also dedicated SPI ports, or SSP.. All are diffent in hardware basis.. I subclassed Spi class for USART driven, SPI driven and SSP driven separately. However, an SpiNode doesn't need to know if it's Spi is based on USART, SPI, or SSP or even software based.. It just calls port->shift(..), port->shiftAsync methods.. That's it..
You can do this:
// using usart0 as spi
usart0Spi.open();
MCP4921 dac;
dac.setPort(usart0Spi);
dac.setValue(1234);
// using spi0
spi0.open();
MCP4921 dac;
dac.setPort(spi0);
dac.setValue(1234);
As you can see all the code looks same.. usart0Spi and spi0 are already defined in library. if you use one variable, for instance usart0Spi, all related methods are automatically included by linker.. And your USART is in SPI mode when usart0Spi.open() is run.. isn't it nice?
one time, I used ADXL345 in SPI mode sharing same SPI with other sensor.. How on earth a hardware designer makes this mistake I don't understand. It enters into I2C mode when an SPI transfer occur with other chip.. I didn't have spare hardware based SPI port, and I was using ADXL as oscillation detection so it must be read fast.. I just wrote SoftwareSpi, moved the other chip to GPIO pins and both chips started working..
Isn't it worth?