begin cleanup on radio abstraction, details below:

* to allow changing to new mesh transport
* to allow a different chipset for the radio
* to allow testing on hardware with a SimRadio
* new "bare" build env for a devboard with virtually no hardware
* make buttons optional
This commit is contained in:
geeksville
2020-03-31 21:56:35 -07:00
parent 17de6f9532
commit da74803ffb
10 changed files with 206 additions and 48 deletions
+2 -7
View File
@@ -1,8 +1,6 @@
#pragma once
#include "MemoryPool.h"
#include "MeshTypes.h"
#include "PointerQueue.h"
#include "RadioInterface.h"
#include "mesh.pb.h"
#include <RHMesh.h>
#include <RH_RF95.h>
@@ -12,15 +10,12 @@
/**
* A version of the RF95 driver which is smart enough to manage packets via queues (no polling or blocking in user threads!)
*/
class CustomRF95 : public RH_RF95
class CustomRF95 : public RH_RF95, public RadioInterface
{
friend class MeshRadio; // for debugging we let that class touch pool
MemoryPool<MeshPacket> &pool;
PointerQueue<MeshPacket> &rxDest;
PointerQueue<MeshPacket> txQueue;
MeshPacket *sendingPacket; // The packet we are currently sending
public:
/** pool is the pool we will alloc our rx packets from
* rxDest is where we will send any rx packets, it becomes receivers responsibility to return packet to the pool