Library for the nRF2401A Transceiver

Dependents:   nRF2401A_Hello_World nRF2401A_Wireless_Accelerometer_joypad nRF2401A_Gameduino_Invaders

Revision:
2:ca8602ee9e1d
Parent:
1:8c57f88ff574
Child:
3:7ae3a5e53a1f
--- a/nRF2401A.h	Fri Oct 04 16:23:58 2013 +0000
+++ b/nRF2401A.h	Sat Oct 05 09:23:20 2013 +0000
@@ -1,5 +1,7 @@
-/* mbed nRF2401A  Library
- *
+/** 
+ *@section DESCRIPTION
+ * mbed nRF2401A  Library
+ *@section LICENSE
  * Copyright (c) 2011, Per Söderstam
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,8 +21,10 @@
  * 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 "nRF2401A.h"
  */
- 
+#ifndef _nRF2401A_H
+#define _nRF2401A_H
 
 #include <mbed.h>
 #include <inttypes.h>
@@ -111,11 +115,11 @@
          * The constructor assigns the specified pinout, attatch the
          * DR1 to a pin interrupt and sets up inmutable control packet
          * fields.
-         * \param ce Chip Enable (CE) pin of the nRF2401A.
-         * \param c2 Chip Select (CS) pin of the nRF2401A.
-         * \param dr1 Data Ready 1 (DR1) pin of the nRF2401A.
-         * \param clk1 Clock 1 (CLK1) pin of the nRF2401A.
-         * \param data Data (DATA) pin of the nRF2401A.
+         * @param ce Chip Enable (CE) pin of the nRF2401A.
+         * @param c2 Chip Select (CS) pin of the nRF2401A.
+         * @param dr1 Data Ready 1 (DR1) pin of the nRF2401A.
+         * @param clk1 Clock 1 (CLK1) pin of the nRF2401A.
+         * @param data Data (DATA) pin of the nRF2401A.
          */
         nRF2401A(PinName ce,
                  PinName cs,
@@ -130,8 +134,8 @@
         
         /** Set the payload length, in bits.
          * Set the control packet field for length, in number of bits, of the message payload.
-         * \param n Number of bits of the message payload.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param n Number of bits of the message payload.
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& setDataPayloadLength(uint8_t n) 
         { 
@@ -141,13 +145,13 @@
         
         /** Set the address of channel 1.
          * The channel address is a up to 40 bit number identifying the tranceiver.
-         * \param addr4 Bits 39-32 of the address.
-         * \param addr4 Bits 31-24 of the address.
-         * \param addr4 Bits 23-16 of the address.
-         * \param addr4 Bits 15-8 of the address.
-         * \param addr4 Bits 7-0 of the address.
-         * \param n_bits Number of bits used in the address.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param addr4 Bits 39-32 of the address.
+         * @param addr4 Bits 31-24 of the address.
+         * @param addr4 Bits 23-16 of the address.
+         * @param addr4 Bits 15-8 of the address.
+         * @param addr4 Bits 7-0 of the address.
+         * @param n_bits Number of bits used in the address.
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& setAddress(uint8_t addr4, uint8_t addr3, uint8_t addr2, uint8_t addr1, uint8_t addr0, uint8_t n_bits)
         {
@@ -173,8 +177,8 @@
         
         /** Set CRC use.
          * Set the CRC mode field of the control packet.
-         * \param mode The CRC mode of choise.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param mode The CRC mode of choise.
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& setCRCMode(CRC_T mode) 
         { 
@@ -193,8 +197,8 @@
         
         /** Set tranceiver data rate.
          * Sets the data rate field to either 250 kbit/s or 1 Mbit/s data transfer rate.
-         * \param mode The data rate of choise.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param mode The data rate of choise.
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& setDataRate(DATA_RATE_T data_rate)
         {
@@ -205,8 +209,8 @@
         /** Set RF channel.
          * Sets the control packet field for channel number. Channel numbers are from 0 to 127
          * representing channel frequencies equal to (2400 + channel number) MHz.
-         * \param ch Channel number, from the range [0, 127].
-         * \return Reference to the invoked object (for chaining operations).
+         * @param ch Channel number, from the range [0, 127].
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& setChannel(uint8_t ch)
         {
@@ -216,7 +220,7 @@
         
         /** Send the control packet to the nRF2401A.
          * This function transfer the control packet image to the nRF2401A.
-         * \return Reference to the invoked object (for chaining operations).
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& flushControlPacket();
         
@@ -233,11 +237,11 @@
         /** Send a message.
          * This routine will transfer the data from the supplied buffer and send
          * it to the specified address using the current control packet settings.
-         * \param addr The address to send to.
-         * \param addr_len Length of address, in bits.
-         * \param msg_buf Message body.
-         * \param msg_len Length of message,  in bits.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param addr The address to send to.
+         * @param addr_len Length of address, in bits.
+         * @param msg_buf Message body.
+         * @param msg_len Length of message,  in bits.
+         * @return Reference to the invoked object (for chaining operations).
          */
         nRF2401A& sendMsg(address_t addr, uint8_t addr_len, uint8_t *msg_buf, uint8_t msg_len);
         
@@ -245,9 +249,9 @@
          * Attach a callback that will be called when the tranceiver intercept a
          * message. This callback will be called in the context of an interrupt
          * routine and should act accordingly.
-         * \param handler The callback, of type nRF2401_rx_handler_t.
-         * \param arg Pointer to data supplied to the handler at call time.
-         * \return Reference to the invoked object (for chaining operations).
+         * @param handler The callback, of type nRF2401_rx_handler_t.
+         * @param arg Pointer to data supplied to the handler at call time.
+         * @return Reference to the invoked object (for chaining operations).
          */     
         nRF2401A& attachRXHandler(nRF2401A_rx_handler_t handler, void *arg);
         
@@ -325,16 +329,18 @@
         
         /** Write to the data bus.
          * Write n_bits bits on the DATA line.
-         * \param buf Data buffer.
-         * \param n_bits Number of bits to transfer.
-         * \param is_ctrl True if the tranfered data is control word, false if data.
+         * @param buf Data buffer.
+         * @param n_bits Number of bits to transfer.
+         * @param is_ctrl True if the tranfered data is control word, false if data.
          */
         void pushCtrl(uint8_t *buf, uint8_t n_bits, bool is_ctrl = true);
         
         /** Read a message from the tranceiver.
          * Read until DR1 goes low.
-         * \param buf Data buffer.
-         * \return Number of bits read.
+         * @param buf Data buffer.
+         * @return Number of bits read.
          */
         int pull(uint8_t *buf);
-};
\ No newline at end of file
+};
+
+#endif
\ No newline at end of file