SENtral Simple Serial Host interface for PNI Sensor Corp SENtral-A2 motion coprocessor. For use with the RM3100RTI Arduino shield module on top of an STM4 serial mbed board. Will work with an PNI RM3100RTI module or M&M motion modules. Interaction with unit using built in USB serial serial port set for 115200 baud. Send '?' char for menu. Presently requires SENtral firmware to either be loaded in the RM3100RTI Arduino shield SD Card or preloaded in the RM3100RTI or M&M module's EEPROM. Firmware is typically preloaded on the module's EEPROM by PNI. PNI Sensor, 2019 www.pnicorp.com

Dependencies:   mbed SDFileSystemVSG

Embed: (wiki syntax)

« Back to documentation index

em7186.h File Reference

em7186.h File Reference

Sample interface for the em7186. More...

Go to the source code of this file.

Functions

u32 em7186_i2c_init ()
 Initialize the i2c interface.
u32 em7186_i2c_init_by_id (s32 deviceId)
 Initialize the i2c interface indicated by the device id.
u32 em7186_i2c_read (u8 registerAddress, char *buffer, u16 length)
 Read a block of data from the i2c bus.
u32 em7186_i2c_write (u8 registerAddress, char *buffer, u16 length)
 Write a block of data to the i2c bus.
u32 em7186_i2c_write_value (u8 registerAddress, char value)
 Write a single byte to the i2c bus.
u8 em7186_interrupt ()
 Check for an interrupt from the em7186.
u8 em7186_set_scale_factors ()
 Set the sensor scale factors.
u32 em7186_firmware_Transfer2RAM (const char *filename)
 Save a set of warm-start coefficients to file.
u32 em7186_param_read (char *values, u8 page, ParamInfo *params, u8 numParams)
 Read a set of parameters.
u32 em7186_param_write (char *values, u8 page, ParamInfo *params, u8 numParams)
 Write a set of parameters.
u32 em7186_read_fifo (char *buffer)
 Read the contents of the fifo.
u32 em7186_parse_fifo (char *buffer, u32 size)
 Parse the fifo buffer.
u32 em7186_set_sensor_rate (u8 sensorId, u16 rate)
 Set a sensor output rate.
u32 em7186_set_sensor_delay (u8 sensorId, u16 delay)
 Set a sensor maximum report latency.
u32 em7186_set_fifo_watermarks (u16 wakeFifoWatermark, u16 nonWakeFifoWatermark)
 Set fifo watermark values.
u32 em7186_set_meta_event (u8 eventId, u8 enable, u8 enableInt)
 Change meta-event settings.
u32 em7186_ap_suspend (u8 suspend)
 Enter or exit ap suspend mode.
u32 em7186_flush_sensor (u8 sensorId)
 Flush data from a fifo.
u32 em7186_enable_raw_sensors (u8 enableMag, u8 enableAccel, u8 enableGyro)
 Enable raw sensor data for calibration or debugging.

Detailed Description

Sample interface for the em7186.

Authors:
David Vincent
Date:
04/01/2015 (C) 2015 PNI Corp

Disclosure to third parties or reproduction in any form whatsoever, without prior written consent, is strictly forbidden

Definition in file em7186.h.


Function Documentation

u32 em7186_ap_suspend ( u8  suspend )

Enter or exit ap suspend mode.

AP suspend mode changes the interrupt behavior of the em7186. While in AP suspend mode only wake events will interrupt the host.

Parameters:
suspendTrue to enter suspend mode, False to exit suspend mode.
Returns:
1 on success, 0 on failure.

Definition at line 1137 of file em7186.cpp.

u32 em7186_enable_raw_sensors ( u8  enableMag,
u8  enableAccel,
u8  enableGyro 
)

Enable raw sensor data for calibration or debugging.

Parameters:
emableMagTrue to enable the magnetometer debug output.
emableAccelTrue to enable the accelerometer debug output.
emableGyroTrue to enable the gyroscope debug output.
Returns:
1 on success, 0 on failure.

Definition at line 1178 of file em7186.cpp.

u32 em7186_firmware_Transfer2RAM ( const char *  filename )

Save a set of warm-start coefficients to file.

See also:
em7186_warm_start_load
Parameters:
filenameThe name of the file to create.
Returns:
1 on success, 0 on failure. Load a set of warm-start coefficients from file.
See also:
em7186_warm_start_save
Parameters:
filenameThe name of the file to load.
Returns:
1 on success, 0 on failure.

Upload firmware. Resets the CPU and uploads firmware.

Parameters:
filenameThe name of the firmware file to upload.
Returns:
1 on success, 0 otherwise.
u32 em7186_flush_sensor ( u8  sensorId )

Flush data from a fifo.

Flush can be for an individual sensor or an entire fifo.

See also:
FIFO_FLUSH_DISCARD_NON_WAKE
FIFO_FLUSH_DISCARD_WAKE
FIFO_FLUSH_TRANSFER_NON_WAKE
FIFO_FLUSH_TRANSFER_WAKE
FIFO_FLUSH_DISCARD_ALL
FIFO_FLUSH_TRANSFER_ALL
Parameters:
sensorIdThe id of the sensor to flush, or a special flush command.
Returns:
1 on success, 0 on failure.

Definition at line 1147 of file em7186.cpp.

u32 em7186_i2c_init (  )

Initialize the i2c interface.

Implementation is hardware specific.

Returns:
1 if initialization succeeded, 0 otherwise.

Definition at line 167 of file em7186.cpp.

u32 em7186_i2c_init_by_id ( s32  deviceId )

Initialize the i2c interface indicated by the device id.

Implementation is hardware specific.

Parameters:
deviceIdthe unique device id for the I2C interface hardware.
Returns:
1 if initialization succeeded, 0 otherwise.
u32 em7186_i2c_read ( u8  registerAddress,
char *  buffer,
u16  length 
)

Read a block of data from the i2c bus.

Implementation is hardware specific.

Parameters:
registerAddressThe address of the first register in the block.
[out]bufferThe data.
lengthThe number of bytes to read.
Returns:
The number of bytes read.
u32 em7186_i2c_write ( u8  registerAddress,
char *  buffer,
u16  length 
)

Write a block of data to the i2c bus.

Implementation is hardware specific.

Parameters:
registerAddressThe address of the first register in the block.
bufferThe data to write.
lengthThe number of bytes to write.
Returns:
The number of bytes written.
u32 em7186_i2c_write_value ( u8  registerAddress,
char  value 
)

Write a single byte to the i2c bus.

Implementation is hardware specific.

Parameters:
registerAddressThe register to write.
valueThe data to write.
Returns:
1 if the write succeeded, 0 otherwise.
u8 em7186_interrupt (  )

Check for an interrupt from the em7186.

Implementation is hardware specific.

Returns:
1 if the interrupt line is high, 0 otherwise.
u32 em7186_param_read ( char *  values,
u8  page,
ParamInfo *  params,
u8  numParams 
)

Read a set of parameters.

Initiate the transfer of a set of parameters on the same parameter page.

Parameters:
[out]values,Thevalues of the parameters that have been read.
page,Thepage to read values from.
params,Thelist of parameters to read.
numParams,Thenumber of parameters to read.
Returns:
, The number of parameters that were read.
u32 em7186_param_write ( char *  values,
u8  page,
ParamInfo *  params,
u8  numParams 
)

Write a set of parameters.

Initiate the transfer of a set of parameters on the same parameter page.

Parameters:
values,Thevalues to write to the specified parameters.
page,Thepage to write values to.
params,Thelist of parameters to write.
numParams,Thenumber of parameters to write.
Returns:
, The number of parameters that were written.
u32 em7186_parse_fifo ( char *  buffer,
u32  size 
)

Parse the fifo buffer.

Parameters:
bufferThe contents of the fifo.
sizeThe number of bytes in the fifo buffer.
Returns:
The number of bytes parsed.
u32 em7186_read_fifo ( char *  buffer )

Read the contents of the fifo.

Note that the size of the buffer must be at least as large as the space available for the fifo.

Parameters:
[out]bufferThe contents of the fifo.
Returns:
The number of bytes read from the fifo.
u32 em7186_set_fifo_watermarks ( u16  wakeFifoWatermark,
u16  nonWakeFifoWatermark 
)

Set fifo watermark values.

The fifo watermark can be used to wake the host before data is lost from the fifo. Default behavior is to allow the non-wake fifo to overflow while the host is in suspend mode and for the wake fifo to wake the host before data is lost. This function sets the minimum number of bytes remaining in the fifo before a host interrupt is issued.

Note that the watermark values used in this function differ from those in the documentation.

Parameters:
wakeFifoWatermarkThe minimum number of bytes remaining in the wake fifo before interrupting the host.
nonWakeFifoWatermarkThe minimum number of bytes remaining in the non-wake fifo before interrupting the host.
Returns:
1 on success, 0 on failure.

Definition at line 1165 of file em7186.cpp.

u32 em7186_set_meta_event ( u8  eventId,
u8  enable,
u8  enableInt 
)

Change meta-event settings.

Enable or disable individual meta-events and their interrupts.

Parameters:
eventIdThe id of the meta-event.
enableTrue to enable the meta-event.
enableIntTrue to cause meta-event to interrupt the host.
Returns:
1 on success, 0 on failure.

Definition at line 1012 of file em7186.cpp.

u8 em7186_set_scale_factors (  )

Set the sensor scale factors.

Some of these values could change depending on the hardware being used.

Returns:
1 on success, 0 on failure.

Definition at line 1025 of file em7186.cpp.

u32 em7186_set_sensor_delay ( u8  sensorId,
u16  delay 
)

Set a sensor maximum report latency.

Parameters:
sensorIdThe id of the sensor.
rateThe desired latency in milliseconds.
Returns:
1 on success, 0 on failure.

Definition at line 997 of file em7186.cpp.

u32 em7186_set_sensor_rate ( u8  sensorId,
u16  rate 
)

Set a sensor output rate.

Parameters:
sensorIdThe id of the sensor.
rateThe desired rate in Hz.
Returns:
1 on success, 0 on failure.

Definition at line 984 of file em7186.cpp.