Driver for the AKM AK9752 IR sensor device.

Dependents:   AKDP-RevD7_014

Library for the AK9752 Ultra-Small IR Sensor with I2C Interface. Includes integrated temperature sensor (0 - 50C) and 16-bit ADC.

Revision:
7:fb2afd6d095c
Parent:
6:254b7e5820e7
Child:
11:e4a64ed3ed58
--- a/AK9752.h	Wed Nov 02 17:41:22 2016 +0000
+++ b/AK9752.h	Wed Nov 02 18:28:22 2016 +0000
@@ -32,7 +32,7 @@
 {
 public:
     /**
-     * Enum for return status.
+     * Return status.
      */
     typedef enum {
         SUCCESS,                 /**< Success */
@@ -43,14 +43,14 @@
     } Status;
     
     /**
-     * Enum for slave address of AK9752.
+     * Slave address of AK9752.
      */
     typedef enum {
         SLAVE_ADDR_1 = 0x64,   /**< CAD1=0, CAD0=0 */
     } SlaveAddress;
     
     /**
-     * Enum for operation mode of measurement.
+     * Data sampling operation modes.
      */
     typedef enum {
         MODE_STANDBY = 0x00,        /**< MODE_STANDBY:      0x00 */
@@ -59,7 +59,7 @@
     } OperationMode;
 
     /**
-     * Enum for Cut-off frequency for tempearature sensor setting.
+     * Cut-off frequency setting for the temperature sensor filter.
      */    
     typedef enum {
         FCTMP_NOFILTER = 0x00,      /**< No Filter */
@@ -70,7 +70,7 @@
     } FcTmp;
     
     /**
-     * Enum for Cut-off frequency for IR sensor setting.
+     * Cut-off frequency setting for the IR sensor filter.
      */    
     typedef enum {
         FCIR_NOFILTER = 0x00,      /**< No Filter */
@@ -80,7 +80,7 @@
     } FcIr;
     
     /**
-     * Structure for interrupt status.
+     * Status of the IR and temperature sensor threshold interrupts.
      */
     typedef struct {
         bool irh;                   /**< IR Sensor crossed high threshold. */
@@ -91,7 +91,7 @@
     } InterruptStatus;
 
     /**
-     * Structure to hold threshold levels.
+     * Threshold level interrupt settings for the IR and temperature sensor.
      */    
     typedef struct {
         int16_t thirh;        /**< High Threshold level for IR sensor. */
@@ -101,7 +101,7 @@
     } Threshold;
     
     /**
-     * Structure to hold all sensor data: IR, temperature, and interrupt flags.
+     * Sensor data: IR, temperature, and status of their interrupts.
      */
     typedef struct {
         InterruptStatus intStatus;  /**< Interrupt status object */
@@ -113,7 +113,7 @@
     /**
      * Constructor.
      *
-     * @param conn Instance of I2C
+     * @param conn Instance of I2C connection
      * @param addr Slave address of the device
      */
     AK9752();
@@ -121,33 +121,33 @@
     /**
      * Initialize AK9752 connection.
      *
-     * @param conn Instance of I2C
-     * @param addr I2C slave address
+     * @param conn Instance of I2C connection
+     * @param addr Slave address of I2C device
      */
     void init(I2C *conn, SlaveAddress addr);
 
     /**
      * Checks AK9752 connection.
      *
-     * @return SUCCESS if connection is confirmed, otherwise returns other value.
+     * @return SUCCESS if connection is established, error otherwise.
      */
     Status checkConnection();
 
     /**
-     * Gets interrupt enable/disable status.
+     * Retrieve the interrupt enable/disable status.
      *
      * @param intStatus Interrupt enable status
      *
-     * @return SUCCESS if the interrupt status is obtained successfully, otherwise returns other value.
+     * @return SUCCESS if the interrupt status is obtained successfully, error otherwise.
      */
     Status getInterruptEnable(InterruptStatus *intStatus);
        
     /**
-     * Sets interrupt enable/disable status.
+     * Enable or disable interrupts.
      *
      * @param intStatus interrupt status
      *
-     * @return SUCCESS if the interrupt status is set successfully, otherwise returns other value.
+     * @return SUCCESS if the interrupt status is set successfully, error otherwise.
      */
     Status setInterruptEnable(const InterruptStatus *intStatus);
     
@@ -158,7 +158,7 @@
      * @param fc_tmp Pointer to the tempearture sensor filter setting.
      * @param fc_ir Pointer to the IR sensor filter setting.
      *
-     * @return SUCCESS if operation mode is set successfully, otherwise returns other value.
+     * @return SUCCESS if operation mode is set successfully, error otherwise.
      */
     Status getOperationMode(OperationMode *mode, FcTmp *fc_tmp, FcIr *fc_ir);
        
@@ -169,25 +169,25 @@
      * @param fc_tmp Filter cut-off frequency setting for temperature sensor.
      * @param fc_ir Filter cut-off frequency setting for IR sensor.
      *
-     * @return SUCCESS if operation mode is set successfully, otherwise returns other value.
+     * @return SUCCESS if operation mode is set successfully, error otherwise.
      */
     Status setOperationMode(OperationMode mode, FcTmp fc_tmp = FCTMP_NOFILTER, FcIr fc_ir = FCIR_NOFILTER);
        
     /**
      * Sets threshold of IR/temperature sensor.
      *
-     * @param th Pointer to the threshold structure to be set.
+     * @param th Variable of Threshold struct containing thresholds to be set.
      *
-     * @return SUCCESS if threshold is set successfully, otherwise returns other value.
+     * @return SUCCESS if thresholds are set successfully, error otherwise.
      */
     Status setThreshold(const Threshold *th);
     
     /**
-     * Gets threshold of IR/temperature sensor.
+     * Gets thresholds of IR/temperature sensors.
      *
-     * @param th Pointer to the threshold structure to store the read data.
+     * @param th Instance of Threshold struct to store thresholds.
      *
-     * @return SUCCESS if threshold is read successfully, otherwise returns other value.
+     * @return SUCCESS if threshold is read successfully, error otherwise.
      */
     Status getThreshold(Threshold *th);