OE - Pi  1.1
 All Classes Namespaces Functions
OpenElectrons_L3GD20.L3GD20 Class Reference

L3GD20: this class provides functions for the gyroscope of the LSM303 IC for read and write operations. More...

Inheritance diagram for OpenElectrons_L3GD20.L3GD20:
OpenElectrons_i2c.OpenElectrons_i2c

Public Member Functions

def __init__
 Initialize the class with the i2c address of the L3GD20 and set function parameters for gyro. More...
 
def accel12
 Interprets signed 12-bit Gyro component from list. More...
 
def int16
 Interprets signed 16-bit Gyro component from list. More...
 
def rangeSelect
 Sets the range for gyro. More...
 
def measureGyroSum
 Reads the gyro sum value. More...
 
def read
 Reads the x,y,z gyro values. More...
 
def configL3GD20
 Writes to a register to configure gyro. More...
 
def deg2rad
 Converts degrees to radian. More...
 
def rad2deg
 Converts radian to degrees. More...
 
def measureGyro
 Reads the heading/angle value of the gyro. 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...
 

Public Attributes

 gyroScaleFactor
 
 gyroSampleCount
 
 gyroLastMesuredTime
 
- Public Attributes inherited from OpenElectrons_i2c.OpenElectrons_i2c
 address
 
 bus
 

Static Public Attributes

int XAXIS = 0
 
int YAXIS = 1
 
int ZAXIS = 2
 
tuple GYRO_ADDRESS = (0xD6)
 
int L3G20D_WHO_AM_I = 0x0F
 
int L3G20D_CTRL_REG1 = 0x20
 
int L3G20D_CTRL_REG2 = 0x21
 
int L3G20D_CTRL_REG3 = 0x22
 
int L3G20D_CTRL_REG4 = 0x23
 
int L3G20D_CTRL_REG5 = 0x24
 
int L3G20D_REFERENCE = 0x25
 
int L3G20D_OUT_TEMP = 0x26
 
int L3G20D_STATUS_REG = 0x27
 
int L3G20D_OUT_X_L = 0x28
 
int L3G20D_OUT_X_H = 0x29
 
int L3G20D_OUT_Y_L = 0x2A
 
int L3G20D_OUT_Y_H = 0x2B
 
int L3G20D_OUT_Z_L = 0x2C
 
int L3G20D_OUT_Z_H = 0x2D
 
int L3G20D_FIFO_CTRL_REG = 0x2E
 
int L3G20D_FIFO_SRC_REG = 0x2F
 
int L3G20D_INT1_CFG = 0x30
 
int L3G20D_INT1_SRC = 0x31
 
int L3G20D_INT1_THS_XH = 0x32
 
int L3G20D_INT1_THS_XL = 0x33
 
int L3G20D_INT1_THS_YH = 0x34
 
int L3G20D_INT1_THS_YL = 0x35
 
int L3G20D_INT1_THS_ZH = 0x36
 
int L3G20D_INT1_THS_ZL = 0x37
 
int L3G20D_INT1_DURATION = 0x38
 
float RAD_TO_DEG = 57.29578
 
float M_PI = 3.14159265358979323846
 
int gyroSampleCount = 0
 
list gyroSample = [0,0,0]
 
int gyroHeading = 0
 
tuple gyroLastMesuredTime = time.time()
 
float gyroScaleFactor = 0.07
 

Additional Inherited Members

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

Detailed Description

L3GD20: this class provides functions for the gyroscope of the LSM303 IC for read and write operations.

Constructor & Destructor Documentation

def OpenElectrons_L3GD20.L3GD20.__init__ (   self,
  gyro_address = GYRO_ADDRESS 
)

Initialize the class with the i2c address of the L3GD20 and set function parameters for gyro.

Parameters
selfThe object pointer.
i2c_addressAddress of your gyro.

Member Function Documentation

def OpenElectrons_L3GD20.L3GD20.accel12 (   self,
  list,
  idx 
)

Interprets signed 12-bit Gyro component from list.

Parameters
selfThe object pointer.
arrayThe list of gyro data generated from the L3GD20
idxThe location of the desired element in the list
def OpenElectrons_L3GD20.L3GD20.configL3GD20 (   self,
  register,
  r_value 
)

Writes to a register to configure gyro.

Parameters
selfThe object pointer.
registerThe register address to write to the L3GD20.
r_valueThe value to write to the register.
def OpenElectrons_L3GD20.L3GD20.deg2rad (   self,
  d_value 
)

Converts degrees to radian.

Parameters
selfThe object pointer.
d_valueThe degree value to convert to radian.
def OpenElectrons_L3GD20.L3GD20.int16 (   self,
  list,
  idx 
)

Interprets signed 16-bit Gyro component from list.

Parameters
selfThe object pointer.
arrayThe list of gyro data generated from the L3GD20
idxThe location of the desired element in the list
def OpenElectrons_L3GD20.L3GD20.measureGyro (   self)

Reads the heading/angle value of the gyro.

Parameters
selfThe object pointer.
def OpenElectrons_L3GD20.L3GD20.measureGyroSum (   self)

Reads the gyro sum value.

Parameters
selfThe object pointer.
def OpenElectrons_L3GD20.L3GD20.rad2deg (   self,
  r_value 
)

Converts radian to degrees.

Parameters
selfThe object pointer.
r_valueThe radian value to convert to degrees.
def OpenElectrons_L3GD20.L3GD20.rangeSelect (   self,
  range 
)

Sets the range for gyro.

Parameters
selfThe object pointer.
rangeThe range to set the gyro.
def OpenElectrons_L3GD20.L3GD20.read (   self)

Reads the x,y,z gyro values.

Parameters
selfThe object pointer.

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