Maxim Integrated / Mbed OS MAXREFDES220_HR_SPO2_MONITOR

Dependencies:   max32630fthr USBDevice

Fork of MAXREFDES220_HEART_RATE_MONITOR by Maxim Integrated

Embed: (wiki syntax)

« Back to documentation index

SSInterface Class Reference

SSInterface Class Reference

SSInterface is Maxim's SmartSensor Interface class. More...

#include <SSInterface.h>

Public Member Functions

 SSInterface (I2C &i2cBus, PinName ss_mfio, PinName ss_reset)
 SSInterface constructor.
 SSInterface (SPI &spiBus, PinName ss_mfio, PinName ss_reset)
 SSInterface constructor.
 ~SSInterface ()
 DSInterface destructor.
SS_STATUS write_cmd (uint8_t *cmd_bytes, int cmd_bytes_len, uint8_t *data, int data_len, int sleep_ms=SS_DEFAULT_CMD_SLEEP_MS)
 Write a command to the SmartSensor and get status response.
SS_STATUS write_cmd (uint8_t *tx_buf, int tx_len, int sleep_ms=SS_DEFAULT_CMD_SLEEP_MS)
 Write a command to the SmartSensor and get status response.
SS_STATUS read_cmd (uint8_t *cmd_bytes, int cmd_bytes_len, uint8_t *data, int data_len, uint8_t *rxbuf, int rxbuf_sz, int sleep_ms=SS_DEFAULT_CMD_SLEEP_MS)
 Write a command to the SmartSensor and get status response.
const char * get_ss_fw_version ()
 Get a string representing the SmartSensor firmware version.
const char * get_ss_algo_version ()
 Get a string representing the SmartSensor algo version.
const char * get_ss_platform_name ()
 Get a string representing the SmartSensor platform type.
SS_STATUS reset_to_main_app ()
 Reset the SmartSensor and jump to main application.
SS_STATUS reset_to_bootloader ()
 Reset the SmartSensor and jump to bootloader.
SS_STATUS reset ()
 Reset the SmartSensor.
SS_STATUS self_test (int idx, uint8_t *result, int sleep_ms=SS_DEFAULT_CMD_SLEEP_MS)
 run the self test commands param[in] idx - the id of the sensor for the self test param[in] result - self-test response param[in] sleep_ms - duration of wait for read command
int in_bootldr_mode ()
 Check if SmartSensor is in bootloader mode.
SS_STATUS get_reg (int idx, uint8_t addr, uint32_t *val)
 Read register from a device onboard SmartSensor.
SS_STATUS set_reg (int idx, uint8_t addr, uint32_t val, int byte_size)
 Set register of a device onboard SmartSensor.
SS_STATUS dump_reg (int idx, addr_val_pair *reg_vals, int reg_vals_sz, int *num_regs)
 Dump registers of a device onboard SmartSensor.
SS_STATUS enable_sensor (int idx, int mode, ss_data_req *data_req)
 Enable a device on the SmartSensor.
SS_STATUS disable_sensor (int idx)
 Disable a device on the SmartSensor.
SS_STATUS enable_algo (int idx, int mode, ss_data_req *data_req)
 Enable an algorithm on the SmartSensor.
SS_STATUS disable_algo (int idx)
 Disable an algorithm on the SmartSensor.
SS_STATUS set_algo_cfg (int algo_idx, int cfg_idx, uint8_t *cfg, int cfg_sz)
 Set the value of an algorithm configuration parameter.
SS_STATUS get_algo_cfg (int algo_idx, int cfg_idx, uint8_t *cfg, int cfg_sz)
 Get the value of an algorithm configuration parameter.
SS_STATUS set_data_type (int data_type, bool sc_en)
 Set the CommChannel Output Mode options.
SS_STATUS get_data_type (int *data_type, bool *sc_en)
 Get the CommChannel Output Mode options.
SS_STATUS set_fifo_thresh (int thresh)
 Set the number of samples for the SmartSensor to collect before issuing an interrupt.
SS_STATUS get_fifo_thresh (int *thresh)
 Get the number of samples the SmartSensor will collect before issuing an interrupt.
SS_STATUS ss_comm_check ()
 Check that the SmartSensor is connected.

Detailed Description

SSInterface is Maxim's SmartSensor Interface class.

Definition at line 237 of file SSInterface.h.


Constructor & Destructor Documentation

SSInterface ( I2C &  i2cBus,
PinName  ss_mfio,
PinName  ss_reset 
)

SSInterface constructor.

Parameters:
[in]i2cBus- reference to the I2C bus for the SmartSensor
[in]ss_mfio- name of SmartSensor multi-function IO pin
[in]ss_reset- name of SmartSensor Reset pin

Definition at line 40 of file SSInterface.cpp.

SSInterface ( SPI &  spiBus,
PinName  ss_mfio,
PinName  ss_reset 
)

SSInterface constructor.

Parameters:
[in]spiBus- reference to the SPI bus for the SmartSensor
[in]ss_mfio- name of SmartSensor multi-function IO pin
[in]ss_reset- name of SmartSensor Reset pin

Definition at line 52 of file SSInterface.cpp.

~SSInterface (  )

DSInterface destructor.

Definition at line 64 of file SSInterface.cpp.


Member Function Documentation

SS_STATUS disable_algo ( int  idx )

Disable an algorithm on the SmartSensor.

Parameters:
[in]idx- Index of device
Returns:
SS_SUCCESS on success

Definition at line 603 of file SSInterface.cpp.

SS_STATUS disable_sensor ( int  idx )

Disable a device on the SmartSensor.

Parameters:
[in]idx- Index of device
Returns:
SS_SUCCESS on success

Definition at line 570 of file SSInterface.cpp.

SS_STATUS dump_reg ( int  idx,
addr_val_pair *  reg_vals,
int  reg_vals_sz,
int *  num_regs 
)

Dump registers of a device onboard SmartSensor.

Parameters:
[in]idx- Index of device
[in]reg_vals- Array of addr_val_pairs
[in]reg_vals_sz- Number of items reg_vals can hold
[out]num_regs- Number of registers returned by command
Returns:
SS_SUCCESS on success

Definition at line 507 of file SSInterface.cpp.

SS_STATUS enable_algo ( int  idx,
int  mode,
ss_data_req *  data_req 
)

Enable an algorithm on the SmartSensor.

Parameters:
[in]idx- Index of device
[in]mode- Mode to set the device to
[in]data_req- Data request
Returns:
SS_SUCCESS on success

Definition at line 585 of file SSInterface.cpp.

SS_STATUS enable_sensor ( int  idx,
int  mode,
ss_data_req *  data_req 
)

Enable a device on the SmartSensor.

Parameters:
[in]idx- Index of device
[in]mode- Mode to set the device to
[in]data_req- Data request
Returns:
SS_SUCCESS on success

Definition at line 552 of file SSInterface.cpp.

SS_STATUS get_algo_cfg ( int  algo_idx,
int  cfg_idx,
uint8_t *  cfg,
int  cfg_sz 
)

Get the value of an algorithm configuration parameter.

Parameters:
[in]algo_idxIndex of algorithm
[in]cfg_idxIndex of configuration parameter
[in]cfgArray of configuration bytes to be filled in
[in]cfg_szNumber of bytes to be read
Returns:
SS_SUCCESS on success

Definition at line 630 of file SSInterface.cpp.

SS_STATUS get_data_type ( int *  data_type,
bool *  sc_en 
)

Get the CommChannel Output Mode options.

Parameters:
[out]data_type- 0 for only algorithm data 1 for only raw sensor data 2 for algo + raw sensor data 3 for no data
[in]sc_en- If true, SmartSensor prepends data with 1 byte sample count
Returns:
SS_SUCCESS on success

Definition at line 660 of file SSInterface.cpp.

SS_STATUS get_fifo_thresh ( int *  thresh )

Get the number of samples the SmartSensor will collect before issuing an interrupt.

Parameters:
[out]thresh- Number of samples (1-255) collected before interrupt
Returns:
SS_SUCCESS on success

Definition at line 689 of file SSInterface.cpp.

SS_STATUS get_reg ( int  idx,
uint8_t  addr,
uint32_t *  val 
)

Read register from a device onboard SmartSensor.

Parameters:
[in]idx- Index of device to read
[in]addr- Register address
[out]val- Register value
Returns:
SS_SUCCESS on success

Definition at line 458 of file SSInterface.cpp.

const char * get_ss_algo_version (  )

Get a string representing the SmartSensor algo version.

If in bootloader mode, returns bootloader version

Returns:
Pointer to algo version string

Definition at line 239 of file SSInterface.cpp.

const char * get_ss_fw_version (  )

Get a string representing the SmartSensor firmware version.

If in bootloader mode, returns bootloader version

Returns:
Pointer to firmware version string

Definition at line 208 of file SSInterface.cpp.

const char * get_ss_platform_name (  )

Get a string representing the SmartSensor platform type.

Returns:
Pointer to platform type string

Definition at line 271 of file SSInterface.cpp.

int in_bootldr_mode (  )

Check if SmartSensor is in bootloader mode.

Returns:
1 if in bootloader mode, 0 if in main app, -1 if comm error

Definition at line 194 of file SSInterface.cpp.

SS_STATUS read_cmd ( uint8_t *  cmd_bytes,
int  cmd_bytes_len,
uint8_t *  data,
int  data_len,
uint8_t *  rxbuf,
int  rxbuf_sz,
int  sleep_ms = SS_DEFAULT_CMD_SLEEP_MS 
)

Write a command to the SmartSensor and get status response.

Parameters:
[in]cmd_bytes- Pointer to the command's family and index bytes
[in]cmd_idx_len- The number of bytes in the command
[in]data- Pointer to the command's data bytes
[in]data_len- The number data bytes
[in]rxbuf- Buffer to fill in with read data (including status byte)
[in]rxbuf_sz- Size of the rx buffer (to prevent overflow)
Returns:
SS_STATUS byte

Definition at line 399 of file SSInterface.cpp.

SS_STATUS reset (  )

Reset the SmartSensor.

If the SmartSensor was in bootloader, it will jump back into bootloader If the SmartSensor was in main app, it will jump back into main app

Returns:
SS_STATUS code indicating success

Definition at line 147 of file SSInterface.cpp.

SS_STATUS reset_to_bootloader (  )

Reset the SmartSensor and jump to bootloader.

Returns:
SS_STATUS code indicating success

Definition at line 94 of file SSInterface.cpp.

SS_STATUS reset_to_main_app (  )

Reset the SmartSensor and jump to main application.

Returns:
SS_STATUS code indicating success

Definition at line 68 of file SSInterface.cpp.

SS_STATUS self_test ( int  idx,
uint8_t *  result,
int  sleep_ms = SS_DEFAULT_CMD_SLEEP_MS 
)

run the self test commands param[in] idx - the id of the sensor for the self test param[in] result - self-test response param[in] sleep_ms - duration of wait for read command

Returns:
SS_STATUS code indicating success

Definition at line 158 of file SSInterface.cpp.

SS_STATUS set_algo_cfg ( int  algo_idx,
int  cfg_idx,
uint8_t *  cfg,
int  cfg_sz 
)

Set the value of an algorithm configuration parameter.

Parameters:
[in]algo_idxIndex of algorithm
[in]cfg_idxIndex of configuration parameter
[in]cfgArray of configuration bytes
[in]cfg_szSize of cfg array
Returns:
SS_SUCCESS on success

Definition at line 618 of file SSInterface.cpp.

SS_STATUS set_data_type ( int  data_type,
bool  sc_en 
)

Set the CommChannel Output Mode options.

Parameters:
[in]data_type- Set to 0 for only algorithm data Set to 1 for only raw sensor data Set to 2 for algo + raw sensor data Set to 3 for no data
[in]sc_en- Set to true to receive 1 byte sample count from SmartSensor
Returns:
SS_SUCCESS on success

Definition at line 643 of file SSInterface.cpp.

SS_STATUS set_fifo_thresh ( int  thresh )

Set the number of samples for the SmartSensor to collect before issuing an interrupt.

Parameters:
[in]thresh- Number of samples (1-255) to collect before interrupt
Returns:
SS_SUCCESS on success

Definition at line 678 of file SSInterface.cpp.

SS_STATUS set_reg ( int  idx,
uint8_t  addr,
uint32_t  val,
int  byte_size 
)

Set register of a device onboard SmartSensor.

Parameters:
[in]idx- Index of device to read
[in]addr- Register address
[in]val- Register value
[in]byte_size- Size of IC register in bytes
Returns:
SS_SUCCESS on success

Definition at line 491 of file SSInterface.cpp.

SS_STATUS ss_comm_check (  )

Check that the SmartSensor is connected.

Definition at line 705 of file SSInterface.cpp.

SS_STATUS write_cmd ( uint8_t *  tx_buf,
int  tx_len,
int  sleep_ms = SS_DEFAULT_CMD_SLEEP_MS 
)

Write a command to the SmartSensor and get status response.

Parameters:
[in]tx_buf- Pointer to the command's family, index bytes and data bytes
[in]tx_len- Total transaction lenght to send
Returns:
SS_STATUS byte

Definition at line 318 of file SSInterface.cpp.

SS_STATUS write_cmd ( uint8_t *  cmd_bytes,
int  cmd_bytes_len,
uint8_t *  data,
int  data_len,
int  sleep_ms = SS_DEFAULT_CMD_SLEEP_MS 
)

Write a command to the SmartSensor and get status response.

Parameters:
[in]cmd_bytes- Pointer to the command's family and index bytes
[in]cmd_idx_len- The number of bytes in the command
[in]data- Pointer to the command's data bytes
[in]data_len- The number data bytes
Returns:
SS_STATUS byte

Definition at line 300 of file SSInterface.cpp.