Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LSM303DLHC.h
00001 00002 #ifndef __LSM303DLHC_H 00003 #define __LSM303DLHC_H 00004 #include "mbed.h" 00005 00006 00007 00008 class LSM303DLHC { 00009 public: 00010 /** Create a new interface for an LSM303DLHC 00011 * 00012 * @param sda is the pin for the I2C SDA line 00013 * @param scl is the pin for the I2C SCL line 00014 */ 00015 LSM303DLHC(PinName sda, PinName scl); 00016 00017 00018 /** read the raw accelerometer and compass values 00019 * 00020 * @param ax,ay,az is the accelerometer 3d vector, written by the function 00021 * @param mx,my,mz is the magnetometer 3d vector, written by the function 00022 */ 00023 bool read(float *ax, float *ay, float *az, float *mx, float *my, float *mz); 00024 00025 00026 private: 00027 I2C _LSM303; 00028 00029 00030 float ax, ay, az; 00031 float mx, my, mz; 00032 00033 bool write_reg(int addr_i2c,int addr_reg, char v); 00034 bool read_reg(int addr_i2c,int addr_reg, char *v); 00035 bool recv(char sad, char sub, char *buf, int length); 00036 }; 00037 00038 #endif
Generated on Sat Jul 16 2022 23:33:02 by
1.7.2