Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of NRF2401P by
Diff: NRF2401P.h
- Revision:
- 0:8fd0531ae0be
- Child:
- 1:ff53b1ac3bad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/NRF2401P.h Thu Jun 11 11:19:57 2015 +0000
@@ -0,0 +1,73 @@
+/**
+ *@section DESCRIPTION
+ * mbed NRF2401+ Library
+ *@section LICENSE
+ * Copyright (c) 2015, Malcolm McCulloch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * @file "NRF2401P.h"
+ */
+class NRF2401P
+{
+public:
+ SPI *spi;
+ DigitalOut csn,ce;
+ char addressWidth;
+ char logMsg[80];
+ char status;
+ char statusS[32];
+ bool dynamic,debug;
+ Serial *pc;
+
+ NRF2401P (PinName mosi, PinName miso, PinName sclk, PinName _csn, PinName _ce);
+
+ char acknowledgeData( char *data, char width, char pipe);
+ bool clearStatus();
+ bool flushRx();
+ bool flushTx();
+ char getRxData(char * buffer);
+ char getRxWidth();
+ bool isRxData();
+ void log (char *msg);
+ void quickRxSetup(int channel,long long addr);
+ void quickTxSetup(int channel,long long addr);
+ char readReg(char address, char *data);
+ char testReceive();
+ char testTransmit();
+ char transmitData( char *data, char width );
+
+ bool setAddressWidth(char width);
+ char setChannel(char chan);
+ char setDynamicPayload();
+ bool setPwrUp();
+ char setRadio(char speed,char power);
+ char setRxAddress(char *address, char pipe);
+ char setRxAddress(long long address, char pipe);
+ bool setRxMode();
+ char setTxAddress(char *address);
+ char setTxAddress(long long address);
+ bool setTxMode();
+ char * statusString();
+ char writeReg(char address, char *data, char width);
+ char writeReg(char address, char data);
+
+ void scratch();
+
+
+};
\ No newline at end of file
