This is a work in progress for an NRF2401P

Dependencies:   mbed

Fork of NRF2401P by Malcolm McCulloch

Committer:
epgmdm
Date:
Thu Jun 11 17:00:18 2015 +0000
Revision:
1:ff53b1ac3bad
Parent:
0:8fd0531ae0be
Child:
2:ca0a3c0bba70
Added a few extras

Who changed what in which revision?

UserRevisionLine numberNew contents of line
epgmdm 0:8fd0531ae0be 1 /**
epgmdm 0:8fd0531ae0be 2 *@section DESCRIPTION
epgmdm 0:8fd0531ae0be 3 * mbed NRF2401+ Library
epgmdm 0:8fd0531ae0be 4 *@section LICENSE
epgmdm 0:8fd0531ae0be 5 * Copyright (c) 2015, Malcolm McCulloch
epgmdm 0:8fd0531ae0be 6 *
epgmdm 0:8fd0531ae0be 7 * Permission is hereby granted, free of charge, to any person obtaining a copy
epgmdm 0:8fd0531ae0be 8 * of this software and associated documentation files (the "Software"), to deal
epgmdm 0:8fd0531ae0be 9 * in the Software without restriction, including without limitation the rights
epgmdm 0:8fd0531ae0be 10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
epgmdm 0:8fd0531ae0be 11 * copies of the Software, and to permit persons to whom the Software is
epgmdm 0:8fd0531ae0be 12 * furnished to do so, subject to the following conditions:
epgmdm 0:8fd0531ae0be 13 *
epgmdm 0:8fd0531ae0be 14 * The above copyright notice and this permission notice shall be included in
epgmdm 0:8fd0531ae0be 15 * all copies or substantial portions of the Software.
epgmdm 0:8fd0531ae0be 16 *
epgmdm 0:8fd0531ae0be 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
epgmdm 0:8fd0531ae0be 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
epgmdm 0:8fd0531ae0be 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
epgmdm 0:8fd0531ae0be 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
epgmdm 0:8fd0531ae0be 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
epgmdm 0:8fd0531ae0be 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
epgmdm 0:8fd0531ae0be 23 * THE SOFTWARE.
epgmdm 0:8fd0531ae0be 24 * @file "NRF2401P.h"
epgmdm 0:8fd0531ae0be 25 */
epgmdm 0:8fd0531ae0be 26 class NRF2401P
epgmdm 0:8fd0531ae0be 27 {
epgmdm 0:8fd0531ae0be 28 public:
epgmdm 0:8fd0531ae0be 29 SPI *spi;
epgmdm 0:8fd0531ae0be 30 DigitalOut csn,ce;
epgmdm 0:8fd0531ae0be 31 char addressWidth;
epgmdm 0:8fd0531ae0be 32 char logMsg[80];
epgmdm 0:8fd0531ae0be 33 char status;
epgmdm 0:8fd0531ae0be 34 char statusS[32];
epgmdm 0:8fd0531ae0be 35 bool dynamic,debug;
epgmdm 0:8fd0531ae0be 36 Serial *pc;
epgmdm 0:8fd0531ae0be 37
epgmdm 0:8fd0531ae0be 38 NRF2401P (PinName mosi, PinName miso, PinName sclk, PinName _csn, PinName _ce);
epgmdm 0:8fd0531ae0be 39
epgmdm 0:8fd0531ae0be 40 char acknowledgeData( char *data, char width, char pipe);
epgmdm 1:ff53b1ac3bad 41 char checkStatus();
epgmdm 0:8fd0531ae0be 42 bool clearStatus();
epgmdm 0:8fd0531ae0be 43 bool flushRx();
epgmdm 0:8fd0531ae0be 44 bool flushTx();
epgmdm 0:8fd0531ae0be 45 char getRxData(char * buffer);
epgmdm 0:8fd0531ae0be 46 char getRxWidth();
epgmdm 1:ff53b1ac3bad 47 bool isAckData();
epgmdm 0:8fd0531ae0be 48 bool isRxData();
epgmdm 0:8fd0531ae0be 49 void log (char *msg);
epgmdm 0:8fd0531ae0be 50 void quickRxSetup(int channel,long long addr);
epgmdm 0:8fd0531ae0be 51 void quickTxSetup(int channel,long long addr);
epgmdm 0:8fd0531ae0be 52 char readReg(char address, char *data);
epgmdm 0:8fd0531ae0be 53 char testReceive();
epgmdm 0:8fd0531ae0be 54 char testTransmit();
epgmdm 0:8fd0531ae0be 55 char transmitData( char *data, char width );
epgmdm 0:8fd0531ae0be 56
epgmdm 0:8fd0531ae0be 57 bool setAddressWidth(char width);
epgmdm 0:8fd0531ae0be 58 char setChannel(char chan);
epgmdm 0:8fd0531ae0be 59 char setDynamicPayload();
epgmdm 0:8fd0531ae0be 60 bool setPwrUp();
epgmdm 0:8fd0531ae0be 61 char setRadio(char speed,char power);
epgmdm 0:8fd0531ae0be 62 char setRxAddress(char *address, char pipe);
epgmdm 0:8fd0531ae0be 63 char setRxAddress(long long address, char pipe);
epgmdm 0:8fd0531ae0be 64 bool setRxMode();
epgmdm 0:8fd0531ae0be 65 char setTxAddress(char *address);
epgmdm 0:8fd0531ae0be 66 char setTxAddress(long long address);
epgmdm 0:8fd0531ae0be 67 bool setTxMode();
epgmdm 0:8fd0531ae0be 68 char * statusString();
epgmdm 0:8fd0531ae0be 69 char writeReg(char address, char *data, char width);
epgmdm 0:8fd0531ae0be 70 char writeReg(char address, char data);
epgmdm 0:8fd0531ae0be 71
epgmdm 0:8fd0531ae0be 72 void scratch();
epgmdm 0:8fd0531ae0be 73
epgmdm 0:8fd0531ae0be 74
epgmdm 0:8fd0531ae0be 75 };