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.
ADXL345sb.h
00001 #ifndef ADXL345sb_H 00002 #define ADXL345sb_H 00003 00004 #include "mbed.h" 00005 00006 //register codes 00007 #define DEVID 0x00 00008 #define THRESH_TAP 0x1D 00009 #define OFSX 0x1E 00010 #define OFSY 0x1F 00011 #define OFSZ 0x20 00012 #define DUR 0x21 00013 #define LATENT 0x22 00014 #define WINDOW 0x23 00015 #define THRESH_ACT 0x24 00016 #define THRESH_INACT 0x25 00017 #define TIME_INACT 0x26 00018 #define ACT_INACT_CTL 0x27 00019 #define THRESH_FF 0x28 00020 #define TIME_FF 0x29 00021 #define TAP_AXES 0x2A 00022 #define ACT_TAP_STATUS 0x2B 00023 #define BW_RATE 0x2C 00024 #define POWER_CTL 0x2D 00025 #define INT_ENABLE 0x2E 00026 #define INT_MAP 0x2F 00027 #define INT_SOURCE 0x30 00028 #define DATA_FORMAT 0x31 00029 #define DATAX0 0x32 00030 #define DATAX1 0x33 00031 #define DATAY0 0x34 00032 #define DATAY1 0x35 00033 #define DATAZ0 0x36 00034 #define DATAZ1 0x37 00035 #define FIFO_CTL 0x38 00036 #define FIFO_STATUS 0x39 00037 00038 class ADXL345sb{ 00039 00040 public: 00041 ADXL345sb(PinName mosi, PinName miso, PinName sck, PinName cs); 00042 int adxlread(int address); 00043 void adxlmultibyteread(int address, int numOfBytes, unsigned char *buf); 00044 void adxlreadXYZ(float *buf); 00045 void adxlwrite(int address, int data); 00046 00047 private: 00048 SPI spi_; 00049 DigitalOut nCS_; 00050 }; 00051 #endif
Generated on Mon Jul 18 2022 03:42:13 by
1.7.2