OE - Pi  1.1
 All Classes Namespaces Functions
OpenElectrons_LSM303D.LSM303D Class Reference

LSM303D: this class provides functions for accelerometer and magnetomter of the LSM303 IC for read and write operations. More...

Inheritance diagram for OpenElectrons_LSM303D.LSM303D:
OpenElectrons_i2c.OpenElectrons_i2c

Public Member Functions

def __init__
 Initialize the class with the i2c address of the LSM303D and set function parameters for accleerometer and magnetometer. More...
 
def readAcclX
 Interprets signed 12-bit accelerometer value along x-axis. More...
 
def readAcclY
 Interprets signed 12-bit accelerometer value along y-axis. More...
 
def readAcclZ
 Interprets signed 12-bit accelerometer value along z-axis. More...
 
def readAcclAll
 Reads the accelerometer x, y, z values. More...
 
def readMagX
 Interprets signed 16-bit magnetometer value along x-axis. More...
 
def readMagY
 Interprets signed 16-bit magnetometer along y-axis. More...
 
def readMagZ
 Interprets signed 16-bit magnetometer along z-axis. More...
 
def readMagAll
 Reads the magnetometer x, y, z values. More...
 
def setMagnetGain
 Writes a desired gain value for the magnetometer. More...
 
- Public Member Functions inherited from OpenElectrons_i2c.OpenElectrons_i2c
def __init__
 Initialize the class with the i2c address of your device. More...
 
def errMsg
 Prints an error message if a read error is detected. More...
 
def writeByte
 Write a byte to your i2c device at a given location. More...
 
def readByte
 Read an unsigned byte from your i2c device at a given location. More...
 
def simpleWriteByte
 Write a byte to your i2c device at a given location. More...
 
def simpleReadByte
 Read an unsigned byte from your i2c device at a given location. More...
 
def readByteSigned
 Read a signed byte from your i2c device at a given location. More...
 
def readArray
 Read a byte array from your i2c device starting at a given location. More...
 
def writeArray
 Write a byte array from your i2c device starting at a given location. More...
 
def readString
 Read a string from your i2c device starting at a given location. More...
 
def readIntegerBE
 Read an unsigned 16 bit integer from your i2c device from a given location. More...
 
def readInteger
 Read an unsigned 16 bit integer from your i2c device from a given location. More...
 
def readIntegerSignedBE
 Read a signed 16 bit integer from your i2c device from a given location. More...
 
def readIntegerSigned
 Read a signed 16 bit integer from your i2c device from a given location. More...
 
def readLongBE
 Read an unsigned 32bit integer from your i2c device from a given location. More...
 
def readLong
 Read an unsigned 32bit integer from your i2c device from a given location. More...
 
def readLongSignedBE
 Read a signed 32bit integer from your i2c device from a given location. More...
 
def readLongSigned
 Read a signed 32bit integer from your i2c device from a given location. More...
 
def GetFirmwareVersion
 Read the firmware version of the i2c device. More...
 
def GetVendorName
 Read the vendor name of the i2c device. More...
 
def GetDeviceId
 Read the i2c device id. More...
 

Static Public Attributes

tuple LSM303D_ADDRESS = (0x3A)
 
int ACCEL_REG1 = 0x20
 
int ACCEL_REG4 = 0x23
 
int ACCEL_X_L = 0x28
 
int ACCEL_X_H = 0x29
 
int ACCEL_Y_L = 0x2A
 
int ACCEL_Y_H = 0x2B
 
int ACCEL_Z_L = 0x2C
 
int ACCEL_Z_H = 0x2D
 
int MAG_REG5 = 0x24
 
int MAG_REG6 = 0x25
 
int MAG_REG7 = 0x26
 
int MAG_X_L = 0x08
 
int MAG_X_H = 0x09
 
int MAG_Y_L = 0x0A
 
int MAG_Y_H = 0x0B
 
int MAG_Z_L = 0x0C
 
int MAG_Z_H = 0x0D
 
int MAG_G13 = 0x20
 
int MAG_G19 = 0x40
 
int MAG_G25 = 0x60
 
int MAG_G40 = 0x80
 
int MAG_G47 = 0xA0
 
int MAG_G56 = 0xC0
 
int MAG_G81 = 0xE0
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenElectrons_i2c.OpenElectrons_i2c
def pi_rev
 
def which_bus
 
- Public Attributes inherited from OpenElectrons_i2c.OpenElectrons_i2c
 address
 
 bus
 

Detailed Description

LSM303D: this class provides functions for accelerometer and magnetomter of the LSM303 IC for read and write operations.

Constructor & Destructor Documentation

def OpenElectrons_LSM303D.LSM303D.__init__ (   self,
  lsm303d_address = LSM303D_ADDRESS 
)

Initialize the class with the i2c address of the LSM303D and set function parameters for accleerometer and magnetometer.

Parameters
selfThe object pointer.
i2c_addressAddress of your accelerometer.

Member Function Documentation

def OpenElectrons_LSM303D.LSM303D.readAcclAll (   self)

Reads the accelerometer x, y, z values.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readAcclX (   self)

Interprets signed 12-bit accelerometer value along x-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readAcclY (   self)

Interprets signed 12-bit accelerometer value along y-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readAcclZ (   self)

Interprets signed 12-bit accelerometer value along z-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readMagAll (   self)

Reads the magnetometer x, y, z values.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readMagX (   self)

Interprets signed 16-bit magnetometer value along x-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readMagY (   self)

Interprets signed 16-bit magnetometer along y-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.readMagZ (   self)

Interprets signed 16-bit magnetometer along z-axis.

Parameters
selfThe object pointer.
def OpenElectrons_LSM303D.LSM303D.setMagnetGain (   gain = MAG_G13)

Writes a desired gain value for the magnetometer.

Parameters
gainGain value to write to the magnetometer

The documentation for this class was generated from the following file: