Library for handling subset of coap functionality by radio transmitter.

Dependencies:   nRF24L01P cantcoap

Dependents:   server2

Committer:
thewiztory
Date:
Fri Jan 25 02:10:16 2019 +0000
Revision:
5:b8d21be6b36c
Parent:
4:9f635ab44d8e
-

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ka_myk 0:6a6f97ca5572 1 #pragma once
Ka_myk 0:6a6f97ca5572 2
Ka_myk 0:6a6f97ca5572 3 #include "nRF24L01P.h"
Ka_myk 0:6a6f97ca5572 4
Ka_myk 0:6a6f97ca5572 5 //***************************************************************************//
Ka_myk 0:6a6f97ca5572 6 // !!! SETTINGS !!!
Ka_myk 0:6a6f97ca5572 7 #define DATA_RATE NRF24L01P_DATARATE_1_MBPS
Ka_myk 0:6a6f97ca5572 8
Ka_myk 0:6a6f97ca5572 9 #define POWER NRF24L01P_TX_PWR_ZERO_DB
Ka_myk 0:6a6f97ca5572 10
Ka_myk 0:6a6f97ca5572 11 //***************************************************************************//
Ka_myk 0:6a6f97ca5572 12
Ka_myk 0:6a6f97ca5572 13 class RadioWrapper {
Ka_myk 0:6a6f97ca5572 14 private:
Ka_myk 2:c3ca8b8526e0 15 nRF24L01P radio; // mosi, miso, sck, csn, ce, irq
Ka_myk 0:6a6f97ca5572 16
Ka_myk 0:6a6f97ca5572 17 public:
Ka_myk 4:9f635ab44d8e 18 RadioWrapper(int channel, unsigned long long tx_address, unsigned long long rx_addresses[]);
Ka_myk 0:6a6f97ca5572 19
Ka_myk 0:6a6f97ca5572 20 int packetSize() {
Ka_myk 0:6a6f97ca5572 21 return 32;
Ka_myk 0:6a6f97ca5572 22 }
Ka_myk 0:6a6f97ca5572 23
Ka_myk 4:9f635ab44d8e 24 /*a
Ka_myk 0:6a6f97ca5572 25 read bytes and saves them to given buffer turncating it.
Ka_myk 0:6a6f97ca5572 26 @len
Ka_myk 0:6a6f97ca5572 27 @return number of read bytes, -1 if error
Ka_myk 0:6a6f97ca5572 28 */
Ka_myk 4:9f635ab44d8e 29 int read(uint8_t* buffer, int len, int timeout, int* pipe);
Ka_myk 0:6a6f97ca5572 30 /*
Ka_myk 0:6a6f97ca5572 31 send bytes from given buffor
Ka_myk 0:6a6f97ca5572 32 @return number of writeen bytes, -1 if error.
Ka_myk 0:6a6f97ca5572 33 */
Ka_myk 4:9f635ab44d8e 34 int write(uint8_t* buffer, uint8_t len, int pipe);
Ka_myk 4:9f635ab44d8e 35
Ka_myk 4:9f635ab44d8e 36 private:
Ka_myk 4:9f635ab44d8e 37 int readFromPipe(uint8_t* buffer, int len, int pipe);
Ka_myk 1:1d936c763440 38 };