Altimeter/ Barometer/ Temperature sensor

class MPL3115A2.MPL3115A2[source]

Bases: object

ActiveMode()[source]

Put the sensor in active mode.

Parameters:none
Returns:none
AltimeterMode()[source]

Sets the mode in Altimeter mode.

Parameters:none
Returns:none
BarometerMode()[source]

Sets the sensor in Barometer mode.

Parameters:none
Returns:none
CofigureInterruptPin(interrupt, pin)[source]

Configure the interrupt pin.

Parameters:
  • interrupt – Type of interrupt
  • pin – Only pin 1 is used
Returns:

none

EnableEventFlags()[source]
Enables the pressure and temp measurement event flags so that we can
test against them. This is recommended in datasheet during setup.
Parameters:none
Returns:none
GetAltitude()[source]

Returns the number of meters above sea level.

Parameters:none
Returns:altitude as a float
GetID()[source]

Returns the Factory Sensor ID.

Parameters:none
Returns:id - Factory ID
GetMode()[source]

Return a bool value indicating wheather the sensor is in Active or Standby mode.

Parameters:none
Returns:Mode - 1 if in Active mode, 0 otherwise
OversampleRate(sampleRate)[source]

Sets the ovsersampling rate.

Parameters:sampleRate – sampleRate is from 0 to 7
Returns:none
ReadAltitude()[source]

Returns the number of meters above sea level.

Parameters:none
Returns:altitude as a float
ReadBarometricPressure()[source]

Reads the current pressure in Pa.

Parameters:none
Returns:current pressure or -1 if no new data is available
ReadByte(address, reg)[source]

Read byte value from register.

Parameters:
  • address – Sensor address
  • reg – Register address
Returns:

byte read from register

ReadByteArray(address, reg, buffer, length)[source]

Read a byte array from the sensor.

Parameters:
  • address – Sensor address
  • reg – Register address
  • buffer – Data buffer
  • length – Data length
Returns:

array - Byte array

ReadTemperature()[source]

Reads the current temperature in degrees Celcius.

Parameters:none
Returns:temp - Returns temperature as a float.
SetAcquisitionTimeStep(ST_Value)[source]

Set the acquisition time step.

Parameters:ST_Value – Time Step value
Returns:none
StandbyMode()[source]

Puts the sensor in standby mode. This is needed whenever one wants to modify the control registers.

Parameters:none
Returns:none
ToggleOneShot()[source]
Clears then sets the OST bit which causes the sensor to immediately take another reading
Needed to sample faster than 1Hz.
Parameters:none
Returns:none
TwosToInt(val, len)[source]

Convert twos complement to integer.

Parameters:
  • val
  • len
Returns:

complement - integer value of two’s complement

WriteByte(address, reg, data)[source]

Write byte value from register.

Parameters:
  • address – Sensor address
  • reg – Register address
  • data – Register value
Returns:

none

WriteByteArray(address, reg, buffer)[source]

Writes an array of bytes to the sensor.

Parameters:
  • address – Sensor address
  • reg – Register address
  • buffer – Data buffer
  • length – buffer length
Returns:

none

Previous topic

1Kbit EEPROM

Next topic

1.8 inch display

This Page