I'm writing a hardware driver for the raspberry pi 2 with C++.
The driver uses the SPI bus to talk to a radio chip. I made a class Radio and put all those functions that talks to the chip into that class. Some of those functions are writeToRegister
, readFromRegister
, setRadioPower
, enterSleepMode
readTxBuffer
, readRxBuffer
to name a few...
The issue here is that this class will be going to have only one object like Radio radio
. There will be no need to be created more than one objects cause it's a class which contains functions that talks to the hardware and there's only one piece of hardware.
The question here is: What is the best way to deal with classes like that?
I don't want to do it with C, I want to learn more stuff about C++.