Is there a good book anyone can recommend and as good reference with examples for what I would call middling/advanced programming ?
Say covering items such as making libraries , classes, port manipulation , general use of timers .
I feel I’ve a need to advance on more and get inspiration on techniques I’ve previously not used ( hope that makes sense), rather than keep using the same old stuff I know and are comfortable .
I know a lot of this is in the internet , of variable quality , the Arduino reference is good and there are some apps about too , but I’m looking for a book !
while i wouldn't doubt that there may be an Arduino book covering all these topics, they seem somewhat separate issues.
libraries are typically compiled into .a files on most systems (e.g. Windows Linux) while on Arduino, libraries are left as .c/cpp files because the Arduino IDE supports many different processors and the libraries need to be recompiled for the specific processor
in C++ Programming Style, Cargill discusses poorly designed classes that appear right at first glance and how to design them better
not sure what you expect to read about Port manipulations. There may be cases where grouping I/O line on a single port can result in better performance, but will be processor specific
and Timers is also likely to be processor specific. However, Doug Comer's XINU book describes how to creat a chain of timers using the difference in time from the preceeding earlier timer requiring just one hardware timer
may be better to find a book describing several fairly complicated well written programs that uses these features to see how they are used. I learned a lot about programming by reading books on operating systems (i.e. Unix, Xinu, Minix) and compilers.
I think it would be a struggle to find such a book - I doubt that there would be much market for such a specific niche textbook. No doubt someone will prove me wrong
Classes you can find in any C++ book obviously. I really liked "C++ the core language" for this, but my copy at least is long out of date. Still worth a read though if classes are breaking your head.
Making libraries: I have never bothered - my Arduino projects have never been big enough to require them. That said, they're fairly simple in principle - a .h file and a .cpp file. You could make one that has a single function in it and upgrade to classes later. I'd skim through the Arduino libraries and some of the Adafruit stuff to see good examples.
Ports & timers - haven't used them much, but the existing documentation should tell you enough to figure it out. The code for them seems hard to read, so I'd only do it if I were forced to.
Additionally, I'd say that the source code is much easier to access because of Arduino's Open Source nature.
Yes!
I highly recommend C++ the core language with some caveats.
It will give you a great introduction to Object Oriented Programming, Class, and how they're implemented in C++. It also explains C++ References and touches on templates.
Caveats:
It's a very old book, pre-dating C++11. But it's great for the basics I mentioned above.
It's written for generic C++, not Arduino's flavor. So, all I/O is done through either <iostream> or <stdio.h>, instead of Arduino's Stream class. It also doesn't use Arduino's setup(), loop() paradigm.
It covers C++ exceptions which are generally not implemented on most Arduino platforms.
It's basically a book to bring you from 'C' to the basics of 'C++'. So, you better have good 'C' programming skills going in. You'll need to know things like pointer manipulation cold.
I don't have a recommendation for single source for moving beyond those fundamentals. I've picked up things like using the STL (Standard Template Library), Move Semantics, Smart Pointers, rvalues & lvalues, and other "Modern C++" concepts from various books, online sources, and forum posts.
Those topics are highly platform-dependent. I'd start with the processor's datasheet and poking around the Arduino Core source code for the platform you're interested in.
Back when C++ was all the news, I bought a book. "The Complete Reference" by Herbert Schildt. I was deep into using C on IBM PC and compatibles. After seeing all the complications of C++, I decided to stay with C. If you were closer, I could give you the book.
Update: Found another book: The Best C.C++ Tips Ever" by Anthony Porter. Same offer!