NA
Fork of BMA180 by
Embed:
(wiki syntax)
Show/hide line numbers
BMA180.h
00001 #include "mbed.h" 00002 #ifndef MBED_BMA180_H 00003 #define MBED_BMA180_H 00004 00005 /******************DEFINED REGISTERS******************/ 00006 #define CHIPID 0x00 00007 #define VERSION 0x01 00008 #define ACCXLSB 0x02 00009 #define ACCXMSB 0x03 00010 #define ACCYLSB 0x04 00011 #define ACCYMSB 0x05 00012 #define ACCZLSB 0x06 00013 #define ACCZMSB 0x07 00014 #define TEMP 0x08 00015 #define CTRL_REG0 0x0D 00016 #define BWTCS 0x20 00017 #define DIS_I2C 0x27 // bit0 must be 1 for SPI 00018 #define CTRL_REG3 0x21 // bit1 = new_data_int 00019 #define RESET 0x10 // soft reset 00020 #define RANGE 0x35 // 2g = 010 00021 00022 class BMA180 { 00023 public: 00024 BMA180(PinName _sdi, PinName _sdo, PinName _sck, PinName _cs, PinName _interrupt); 00025 int validate(char idAddress, char verAddress); 00026 void initBMA180(void); 00027 void reset(void); 00028 void readAxis(void); 00029 void writeReg(uint8_t address, char data); 00030 char readReg(uint8_t address); 00031 void disInt(void); 00032 00033 private: 00034 SPI spi; 00035 DigitalOut _csb; 00036 DigitalOut _interrupt; 00037 }; 00038 00039 #endif
Generated on Sun Jul 17 2022 02:58:08 by 1.7.2