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.
Diff: nRF2401A.h
- Revision:
- 0:3fe71769ad07
- Child:
- 1:d40d911b763a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF2401A.h Fri Aug 26 21:36:23 2011 +0000
@@ -0,0 +1,104 @@
+/** \file
+ * \brief
+ *
+ * \author Per Söderstam © 2011
+ */
+
+#include <mbed.h>
+#include <inttypes.h>
+
+/**
+ *
+ *
+ */
+class nRF2401A
+{
+ public:
+ /**
+ *
+ */
+ nRF2401A(PinName ce,
+ PinName cs,
+ PinName dr1,
+ PinName clk1,
+ PinName data)
+ : _ce(DigitalOut(ce)),
+ _cs(DigitalOut(cs)),
+ _dr1(DigitalIn(dr1)),
+ _clk1(DigitalOut(clk1)),
+ _data(DigitalInOut(data))
+ {
+ return;
+ }
+
+ /**
+ *
+ */
+ nRF2401A& setDataPayloadLength(uint8_t n) { _channel_1_data_payload_len = n; return *this; }
+
+ /**
+ *
+ */
+ nRF2401A& setAddress(uint8_t addr4, uint8_t addr3, uint8_t addr2, uint8_t addr1, uint8_t addr0, uint8_t n_bits)
+ {
+ _ctrl_packet_buf.channel_1_address[0] = addr4;
+ _ctrl_packet_buf.channel_1_address[1] = addr3;
+ _ctrl_packet_buf.channel_1_address[2] = addr2;
+ _ctrl_packet_buf.channel_1_address[3] = addr1;
+ _ctrl_packet_buf.channel_1_address[4] = addr0;
+ _ctrl_packet_buf.channel_address_len = n_bits;
+
+ return *this;
+ }
+
+ /**
+ *
+ */
+ typedef enum {NO_CRC = 0x0, CRC_8 = 0x1, CRC_16 = 0x3} CRC_T;
+
+ /**
+ *
+ */
+ nRF2401A& setCRCMode(CRC_T mode) { _ctrl_packet_buf.crc_config = mode; return *this; }
+
+ /**
+ *
+ */
+ nRF2401A& setChannel(uint8_t ...
+
+ /**
+ *
+ */
+ nRF2401A& flushControlPacket(...
+
+ read, write, attachRXHandler...
+
+ private:
+
+ DigitalOut _ce; /**< */
+ DigitalOut _cs; /**< */
+ DigitalIn _dr1; /**< */
+ DigitalOut _clk1; /**< */
+ DigitalInOut _data; /**< */
+
+ struct nRF2401A_ctrl_packet_t
+ {
+ uint8_t channel_2_data_payload_len; /**< */
+ uint8_t channel_1_data_payload_len; /**< */
+ uint8_t channel_2_address[5]; /**< */
+ uint8_t channel_1_address[5]; /**< */
+
+ uint8_t channel_address_len : 6; /**< */
+ uint8_t crc_config : 2; /**< */
+
+ uint8_t enable_dual_channel_mode : 1; /**< */
+ uint8_t communicatioin_mode : 1; /**< */
+ uint8_t rf_data_rate : 1; /**< */
+ uint8_t xo_frequency : 3; /**< */
+ uint8_t rf_power : 2; /**< */
+
+ uint8_t rf_channel : 7; /**< */
+ uint8_t txr_switch : 1; /**< */
+
+ } _ctrl_packet_buf; /**< */
+}
\ No newline at end of file