Library to allo USB PTP device to be hosted by the mbed platform

Dependents:   class_project_main

Revision:
3:1fcb46ab18df
Parent:
1:71c0e9dc153d
Child:
4:9c6f5867f050
diff -r 67753d738eb8 -r 1fcb46ab18df PIMA15740/PIMAArray.h
--- a/PIMA15740/PIMAArray.h	Fri Aug 23 20:02:44 2013 +0000
+++ b/PIMA15740/PIMAArray.h	Fri Aug 23 23:34:05 2013 +0000
@@ -1,38 +1,71 @@
-/* mbed USBHostPTP Library(PIMA15740 definitions)
- * Copyright (c) 2013 Dwayne Dilbeck
- * This software is distributed under the terms of the GNU Lesser General Public License
- */
-
+/**
+*  @file PIMAArray.h
+*  @brief PIMA Array class definition
+*  @author Dwayne Dilbeck
+*  @date 8/23/2013
+* 
+* mbed USBHostPTP Library(PIMA15740 Array definition)
+* @par Copyright:
+*  Copyright (c) 2013 Dwayne Dilbeck
+* @par License:
+*  This software is distributed under the terms of the GNU Lesser General Public License
+*/
 
 /**
 *  Class PIMA array
 *
-*
-*
+*  The PIMA15740 standard defines an array as an unsigned 32bit number of elements followed by a list
+*   of insinged 16bit codes;
 */
 class PIMAArray {
 public:
   /**
   *   Constructor
-  *  @params: None
+  *  @param None
   *
+  *   Zeros the number of elements and sets codes pointer to NUll
   */
   PIMAArray() {
      numberOfElements=0;
      codes=NULL;
   };
   
+  /**
+  * Destructor
+  *
+  * Frees assigned storage for codes.
+  * @param None
+  */
   ~PIMAArray() {
     if( codes !=NULL)
         free(codes);
   };
 
+  /**
+   *  Create and fill array storage from a supplied buffer pointer
+   *
+   *  @param currentPtr a unit8_t pointer to a buffer location where a PIMAArray should be read
+   *  
+   *  @return The number of bytes used from the buffer to create the PIMA array.
+   */
  int FillArray(uint8_t *currentPtr) {
      SetNumberOfElements(*((uint32_t *)currentPtr));
      SetCodes((uint16_t *)(currentPtr+4));
      return (2*numberOfElements) + 4;
 }
 
+   ///Number of elelments stored in the array
+   uint32_t numberOfElements;
+   ///Pointer to Code storage
+   uint16_t *codes;
+
+private:
+/**
+ * Function to allocate array storage space and set the number of elements
+ *
+ * @param uint8_t The number of elements to create storage space for.
+ * @return none
+ */
  void SetNumberOfElements(uint8_t length) {
      this->numberOfElements=length;
      if( codes !=NULL)
@@ -40,13 +73,16 @@
      codes = (uint16_t *) malloc(sizeof(uint16_t)*length);
  };
  
+ /**
+ * Function to read codes form a uint8t buffer and store them.
+ * @param buffer pointer to a uint8_t buffer
+ */
  void SetCodes(uint16_t *buffer){
      if(buffer!=NULL && codes !=NULL)
        for(int i=0;i<this->numberOfElements;i++)
            codes[i]=buffer[i];
  };
   
-   uint32_t numberOfElements;
-   uint16_t *codes;
 };
 
+