Maxim Integrated / Mbed OS MAXREFDES220_HEART_RATE_MONITOR

Dependencies:   USBDevice max32630fthr

Fork of MAXREFDES220# 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_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_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.

Detailed Description

SSInterface is Maxim's SmartSensor Interface class.

Definition at line 196 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 39 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 49 of file SSInterface.cpp.

~SSInterface (  )

DSInterface destructor.

Definition at line 59 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 510 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 477 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 415 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 492 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 460 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 542 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 366 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 191 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 222 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 177 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 322 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 130 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 97 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 63 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 141 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 525 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 399 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 267 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 251 of file SSInterface.cpp.