Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

Pressure Sensor V3
[Mindsensors]

Files

file  mindsensors-pressure.h
 

Mindsensors PPS-v3 driver.


Defines

#define MSPPS_I2C_ADDR   0x18
#define MSPPS_CMD   0x41
#define MSPPS_UNIT   0x42
#define MSPPS_PRESS_ABS   0x43
#define MSPPS_PRESS_GAUGE   0x45
#define MSPPS_PRESS_REF   0x47
#define MSPPS_UNIT_PSI   0x50
#define MSPPS_UNIT_MB   0x62
#define MSPPS_UNIT_KPA   0x6B
#define MSPSS_CMD_SETREF   0x44
#define MSPPSsetUnitPSI(X)   MSPPSsetUnit(X, MSPPS_UNIT_PSI)
#define MSPPSsetUnitmB(X)   MSPPSsetUnit(X, MSPPS_UNIT_MB)
#define MSPPSsetUnitkPa(X)   MSPPSsetUnit(X, MSPPS_UNIT_KPA)

Functions

bool MSPPSsendCmd (tSensors link, ubyte command)
bool MSPPSsetUnit (tSensors link, ubyte unit)
long MSPPSreadPressure (tSensors link, ubyte reg)
long MSPPSreadAbsPressure (tSensors link)
long MSPPSreadGaugePressure (tSensors link)
long MSPPSreadRefPressure (tSensors link)
bool MSPPSsetRefPressure (tSensors link)
bool MSPPSsetRefPressure (tSensors link, int refpressure)

Variables

tByteArray MSPPS_I2CRequest
tByteArray MSPPS_I2CReply

Detailed Description

PPS-v3 Sensor


Define Documentation

#define MSPPS_CMD   0x41

MSPPS command register

Definition at line 43 of file mindsensors-pressure.h.

#define MSPPS_I2C_ADDR   0x18

MSPPS I2C device address

Definition at line 41 of file mindsensors-pressure.h.

#define MSPPS_PRESS_ABS   0x43

Read the absolute pressure

Definition at line 46 of file mindsensors-pressure.h.

#define MSPPS_PRESS_GAUGE   0x45

Read the gauge pressure

Definition at line 47 of file mindsensors-pressure.h.

#define MSPPS_PRESS_REF   0x47

Read or write the reference pressure

Definition at line 48 of file mindsensors-pressure.h.

#define MSPPS_UNIT   0x42

Configure measurement unit

Definition at line 45 of file mindsensors-pressure.h.

#define MSPPS_UNIT_KPA   0x6B

Kilo Pascal unit

Definition at line 52 of file mindsensors-pressure.h.

#define MSPPS_UNIT_MB   0x62

Millibar unit

Definition at line 51 of file mindsensors-pressure.h.

#define MSPPS_UNIT_PSI   0x50

PSI unit

Examples:
mindsensors-pressure-test1.c.

Definition at line 50 of file mindsensors-pressure.h.

#define MSPPSsetUnitkPa (   X )    MSPPSsetUnit(X, MSPPS_UNIT_KPA)

Definition at line 69 of file mindsensors-pressure.h.

#define MSPPSsetUnitmB (   X )    MSPPSsetUnit(X, MSPPS_UNIT_MB)

Definition at line 68 of file mindsensors-pressure.h.

#define MSPPSsetUnitPSI (   X )    MSPPSsetUnit(X, MSPPS_UNIT_PSI)

Definition at line 67 of file mindsensors-pressure.h.

#define MSPSS_CMD_SETREF   0x44

Set reference pressure to current absolute pressure

Definition at line 54 of file mindsensors-pressure.h.


Function Documentation

long MSPPSreadAbsPressure ( tSensors  link )

Read the absolute pressure from the sensor and return it in the unit the sensor has been configured for.

Parameters:
linkthe sensor port number
Returns:
the absolute pressure.
Examples:
mindsensors-pressure-test1.c.

Definition at line 105 of file mindsensors-pressure.h.

long MSPPSreadGaugePressure ( tSensors  link )

Read the gauge pressure from the sensor and return it in the unit the sensor has been configured for. This is the absolute pressure minus the reference pressure.

Parameters:
linkthe sensor port number
Returns:
the gauge pressure.
Examples:
mindsensors-pressure-test1.c.

Definition at line 118 of file mindsensors-pressure.h.

long MSPPSreadPressure ( tSensors  link,
ubyte  reg 
)

Read the pressure from the sensor and return it in the unit the sensor has been configured for.
It is better to use MSPPSreadAbsPressure(), MSPPSreadGaugePressure() or MSPPSreadRefPressure() instead

Parameters:
linkthe sensor port number
regSpecific pressure register to read.
Returns:
the absolute pressure.

Definition at line 84 of file mindsensors-pressure.h.

long MSPPSreadRefPressure ( tSensors  link )

Read the reference pressure from the sensor and return it in the unit specified.

Parameters:
linkthe sensor port number
Returns:
the reference pressure.

Definition at line 130 of file mindsensors-pressure.h.

bool MSPPSsendCmd ( tSensors  link,
ubyte  command 
)

Send a command to the sensor

Parameters:
linkthe sensor port number
commandthe command to be sent
Returns:
true if no error occured, false if it did

Definition at line 173 of file mindsensors-pressure.h.

bool MSPPSsetRefPressure ( tSensors  link,
int  refpressure 
)

Set the reference pressure to the value specified.

Parameters:
linkthe sensor port number
refpressurethe value the ref pressure register should be set to.
Returns:
true if no error occured, false if it did

Definition at line 142 of file mindsensors-pressure.h.

bool MSPPSsetRefPressure ( tSensors  link )

Set the reference pressure to the current absolute pressure value.

Parameters:
linkthe sensor port number
Returns:
true if no error occured, false if it did
Examples:
mindsensors-pressure-test1.c.

Definition at line 161 of file mindsensors-pressure.h.

bool MSPPSsetUnit ( tSensors  link,
ubyte  unit 
)

Set the unit of measurement to the one specified.

Parameters:
linkthe sensor port number
unitthe unit of measurement to be used.
Returns:
true if no error occured, false if it did
Examples:
mindsensors-pressure-test1.c.

Definition at line 191 of file mindsensors-pressure.h.


Variable Documentation

Array to hold I2C reply data

Definition at line 72 of file mindsensors-pressure.h.

Array to hold I2C command data

Definition at line 71 of file mindsensors-pressure.h.