-
Notifications
You must be signed in to change notification settings - Fork 1
/
nRF24interface.h
49 lines (45 loc) · 1.57 KB
/
nRF24interface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef NRF24INTERFACE_H
#define NRF24INTERFACE_H
#include <stdlib.h>
#include "nRF24registers.h"
#include <queue>
#include "msgframe.h"
class nRF24interface : public nRF24registers
{
Q_OBJECT
public:
/** Default constructor */
nRF24interface(QObject * parent = 0);
/** Default destructor */
~nRF24interface();
byte Spi_Write(byte * msg, int msgLen, byte * msgBack);
//move to protected
bool receve_frame(tMsgFrame * theFrame, byte pipe);
protected:
//inteface functions
tMsgFrame * read_RX_payload();
tMsgFrame * getTXpacket();
void write_TX_payload(byte * bytes_to_write, int len);
void write_ack_payload(byte * bytes_to_write, int len);
void write_no_ack_payload(byte * bytes_to_write, int len);
tMsgFrame * get_ack_packet_for_pipe(uint8_t pipe);
void flush_tx();
void flush_rx();
void reuse_last_transmited_payload();
byte * reuse_tx_payload();
uint8_t read_RX_payload_width();
byte * nop();
commands get_command(byte command);
tMsgFrame * getACKmsgForPipe(byte pipe);
bool sREUSE_TX_PL;
tMsgFrame * lastTransmited;
private:
//interface registers
void newFrame(uint64_t Address, uint8_t PayLength, uint8_t thePID, uint8_t theNP_ACK,uint8_t * Payload);
std::queue<tMsgFrame*> RX_FIFO;
std::queue<tMsgFrame*> TX_FIFO;
uint8_t PID;
signals:
void TXpacketAdded(void);
};
#endif // NRF24INTERFACE_H