Mbed library for SPS30 i2c communication

Files at this revision

API Documentation at this revision

Comitter:
ziqiyap
Date:
Fri Mar 15 06:52:32 2019 +0000
Parent:
7:4152825938bf
Commit message:
changed naming from sps30 to Sps30; created new higher functioning public API that can be accessed by sensor_driver

Changed in this revision

sps30.cpp Show annotated file Show diff for this revision Revisions of this file
sps30.h Show annotated file Show diff for this revision Revisions of this file
--- a/sps30.cpp	Tue Mar 12 08:25:10 2019 +0000
+++ b/sps30.cpp	Fri Mar 15 06:52:32 2019 +0000
@@ -4,27 +4,27 @@
 //-----------------------------------------------------------------------------
 // Constructor 
 
-sps30::sps30(PinName sda, PinName scl, int i2c_frequency)  : _i2c(sda, scl) {
+Sps30::Sps30(PinName sda, PinName scl, int i2c_frequency)  : _i2c(sda, scl) {
         _i2c.frequency(i2c_frequency);
 }
 
 //-----------------------------------------------------------------------------
 // Destructor
 
-sps30::~sps30() {
+Sps30::~Sps30() {
 }
 
 //-----------------------------------------------------------------------------
 // start auto-measurement 
 //
 
-uint8_t sps30::StartMeasurement() 
+uint8_t Sps30::StartMeasurement() 
 {
     i2cbuff[0] = SPS30_CMMD_STRT_MEAS >> 8;
     i2cbuff[1] = SPS30_CMMD_STRT_MEAS & 255;
     i2cbuff[2] = SPS30_STRT_MEAS_WRITE_DATA >> 8;
     i2cbuff[3] = SPS30_STRT_MEAS_WRITE_DATA & 255;
-    i2cbuff[4] = sps30::CalcCrc2b(SPS30_STRT_MEAS_WRITE_DATA);
+    i2cbuff[4] = Sps30::CalcCrc2b(SPS30_STRT_MEAS_WRITE_DATA);
     int res = _i2c.write(SPS30_I2C_ADDR, i2cbuff, 5, false);
     if(res) return SPSNOACKERROR;
     return SPSNOERROR;
@@ -33,7 +33,7 @@
 //-----------------------------------------------------------------------------
 // Stop auto-measurement
 
-uint8_t sps30::StopMeasurement()
+uint8_t Sps30::StopMeasurement()
 {
     i2cbuff[0] = SPS30_CMMD_STOP_MEAS >> 8;
     i2cbuff[1] = SPS30_CMMD_STOP_MEAS & 255;
@@ -45,7 +45,7 @@
 //-----------------------------------------------------------------------------
 // Get ready status value
 
-uint8_t sps30::GetReadyStatus()
+uint8_t Sps30::GetReadyStatus()
 {
     i2cbuff[0] = SPS30_CMMD_GET_READY_STAT >> 8;
     i2cbuff[1] = SPS30_CMMD_GET_READY_STAT & 255;
@@ -54,8 +54,8 @@
     
     _i2c.read(SPS30_I2C_ADDR | 1, i2cbuff, 3, false);
     uint16_t stat = (i2cbuff[0] << 8) | i2cbuff[1];
-    ready = stat;
-    uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[2]);
+    sps_ready = stat;
+    uint8_t dat = Sps30::CheckCrc2b(stat, i2cbuff[2]);
     
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     return SPSNOERROR;
@@ -64,7 +64,7 @@
 //-----------------------------------------------------------------------------
 // Get all the measurement values, stick them into the array
 
-uint8_t sps30::ReadMeasurement()   
+uint8_t Sps30::ReadMeasurement()   
 {
     i2cbuff[0] = SPS30_CMMD_READ_MEAS >> 8;
     i2cbuff[1] = SPS30_CMMD_READ_MEAS & 255;
@@ -75,117 +75,117 @@
     
     uint16_t stat = (i2cbuff[0] << 8) | i2cbuff[1];
     mass_1p0_m = stat;
-    uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[2]);
+    uint8_t dat = Sps30::CheckCrc2b(stat, i2cbuff[2]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[3] << 8) | i2cbuff[4];
     mass_1p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[5]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[5]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     
     stat = (i2cbuff[6] << 8) | i2cbuff[7];
     mass_2p5_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[8]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[8]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[9] << 8) | i2cbuff[10];
     mass_2p5_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[11]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[11]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     
     stat = (i2cbuff[12] << 8) | i2cbuff[13];
     mass_4p0_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[14]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[14]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[15] << 8) | i2cbuff[16];
     mass_4p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[17]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[17]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
 
     stat = (i2cbuff[18] << 8) | i2cbuff[19];
     mass_10p0_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[20]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[20]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[21] << 8) | i2cbuff[22];
     mass_10p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[23]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[23]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
 
     stat = (i2cbuff[24] << 8) | i2cbuff[25];
     num_0p5_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[26]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[26]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[27] << 8) | i2cbuff[28];
     num_0p5_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[29]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[29]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     stat = (i2cbuff[30] << 8) | i2cbuff[31];
     num_1p0_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[32]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[32]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[33] << 8) | i2cbuff[34];
     num_1p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[35]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[35]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     
     stat = (i2cbuff[36] << 8) | i2cbuff[37];
     num_2p5_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[38]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[38]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[39] << 8) | i2cbuff[40];
     num_2p5_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[41]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[41]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     
     stat = (i2cbuff[42] << 8) | i2cbuff[43];
     num_4p0_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[44]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[44]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[45] << 8) | i2cbuff[46];
     num_4p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[47]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[47]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     stat = (i2cbuff[48] << 8) | i2cbuff[49];
     num_10p0_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[50]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[50]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[51] << 8) | i2cbuff[52];
     num_10p0_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[53]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[53]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
 
 
     stat = (i2cbuff[54] << 8) | i2cbuff[55];
     typ_pm_size_m = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[56]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[56]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[57] << 8) | i2cbuff[58];
     typ_pm_size_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[59]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[59]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     mass_1p0_i = (mass_1p0_m << 16) | mass_1p0_l;
@@ -220,7 +220,7 @@
 //-----------------------------------------------------------------------------
 // Calculate the CRC of a 2 byte value using the SPS30 CRC polynomial
 
-uint8_t sps30::CalcCrc2b(uint16_t seed)
+uint8_t Sps30::CalcCrc2b(uint16_t seed)
 {
   uint8_t bit;                  // bit mask
   uint8_t crc = SPS30_CRC_INIT; // calculated checksum
@@ -247,46 +247,17 @@
 //-----------------------------------------------------------------------------
 // Compare the CRC values
 
-uint8_t sps30::CheckCrc2b(uint16_t seed, uint8_t crc_in)
+uint8_t Sps30::CheckCrc2b(uint16_t seed, uint8_t crc_in)
 {
-    uint8_t crc_calc = sps30::CalcCrc2b(seed);
+    uint8_t crc_calc = Sps30::CalcCrc2b(seed);
     if(crc_calc != crc_in) return SPSCRCERROR;
     return SPSNOERROR;
 }
 
 //-----------------------------------------------------------------------------
-// Get article code
+// Get Sps30 serial number
 
-uint8_t sps30::GetArticleCode()
-{
-    i2cbuff[0] = SPS30_CMMD_READ_ARTICLECODE >> 8;
-    i2cbuff[1] = SPS30_CMMD_READ_ARTICLECODE & 255;
-    int res = _i2c.write(SPS30_I2C_ADDR, i2cbuff, 2, false);
-    if(res) return SPSNOACKERROR;
-    
-    int i = 0;
-    for(i = 0; i < sizeof(acode); i++) acode[i] = 0;
-    for(i = 0; i < sizeof(i2cbuff); i++) i2cbuff[i] = 0;
-    
-    _i2c.read(SPS30_I2C_ADDR | 1, i2cbuff, SPS30_ACODE_SIZE, false);
-    int t = 0;
-    for(i = 0; i < SPS30_ACODE_SIZE; i +=3) {
-        uint16_t stat = (i2cbuff[i] << 8) | i2cbuff[i + 1];
-        acode[i - t] = stat >> 8;
-        acode[i - t + 1] = stat & 255;
-        uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[i + 2]);
-        t++;
-        if(dat == SPSCRCERROR) return SPSCRCERROR;
-        if(stat == 0) break;
-    }
-
-    return SPSNOERROR;
-}
-
-//-----------------------------------------------------------------------------
-// Get sps30 serial number
-
-uint8_t sps30::GetSerialNumber()
+uint8_t Sps30::GetSerialNumber()
 {
     i2cbuff[0] = SPS30_CMMD_READ_SERIALNBR >> 8;
     i2cbuff[1] = SPS30_CMMD_READ_SERIALNBR & 255;
@@ -303,7 +274,7 @@
         uint16_t stat = (i2cbuff[i] << 8) | i2cbuff[i + 1];
         sn[i - t] = stat >> 8;
         sn[i - t + 1] = stat & 255;
-        uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[i + 2]);
+        uint8_t dat = Sps30::CheckCrc2b(stat, i2cbuff[i + 2]);
         t++;
         if(dat == SPSCRCERROR) return SPSCRCERROR;
         if(stat == 0) break;
@@ -315,7 +286,7 @@
 //-----------------------------------------------------------------------------
 // Read Auto Cleaning Interval on the SPS30
 
-uint8_t sps30::ReadAutoCleanInterval()
+uint8_t Sps30::ReadAutoCleanInterval()
 {   
     i2cbuff[0] = SPS30_CMMD_AUTO_CLEAN_INTV >> 8;
     i2cbuff[1] = SPS30_CMMD_AUTO_CLEAN_INTV & 255;
@@ -327,12 +298,12 @@
     
     uint16_t stat = (i2cbuff[0] << 8) | i2cbuff[1];
     clean_interval_m = stat;
-    uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[2]);
+    uint8_t dat = Sps30::CheckCrc2b(stat, i2cbuff[2]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[3] << 8) | i2cbuff[4];
     clean_interval_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[5]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[5]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     clean_interval_i = (clean_interval_m << 16) | clean_interval_l;
@@ -343,7 +314,7 @@
 //-----------------------------------------------------------------------------
 // Set Auto Cleaning Interval on the SPS30
 
-uint8_t sps30::SetAutoCleanInterval(uint32_t set_interval)
+uint8_t Sps30::SetAutoCleanInterval(uint32_t set_interval)
 {
     uint16_t set_interval_m = set_interval >> 16;
     uint16_t set_interval_l = set_interval & 65535;
@@ -353,11 +324,11 @@
     
     i2cbuff[2] = set_interval_m >> 8;
     i2cbuff[3] = set_interval_m & 255;
-    i2cbuff[4] = sps30::CalcCrc2b(set_interval_m);
+    i2cbuff[4] = Sps30::CalcCrc2b(set_interval_m);
     
     i2cbuff[5] = set_interval_l >> 8;
     i2cbuff[6] = set_interval_l & 255;
-    i2cbuff[7] = sps30::CalcCrc2b(set_interval_l);
+    i2cbuff[7] = Sps30::CalcCrc2b(set_interval_l);
     
     int res = _i2c.write(SPS30_I2C_ADDR, i2cbuff, 8, false);
     if(res) return SPSNOACKERROR;
@@ -366,12 +337,12 @@
     
     uint16_t stat = (i2cbuff[0] << 8) | i2cbuff[1];
     clean_interval_m = stat;
-    uint8_t dat = sps30::CheckCrc2b(stat, i2cbuff[2]);
+    uint8_t dat = Sps30::CheckCrc2b(stat, i2cbuff[2]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     stat = (i2cbuff[3] << 8) | i2cbuff[4];
     clean_interval_l = stat;
-    dat = sps30::CheckCrc2b(stat, i2cbuff[5]);
+    dat = Sps30::CheckCrc2b(stat, i2cbuff[5]);
     if(dat == SPSCRCERROR) return SPSCRCERROR;
     
     clean_interval_i = (clean_interval_m << 16) | clean_interval_l;
@@ -382,7 +353,7 @@
 //-----------------------------------------------------------------------------
 // Perform manual fan cleaning
 
-uint8_t sps30::StartFanClean()
+uint8_t Sps30::StartFanClean()
 {
     i2cbuff[0] = SPS30_CMMD_START_FAN_CLEAN >> 8;
     i2cbuff[1] = SPS30_CMMD_START_FAN_CLEAN & 255;
@@ -394,11 +365,57 @@
 //-----------------------------------------------------------------------------
 // Perform a soft reset on the SPS30
 
-uint8_t sps30::SoftReset()
+uint8_t Sps30::SoftReset()
 {
     i2cbuff[0] = SPS30_CMMD_SOFT_RESET >> 8;
     i2cbuff[1] = SPS30_CMMD_SOFT_RESET & 255;
     int res = _i2c.write(SPS30_I2C_ADDR, i2cbuff, 2, false);
     if(res) return SPSNOACKERROR;
     return SPSNOERROR;
-}
\ No newline at end of file
+}
+
+/**************************   PUBLIC METHODS   **********************************/
+
+//-----------------------------------------------------------------------------
+// Initialise SPS30
+
+uint8_t Sps30::InitSPS30()
+{
+    uint8_t dat = Sps30::GetSerialNumber();
+    if (dat == SPSNOACKERROR) return DISCONNECTED;
+
+    dat = Sps30::StartMeasurement();
+    if (dat == SPSNOACKERROR) return DISCONNECTED;
+
+    return CONNECTED;
+}
+
+//-----------------------------------------------------------------------------
+// Poll SPS30
+
+uint8_t Sps30::PollSPS30()
+{
+    uint8_t dat = Sps30::GetReadyStatus();
+    if (dat == SPSNOACKERROR) return DISCONNECTED;
+    
+    if (sps_ready == SPSISREADY)
+    {
+        uint8_t crcc = Sps30::ReadMeasurement();
+        if (crcc == SPSNOERROR)
+        {
+            return DATAREADY;
+        }
+        else if (crcc == SPSNOACKERROR)
+        {
+            return DISCONNECTED;
+        }
+        else
+        {
+            return DATAERROR;
+        }
+    }
+    else
+    {
+        return DATANOTREADY;
+    }
+}
--- a/sps30.h	Tue Mar 12 08:25:10 2019 +0000
+++ b/sps30.h	Fri Mar 15 06:52:32 2019 +0000
@@ -29,24 +29,33 @@
 #define SPS30_CRC_INIT                  0xff
 
 #define SPS30_SN_SIZE                   33      // size of the s/n ascii string + CRC values
-#define SPS30_ACODE_SIZE                33      // size of the article code ascii string + CRC values
+
+#define MASS_MAX            1000.00f
+#define MASS_MIN            0.00f
+#define NUM_MAX             3000.00f
+#define NUM_MIN             0.00f
+
+#define I2C_FREQUENCY_STD   100000              // SPS30 uses 100MHz for I2C communication
 
 /** Create SPS30 controller class
  *
  * @param sps30 class
  *
  */
-class sps30 {
+class Sps30 {
 
 public:
-    enum SPSError {
-        SPSNOERROR,         //all ok
-        SPSISREADY,         //ready status register
-        SPSNOACKERROR,      //no I2C ACK error
-        SPSCRCERROR,        //CRC error, any
-    };
+    enum SPSStatus {
+        DISCONNECTED,
+        CONNECTED,
+        DATANOTREADY,
+        DATAREADY,
+        DATAERROR,
+        DATAOOR,
+        DATAOK,
+    } SPSStatus;
     
-    uint16_t ready;                /**< 1 = ready, 0 = busy */
+    uint16_t sps_ready;            /**< 1 = ready, 0 = busy */
     uint32_t clean_interval_i;     /** 32 unsigned bit in seconds */
         
     float mass_1p0_f;       /**< float of Mass Conc of PM1.0 */
@@ -62,7 +71,6 @@
 
     float typ_pm_size_f;    /**< float of Typical Particle Size */
         
-    uint8_t acode[33];      /**< Article code number */
     uint8_t sn[33];         /**< ASCII Serial Number */
 
     
@@ -74,7 +82,7 @@
      *
      * @return none
      */
-     sps30(PinName sda, PinName scl, int i2c_frequency);
+     Sps30(PinName sda, PinName scl, int i2c_frequency);
      
     /** Destructor
      *
@@ -82,7 +90,75 @@
      *
      * @return none
      */
-    ~sps30();
+    ~Sps30();
+    
+    
+    /** Initialise SPS30
+     *
+     * @param --none--
+     *
+     * @return enum SPSStatus
+     */
+    uint8_t InitSPS30();
+    
+    /** Poll SPS30 Data
+     *
+     * @param --none--
+     *
+     * @return enum SPSStatus
+     */
+    uint8_t PollSPS30();
+    
+ 
+private:
+
+    enum SPSError {
+        SPSNOERROR,         //all ok
+        SPSISREADY,         //ready status register
+        SPSNOACKERROR,      //no I2C ACK error
+        SPSCRCERROR,        //CRC error, any
+    };
+    
+    char i2cbuff[60];
+    
+    uint16_t clean_interval_m;    /**< High order 16 bit word of Auto Clean Interval */
+    uint16_t clean_interval_l;    /**< High order 16 bit word of Auto Clean Interval */
+
+    uint16_t mass_1p0_m;          /**< High order 16 bit word of Mass Conc of PM1.0 */
+    uint16_t mass_1p0_l;          /**< Low order 16 bit word of Mass Conc of PM1.0 */
+    uint16_t mass_2p5_m;          /**< High order 16 bit word of Mass Conc of PM2.5 */
+    uint16_t mass_2p5_l;          /**< Low order 16 bit word of Mass Conc of PM2.5 */
+    uint16_t mass_4p0_m;          /**< High order 16 bit word of Mass Conc of PM4.0 */
+    uint16_t mass_4p0_l;          /**< Low order 16 bit word of Mass Conc of PM4.0 */
+    uint16_t mass_10p0_m;         /**< High order 16 bit word of Mass Conc of PM10 */
+    uint16_t mass_10p0_l;         /**< Low order 16 bit word of Mass Conc of PM10 */
+
+    uint16_t num_0p5_m;           /**< High order 16 bit word of Number Conc of PM0.5 */
+    uint16_t num_0p5_l;           /**< Low order 16 bit word of Number Conc of PM0.5 */
+    uint16_t num_1p0_m;           /**< High order 16 bit word of Number Conc of PM1.0 */
+    uint16_t num_1p0_l;           /**< Low order 16 bit word of Number Conc of PM1.0 */
+    uint16_t num_2p5_m;           /**< High order 16 bit word of Number Conc of PM2.5 */
+    uint16_t num_2p5_l;           /**< Low order 16 bit word of Number Conc of PM2.5 */
+    uint16_t num_4p0_m;           /**< High order 16 bit word of Number Conc of PM4.0 */
+    uint16_t num_4p0_l;           /**< Low order 16 bit word of Number Conc of PM4.0 */
+    uint16_t num_10p0_m;          /**< High order 16 bit word of Number Conc of PM10 */
+    uint16_t num_10p0_l;          /**< Low order 16 bit word of Number Conc of PM10 */
+
+    uint16_t typ_pm_size_m;       /**< High order 16 bit word of Typical Particle Size */
+    uint16_t typ_pm_size_l;       /**< Low order 16 bit word of Typical Particle Size */
+
+    uint32_t mass_1p0_i;          /**< 32 bit int of Mass Conc of PM1.0 */
+    uint32_t mass_2p5_i;          /**< 32 bit int of Mass Conc of PM2.5 */
+    uint32_t mass_4p0_i;          /**< 32 bit int of Mass Conc of PM4.0 */
+    uint32_t mass_10p0_i;         /**< 32 bit int of Mass Conc of PM10 */
+
+    uint32_t num_0p5_i;           /**< 32 bit int of Number Conc of PM0.5 */
+    uint32_t num_1p0_i;           /**< 32 bit int of Number Conc of PM1.0 */
+    uint32_t num_2p5_i;           /**< 32 bit int of Number Conc of PM2.5 */
+    uint32_t num_4p0_i;           /**< 32 bit int of Number Conc of PM4.0 */
+    uint32_t num_10p0_i;          /**< 32 bit int of Number Conc of PM10 */
+
+    uint32_t typ_pm_size_i;       /**< 32 bit int of Typical Particle Size */
     
     /** Start Auto-Measurement 
      *
@@ -135,15 +211,6 @@
      */
     uint8_t CheckCrc2b(uint16_t seed, uint8_t crc_in);
     
-    /** Get Article Code
-     *
-     * @param --none--
-     * @see ASCII Article Code as acode[33] (returns all 0)
-     *
-     * @return enum SPSerror
-     */
-    uint8_t GetArticleCode();
-    
     /** Get Serial Number
      *
      * @param --none--
@@ -188,48 +255,6 @@
      */
     uint8_t SoftReset();
  
-private:
-    char i2cbuff[60];
-    
-    uint16_t clean_interval_m;    /**< High order 16 bit word of Auto Clean Interval */
-    uint16_t clean_interval_l;    /**< High order 16 bit word of Auto Clean Interval */
-
-    uint16_t mass_1p0_m;          /**< High order 16 bit word of Mass Conc of PM1.0 */
-    uint16_t mass_1p0_l;          /**< Low order 16 bit word of Mass Conc of PM1.0 */
-    uint16_t mass_2p5_m;          /**< High order 16 bit word of Mass Conc of PM2.5 */
-    uint16_t mass_2p5_l;          /**< Low order 16 bit word of Mass Conc of PM2.5 */
-    uint16_t mass_4p0_m;          /**< High order 16 bit word of Mass Conc of PM4.0 */
-    uint16_t mass_4p0_l;          /**< Low order 16 bit word of Mass Conc of PM4.0 */
-    uint16_t mass_10p0_m;         /**< High order 16 bit word of Mass Conc of PM10 */
-    uint16_t mass_10p0_l;         /**< Low order 16 bit word of Mass Conc of PM10 */
-
-    uint16_t num_0p5_m;           /**< High order 16 bit word of Number Conc of PM0.5 */
-    uint16_t num_0p5_l;           /**< Low order 16 bit word of Number Conc of PM0.5 */
-    uint16_t num_1p0_m;           /**< High order 16 bit word of Number Conc of PM1.0 */
-    uint16_t num_1p0_l;           /**< Low order 16 bit word of Number Conc of PM1.0 */
-    uint16_t num_2p5_m;           /**< High order 16 bit word of Number Conc of PM2.5 */
-    uint16_t num_2p5_l;           /**< Low order 16 bit word of Number Conc of PM2.5 */
-    uint16_t num_4p0_m;           /**< High order 16 bit word of Number Conc of PM4.0 */
-    uint16_t num_4p0_l;           /**< Low order 16 bit word of Number Conc of PM4.0 */
-    uint16_t num_10p0_m;          /**< High order 16 bit word of Number Conc of PM10 */
-    uint16_t num_10p0_l;          /**< Low order 16 bit word of Number Conc of PM10 */
-
-    uint16_t typ_pm_size_m;       /**< High order 16 bit word of Typical Particle Size */
-    uint16_t typ_pm_size_l;       /**< Low order 16 bit word of Typical Particle Size */
-
-    uint32_t mass_1p0_i;          /**< 32 bit int of Mass Conc of PM1.0 */
-    uint32_t mass_2p5_i;          /**< 32 bit int of Mass Conc of PM2.5 */
-    uint32_t mass_4p0_i;          /**< 32 bit int of Mass Conc of PM4.0 */
-    uint32_t mass_10p0_i;         /**< 32 bit int of Mass Conc of PM10 */
-
-    uint32_t num_0p5_i;           /**< 32 bit int of Number Conc of PM0.5 */
-    uint32_t num_1p0_i;           /**< 32 bit int of Number Conc of PM1.0 */
-    uint32_t num_2p5_i;           /**< 32 bit int of Number Conc of PM2.5 */
-    uint32_t num_4p0_i;           /**< 32 bit int of Number Conc of PM4.0 */
-    uint32_t num_10p0_i;          /**< 32 bit int of Number Conc of PM10 */
-
-    uint32_t typ_pm_size_i;       /**< 32 bit int of Typical Particle Size */
- 
 protected:
     I2C     _i2c;