Maxim Integrated / Mbed OS MAXREFDES220#

Dependencies:   USBDevice max32630fthr

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SSInterface.h Source File

SSInterface.h

00001 /***************************************************************************
00002 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
00003 *
00004 * Permission is hereby granted, free of charge, to any person obtaining a
00005 * copy of this software and associated documentation files (the "Software"),
00006 * to deal in the Software without restriction, including without limitation
00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 * and/or sell copies of the Software, and to permit persons to whom the
00009 * Software is furnished to do so, subject to the following conditions:
00010 *
00011 * The above copyright notice and this permission notice shall be included
00012 * in all copies or substantial portions of the Software.
00013 *
00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020 * OTHER DEALINGS IN THE SOFTWARE.
00021 *
00022 * Except as contained in this notice, the name of Maxim Integrated
00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated
00024 * Products, Inc. Branding Policy.
00025 *
00026 * The mere transfer of this software does not imply any licenses
00027 * of trade secrets, proprietary technology, copyrights, patents,
00028 * trademarks, maskwork rights, or any other form of intellectual
00029 * property whatsoever. Maxim Integrated Products, Inc. retains all
00030 * ownership rights.
00031 ****************************************************************************
00032 */
00033 
00034 #ifndef _SSINTERFACE_H_
00035 #define _SSINTERFACE_H_
00036 
00037 #include "mbed.h"
00038 #include "MaximSensor.h"
00039 #include "EventStats.h"
00040 
00041 #define SS_PLATFORM_MAX3263X    "SmartSensor_MAX3263X"
00042 #define SS_PLATFORM_MAX32660    "SmartSensor_MAX32660"
00043 #define SS_BOOTLOADER_PLATFORM_MAX3263X    "Bootloader_MAX3263X"
00044 #define SS_BOOTLOADER_PLATFORM_MAX32660    "Bootloader_MAX32660"
00045 
00046 
00047 #define SS_I2C_8BIT_SLAVE_ADDR 0xAA
00048 #define SS_DEFAULT_CMD_SLEEP_MS 2
00049 #define SS_DUMP_REG_SLEEP_MS 100
00050 #define SS_ENABLE_SENSOR_SLEEP_MS 20
00051 
00052 #define SS_SENSORIDX_MAX86140   0x00
00053 #define SS_SENSORIDX_MAX30205   0x01
00054 #define SS_SENSORIDX_MAX30001   0x02
00055 #define SS_SENSORIDX_MAX30101   0x03
00056 #define SS_SENSORIDX_ACCEL  0x04
00057 
00058 #define SS_ALGOIDX_AGC  0x00
00059 #define SS_ALGOIDX_AEC  0x01
00060 #define SS_ALGOIDX_WHRM 0x02
00061 #define SS_ALGOIDX_ECG  0x03
00062 #define SS_ALGOIDX_BPT  0x04
00063 
00064 #define SS_FAM_R_STATUS     0x00
00065     #define SS_CMDIDX_STATUS    0x00
00066         #define SS_SHIFT_STATUS_ERR             0
00067         #define SS_MASK_STATUS_ERR              (0x07 << SS_SHIFT_STATUS_ERR)
00068         #define SS_SHIFT_STATUS_DATA_RDY        3
00069         #define SS_MASK_STATUS_DATA_RDY         (1 << SS_SHIFT_STATUS_DATA_RDY)
00070         #define SS_SHIFT_STATUS_FIFO_OUT_OVR    4
00071         #define SS_MASK_STATUS_FIFO_OUT_OVR     (1 << SS_SHIFT_STATUS_FIFO_OUT_OVR)
00072         #define SS_SHIFT_STATUS_FIFO_IN_OVR     5
00073         #define SS_MASK_STATUS_FIFO_IN_OVR      (1 << SS_SHIFT_STATUS_FIFO_IN_OVR)
00074 
00075 #define SS_FAM_W_MODE   0x01
00076 #define SS_FAM_R_MODE   0x02
00077     #define SS_CMDIDX_MODE  0x00
00078         #define SS_SHIFT_MODE_SHDN      0
00079         #define SS_MASK_MODE_SHDN       (1 << SS_SHIFT_MODE_SHDN)
00080         #define SS_SHIFT_MODE_RESET     1
00081         #define SS_MASK_MODE_RESET      (1 << SS_SHIFT_MODE_RESET)
00082         #define SS_SHIFT_MODE_FIFORESET 2
00083         #define SS_MASK_MODE_FIFORESET  (1 << SS_SHIFT_MODE_FIFORESET)
00084         #define SS_SHIFT_MODE_BOOTLDR   3
00085         #define SS_MASK_MODE_BOOTLDR    (1 << SS_SHIFT_MODE_BOOTLDR)
00086 
00087 #define SS_I2C_READ     0x03
00088 
00089 #define SS_FAM_W_COMMCHAN   0x10
00090 #define SS_FAM_R_COMMCHAN   0x11
00091     #define SS_CMDIDX_OUTPUTMODE    0x00
00092         #define SS_SHIFT_OUTPUTMODE_DATATYPE    0
00093         #define SS_MASK_OUTPUTMODE_DATATYPE     (0x03 << SS_SHIFT_OUTPUTMODE_DATATYPE)
00094             #define SS_DATATYPE_PAUSE               0
00095             #define SS_DATATYPE_RAW                 1
00096             #define SS_DATATYPE_ALGO                2
00097             #define SS_DATATYPE_BOTH                3
00098         #define SS_SHIFT_OUTPUTMODE_SC_EN       2
00099         #define SS_MASK_OUTPUTMODE_SC_EN        (1 << SS_SHIFT_OUTPUTMODE_SC_EN)
00100     #define SS_CMDIDX_FIFOAFULL     0x01
00101 
00102 #define SS_FAM_R_OUTPUTFIFO 0x12
00103     #define SS_CMDIDX_OUT_NUMSAMPLES    0x00
00104     #define SS_CMDIDX_READFIFO          0x01
00105 
00106 #define SS_FAM_R_INPUTFIFO  0x13
00107     #define SS_CMDIDX_SAMPLESIZE    0x00
00108     #define SS_CMDIDX_FIFOSIZE      0x01
00109     #define SS_CMDIDX_IN_NUMSAMPLES 0x02
00110 #define SS_FAM_W_INPUTFIFO  0x14
00111     #define SS_CMDIDN_WRITEFIFO     0x00
00112 
00113 #define SS_FAM_W_WRITEREG       0x40
00114 #define SS_FAM_R_READREG        0x41
00115 #define SS_FAM_R_REGATTRIBS     0x42
00116 #define SS_FAM_R_DUMPREG        0x43
00117 
00118 #define SS_FAM_W_SENSORMODE 0x44
00119 #define SS_FAM_R_SENSORMODE 0x45
00120 
00121 //TODO: Fill in known configuration parameters
00122 #define SS_FAM_W_ALGOCONFIG 0x50
00123 #define SS_FAM_R_ALGOCONFIG 0x51
00124     #define SS_CFGIDX_AGC_TARGET        0x00
00125     #define SS_CFGIDX_AGC_CORR_COEFF    0x01
00126     #define SS_CFGIDX_AGC_SENSITIVITY   0x02
00127     #define SS_CFGIDX_AGC_SMP_AVG       0x03
00128 
00129     #define SS_CFGIDX_WHRM_SR           0x00
00130     #define SS_CFGIDX_WHRM_MAX_HEIGHT   0x01
00131     #define SS_CFGIDX_WHRM_MAX_WEIGHT   0x02
00132     #define SS_CFGIDX_WHRM_MAX_AGE      0x03
00133     #define SS_CFGIDX_WHRM_MIN_HEIGHT   0x04
00134     #define SS_CFGIDX_WHRM_MIN_WEIGHT   0x05
00135     #define SS_CFGIDX_WHRM_MIN_AGE      0x06
00136     #define SS_CFGIDX_WHRM_DEF_HEIGHT   0x07
00137     #define SS_CFGIDX_WHRM_DEF_WEIGHT   0x08
00138     #define SS_CFGIDX_WHRM_DEF_AGE      0x09
00139     #define SS_CFGIDX_WHRM_INIT_HR      0x0A
00140 
00141     #define SS_CFGIDX_BP_USE_MED        0x00
00142     #define SS_CFGIDX_BP_SYS_BP_CAL     0x01
00143     #define SS_CFGIDX_BP_DIA_BP_CAL     0x02
00144     #define SS_CFGIDX_BP_CAL_DATA       0x03
00145     #define SS_CFGIDX_BP_EST_DATE       0x04
00146     #define SS_CFGIDX_BP_EST_NONREST    0x05
00147 
00148 #define SS_FAM_W_ALGOMODE   0x52
00149 #define SS_FAM_R_ALGOMODE   0x53
00150 
00151 #define SS_FAM_W_EXTERNSENSORMODE   0x60
00152 #define SS_FAM_R_EXTERNSENSORMODE   0x61
00153 
00154 #define SS_FAM_R_SELFTEST    0x70
00155 
00156 #define SS_FAM_W_BOOTLOADER 0x80
00157     #define SS_CMDIDX_SETIV         0x00
00158     #define SS_CMDIDX_SETAUTH       0x01
00159     #define SS_CMDIDX_SETNUMPAGES   0x02
00160     #define SS_CMDIDX_ERASE         0x03
00161     #define SS_CMDIDX_SENDPAGE      0x04
00162     #define SS_CMDIDX_ERASE_PAGE    0x05
00163     #define SS_CMDIDX_STAY_IN_BTLRD 0x06
00164 #define SS_FAM_R_BOOTLOADER 0x81
00165     #define SS_CMDIDX_BOOTFWVERSION 0x00
00166     #define SS_CMDIDX_PAGESIZE      0x01
00167 
00168 #define SS_FAM_W_BOOTLOADER_CFG 0x82
00169 #define SS_FAM_R_BOOTLOADER_CFG 0x83
00170     #define SS_CMDIDX_BL_SAVE       0x00
00171     #define SS_CMDIDX_BL_ENTRY      0x01
00172         #define SS_BL_CFG_ENTER_BL_MODE     0x00
00173         #define SS_BL_CFG_EBL_PIN           0x01
00174         #define SS_BL_CFG_EBL_POL           0x02
00175     #define SS_CMDIDX_BL_EXIT       0x02
00176         #define SS_BL_CFG_EXIT_BL_MODE      0x00
00177         #define SS_BL_CFG_TIMEOUT           0x01
00178 
00179 
00180 #define SS_FAM_R_IDENTITY   0xFF
00181     #define SS_CMDIDX_PLATTYPE      0x00
00182     #define SS_CMDIDX_PARTID        0x01
00183     #define SS_CMDIDX_REVID         0x02
00184     #define SS_CMDIDX_FWVERSION     0x03
00185     #define SS_CMDIDX_AVAILSENSORS  0x04
00186     #define SS_CMDIDX_DRIVERVER     0x05
00187     #define SS_CMDIDX_AVAILALGOS    0x06
00188     #define SS_CMDIDX_ALGOVER       0x07
00189 
00190 
00191 
00192 typedef enum {
00193     SS_SUCCESS=0x00,
00194 
00195     SS_ERR_COMMAND=0x01,
00196     SS_ERR_UNAVAILABLE=0x02,
00197     SS_ERR_DATA_FORMAT=0x03,
00198     SS_ERR_INPUT_VALUE=0x04,
00199 
00200     SS_ERR_BTLDR_GENERAL=0x80,
00201     SS_ERR_BTLDR_CHECKSUM=0x81,
00202 
00203     SS_ERR_TRY_AGAIN=0xFE,
00204     SS_ERR_UNKNOWN=0xFF,
00205 } SS_STATUS;
00206 
00207 typedef enum {
00208     SS_PLAT_MAX3263X=0,
00209     SS_PLAT_MAX32660=1,
00210 } SS_PLAT_TYPE;
00211 
00212 //self test result masks
00213 #define FAILURE_COMM        0x01
00214 #define FAILURE_INTERRUPT   0x02
00215 
00216 #define SS_SMALL_BUF_SIZE 32
00217 #define SS_MED_BUF_SIZE 512
00218 #define SS_LARGE_BUF_SIZE 8224
00219 
00220 #define SS_RESET_TIME   10
00221 #define SS_STARTUP_TIME 1000
00222 
00223 #define SS_MAX_SUPPORTED_SENSOR_NUM 0xFE
00224 #define SS_MAX_SUPPORTED_ALGO_NUM   0xFE
00225 #define SS_MAX_SUPPORTED_ALGO_CFG_NUM   0xFE
00226 #define SS_MAX_SUPPORTED_MODE_NUM   0xFF
00227 
00228 typedef struct {
00229     int data_size;
00230     Callback<void(uint8_t*)> callback;
00231 } ss_data_req;
00232 
00233 
00234 /**
00235  * @brief   SSInterface is Maxim's SmartSensor Interface class
00236  */
00237 class SSInterface
00238 {
00239 public:
00240 
00241     /* PUBLIC FUNCTION DECLARATIONS */
00242     /**
00243     * @brief    SSInterface constructor.
00244     *
00245     * @param[in]    i2cBus - reference to the I2C bus for the SmartSensor
00246     * @param[in]    ss_mfio - name of SmartSensor multi-function IO pin
00247     * @param[in]    ss_reset - name of SmartSensor Reset pin
00248     *
00249     */
00250     SSInterface(I2C &i2cBus, PinName ss_mfio, PinName ss_reset);
00251 
00252     /**
00253     * @brief    SSInterface constructor.
00254     *
00255     * @param[in]    spiBus - reference to the SPI bus for the SmartSensor
00256     * @param[in]    ss_mfio - name of SmartSensor multi-function IO pin
00257     * @param[in]    ss_reset - name of SmartSensor Reset pin
00258     *
00259     */
00260     SSInterface(SPI &spiBus, PinName ss_mfio, PinName ss_reset);
00261 
00262     /**
00263     * @brief    DSInterface destructor.
00264     *
00265     */
00266     ~SSInterface();
00267 
00268     /**
00269     * @brief    Write a command to the SmartSensor and get status response
00270     *
00271     * @param[in]    cmd_bytes - Pointer to the command's family and index bytes
00272     * @param[in]    cmd_idx_len - The number of bytes in the command
00273     * @param[in]    data - Pointer to the command's data bytes
00274     * @param[in]    data_len - The number data bytes
00275     *
00276     * @return SS_STATUS byte
00277     */
00278     SS_STATUS write_cmd(uint8_t *cmd_bytes, int cmd_bytes_len,
00279                         uint8_t *data, int data_len,
00280                         int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00281 
00282 
00283     /**
00284     * @brief    Write a command to the SmartSensor and get status response
00285     *
00286     * @param[in]    tx_buf - Pointer to the command's family, index bytes and data bytes
00287     * @param[in]    tx_len - Total transaction lenght to send
00288     *
00289     * @return SS_STATUS byte
00290     */
00291     SS_STATUS write_cmd(uint8_t *tx_buf, int tx_len,
00292             int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00293 
00294     /**
00295     * @brief    Write a command to the SmartSensor and get status response
00296     *
00297     * @param[in]    cmd_bytes - Pointer to the command's family and index bytes
00298     * @param[in]    cmd_idx_len - The number of bytes in the command
00299     * @param[in]    data - Pointer to the command's data bytes
00300     * @param[in]    data_len - The number data bytes
00301     * @param[in]    rxbuf - Buffer to fill in with read data (including status byte)
00302     * @param[in]    rxbuf_sz - Size of the rx buffer (to prevent overflow)
00303     *
00304     * @return SS_STATUS byte
00305     */
00306     SS_STATUS read_cmd( uint8_t *cmd_bytes, int cmd_bytes_len,
00307                         uint8_t *data, int data_len,
00308                         uint8_t *rxbuf, int rxbuf_sz,
00309                         int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00310 
00311     /**
00312     * @brief    Get a string representing the SmartSensor firmware version
00313     * @details  If in bootloader mode, returns bootloader version
00314     *
00315     * @return   Pointer to firmware version string
00316     */
00317     const char* get_ss_fw_version();
00318 
00319     /**
00320     * @brief    Get a string representing the SmartSensor platform type
00321     *
00322     * @return   Pointer to platform type string
00323     */
00324     const char* get_ss_platform_name();
00325 
00326     /**
00327      * @brief   Reset the SmartSensor and jump to main application
00328      *
00329      * @return  SS_STATUS code indicating success
00330      */ 
00331     SS_STATUS reset_to_main_app();
00332 
00333     /**
00334      * @brief   Reset the SmartSensor and jump to bootloader
00335      *
00336      * @return  SS_STATUS code indicating success
00337      */ 
00338     SS_STATUS reset_to_bootloader();
00339 
00340     /**
00341      * @brief   Reset the SmartSensor
00342      * @details If the SmartSensor was in bootloader, it will jump back into bootloader
00343      *          If the SmartSensor was in main app, it will jump back into main app
00344      *
00345      * @return  SS_STATUS code indicating success
00346      */ 
00347     SS_STATUS reset();
00348 
00349     /**
00350      * @brief       run the self test commands
00351      * param[in]    idx - the id of the sensor for the self test
00352      * param[in]    result - self-test response
00353      * param[in]    sleep_ms - duration of wait for read command
00354      * @return      SS_STATUS code indicating success
00355      */
00356     SS_STATUS self_test(int idx, uint8_t *result, int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00357 
00358     /**
00359      * @brief   Check if SmartSensor is in bootloader mode
00360      *
00361      * @return  1 if in bootloader mode, 0 if in main app, -1 if comm error
00362      */
00363     int in_bootldr_mode();
00364 
00365 
00366     /**
00367      * @brief   Read register from a device onboard SmartSensor
00368      *
00369      * @param[in] idx - Index of device to read
00370      * @param[in] addr - Register address
00371      * @param[out] val - Register value
00372      *
00373      * @return  SS_SUCCESS on success
00374      */
00375     SS_STATUS get_reg(int idx, uint8_t addr, uint32_t *val);
00376 
00377     /**
00378      * @brief   Set register of a device onboard SmartSensor
00379      *
00380      * @param[in] idx - Index of device to read
00381      * @param[in] addr - Register address
00382      * @param[in] val - Register value
00383      * @param[in] byte_size - Size of IC register in bytes
00384      *
00385      * @return  SS_SUCCESS on success
00386      */
00387     SS_STATUS set_reg(int idx, uint8_t addr, uint32_t val, int byte_size);
00388 
00389     /**
00390      * @brief   Dump registers of a device onboard SmartSensor
00391      *
00392      * @param[in] idx - Index of device
00393      * @param[in] reg_vals - Array of addr_val_pairs
00394      * @param[in] reg_vals_sz - Number of items reg_vals can hold
00395      * @param[out] num_regs - Number of registers returned by command
00396      *
00397      * @return  SS_SUCCESS on success
00398      */
00399     SS_STATUS dump_reg(int idx, addr_val_pair* reg_vals, int reg_vals_sz, int* num_regs);
00400 
00401 
00402     /**
00403      * @brief   Enable a device on the SmartSensor
00404      *
00405      * @param[in] idx - Index of device
00406      * @param[in] mode - Mode to set the device to
00407      * @param[in] data_req - Data request
00408      *
00409      * @return  SS_SUCCESS on success
00410      */
00411     SS_STATUS enable_sensor(int idx, int mode, ss_data_req* data_req);
00412 
00413     /**
00414      * @brief   Disable a device on the SmartSensor
00415      *
00416      * @param[in] idx - Index of device
00417      *
00418      * @return  SS_SUCCESS on success
00419      */
00420     SS_STATUS disable_sensor(int idx);
00421 
00422     /**
00423      * @brief   Enable an algorithm on the SmartSensor
00424      *
00425      * @param[in] idx - Index of device
00426      * @param[in] mode - Mode to set the device to
00427      * @param[in] data_req - Data request
00428      *
00429      * @return  SS_SUCCESS on success
00430      */
00431     SS_STATUS enable_algo(int idx, int mode, ss_data_req* data_req);
00432 
00433     /**
00434      * @brief   Disable an algorithm on the SmartSensor
00435      *
00436      * @param[in] idx - Index of device
00437      *
00438      * @return  SS_SUCCESS on success
00439      */
00440     SS_STATUS disable_algo(int idx);
00441 
00442     /**
00443      * @brief   Set the value of an algorithm configuration parameter
00444      *
00445      * @param[in] algo_idx Index of algorithm
00446      * @param[in] cfg_idx Index of configuration parameter
00447      * @param[in] cfg Array of configuration bytes
00448      * @param[in] cfg_sz Size of cfg array
00449      *
00450      * @return SS_SUCCESS on success
00451      */
00452     SS_STATUS set_algo_cfg(int algo_idx, int cfg_idx, uint8_t *cfg, int cfg_sz);
00453 
00454     /**
00455      * @brief   Get the value of an algorithm configuration parameter
00456      *
00457      * @param[in] algo_idx Index of algorithm
00458      * @param[in] cfg_idx Index of configuration parameter
00459      * @param[in] cfg Array of configuration bytes to be filled in
00460      * @param[in] cfg_sz Number of bytes to be read
00461      *
00462      * @return SS_SUCCESS on success
00463      */
00464     SS_STATUS get_algo_cfg(int algo_idx, int cfg_idx, uint8_t *cfg, int cfg_sz);
00465 
00466     /**
00467      * @brief   Set the CommChannel Output Mode options
00468      *
00469      * @param[in] data_type - Set to 0 for only algorithm data
00470      *                          Set to 1 for only raw sensor data
00471      *                          Set to 2 for algo + raw sensor data
00472      *                          Set to 3 for no data
00473      * @param[in] sc_en - Set to true to receive 1 byte sample count from SmartSensor
00474      *
00475      * @return  SS_SUCCESS on success
00476      */
00477     SS_STATUS set_data_type(int data_type, bool sc_en);
00478 
00479     /**
00480      * @brief   Get the CommChannel Output Mode options
00481      *
00482      * @param[out] data_type - 0 for only algorithm data
00483      *                          1 for only raw sensor data
00484      *                          2 for algo + raw sensor data
00485      *                          3 for no data
00486      * @param[in] sc_en - If true, SmartSensor prepends data with 1 byte sample count
00487      *
00488      * @return  SS_SUCCESS on success
00489      */
00490     SS_STATUS get_data_type(int* data_type, bool *sc_en);
00491 
00492     /**
00493      * @brief   Set the number of samples for the SmartSensor to collect
00494      *          before issuing an interrupt
00495      *
00496      * @param[in]   thresh - Number of samples (1-255) to collect before interrupt
00497      *
00498      * @return SS_SUCCESS on success
00499      */
00500     SS_STATUS set_fifo_thresh(int thresh);
00501 
00502     /**
00503      * @brief   Get the number of samples the SmartSensor will collect
00504      *          before issuing an interrupt
00505      *
00506      * @param[out]  thresh - Number of samples (1-255) collected before interrupt
00507      *
00508      * @return SS_SUCCESS on success
00509      */
00510     SS_STATUS get_fifo_thresh(int *thresh);
00511 
00512     /**
00513      * @brief   Check that the SmartSensor is connected
00514      */
00515     SS_STATUS ss_comm_check();
00516 
00517 
00518     void enable_irq();
00519     void disable_irq();
00520 
00521     void mfio_selftest();
00522     bool reset_mfio_irq();
00523 
00524     void ss_execute_once();
00525     void ss_clear_interrupt_flag();
00526 
00527 private:
00528 
00529     /* PRIVATE VARIABLES */
00530     I2C *m_i2cBus;
00531     SPI *m_spiBus;
00532     DigitalInOut mfio_pin;
00533     DigitalInOut reset_pin;
00534     InterruptIn irq_pin;
00535 
00536     char fw_version[128];
00537     const char* plat_name;
00538 
00539     bool sc_en;
00540     int data_type;
00541 
00542     int sensor_enabled_mode[SS_MAX_SUPPORTED_SENSOR_NUM];
00543     int algo_enabled_mode[SS_MAX_SUPPORTED_ALGO_NUM];
00544     ss_data_req* sensor_data_reqs[SS_MAX_SUPPORTED_SENSOR_NUM];
00545     ss_data_req* algo_data_reqs[SS_MAX_SUPPORTED_ALGO_NUM];
00546 
00547     /* PRIVATE METHODS */
00548     SS_STATUS write_cmd_small(uint8_t *cmd_bytes, int cmd_bytes_len,
00549                             uint8_t *data, int data_len,
00550                             int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00551     SS_STATUS write_cmd_medium(uint8_t *cmd_bytes, int cmd_bytes_len,
00552                             uint8_t *data, int data_len,
00553                             int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00554     SS_STATUS write_cmd_large(uint8_t *cmd_bytes, int cmd_bytes_len,
00555                             uint8_t *data, int data_len,
00556                             int sleep_ms = SS_DEFAULT_CMD_SLEEP_MS);
00557     void cfg_mfio(PinDirection);
00558 
00559     void irq_handler();
00560     volatile bool m_irq_received_;
00561 
00562 
00563     void irq_handler_selftest();
00564     volatile bool mfio_int_happened;
00565 
00566     SS_STATUS read_fifo_data(int num_samples, int sample_size, uint8_t* databuf, int databuf_sz);
00567     SS_STATUS num_avail_samples(int* num_samples);
00568     void fifo_sample_size(int data_type, int* sample_size);
00569 
00570     EventStats irq_evt;
00571 };
00572 
00573 
00574 #endif