This is an old revision of the document!
The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface. The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing appli-cations, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0°.
The goal of this project (Microcontroller No-OS) is to be able to provide reference projects for lower end processors, which can't run Linux, or aren't running a specific operating system, to help those customers using microcontrollers with ADI parts. Here you can find a generic driver which can be used as a base for any microcontroller platform and also specific drivers for Renesas platforms.
HW Platform(s):
The driver contains two parts:
The Communication Driver has a standard interface, so the ADXL345 driver can be used exactly as it is provided. There are three functions which are called by the ADXL345 driver:
Driver architecture
The implementation of these three functions depends on the used microcontroller.
The driver for ADXL345 contains functions for reading or writing any of the registers, for placing the device into standby or measure mode, for enable or disable various types of events detection, etc.
The following functions are implemented in this version of ADXL345 driver:
Function | Description |
---|---|
void ADXL345_SetRegisterValue(unsigned char registerAddress, unsigned char registerValue) | Writes data into a register. |
unsigned char ADXL345_GetRegisterValue(unsigned char registerAddress) | Reads the value of a register. |
unsigned char ADXL345_Init(void) | Initializes the I2C peripheral and checks if the ADXL345 part is present. |
void ADXL345_SetPowerMode(unsigned char pwrMode) | Places the device into standby/measure mode. |
void ADXL345_GetXyz(unsigned short* x, unsigned short* y, unsigned short* z) | Reads the output data of each axis. |
void ADXL345_SetTapDetection(unsigned char tapType, unsigned char tapAxes, unsigned char tapDur, unsigned char tapLatent, unsigned char tapWindow, unsigned char tapThresh, unsigned char tapInt) | Enables/disables the tap detection. |
void ADXL345_SetActivityDetection(unsigned char actOnOff, unsigned char actAxes, unsigned char actAcDc, unsigned char actThresh, unsigned char actInt) | Enables/disables the activity detection. |
void ADXL345_SetInactivityDetection(unsigned char inactOnOff, unsigned char inactAxes, unsigned char inactAcDc, unsigned char inactThresh, unsigned char inactTime, unsigned char inactInt) | Enables/disables the inactivity detection. |
void ADXL345_SetFreeFallDetection(unsigned char ffOnOff, unsigned char ffThresh, unsigned char ffTime, unsigned char ffInt) | Enables/disables the free-fall detection. |
void ADXL345_SetOffset(unsigned char xOffset, unsigned char yOffset, unsigned char zOffset) | Calibrates the accelerometer. |
This section contains a description of the steps required to run the ADXL345 demonstration project on a Renesas RX62N platform.
For this project it was used the ADXL345 part installed on the Renesas Demonstration Kit (RDK) for RX62N.
This section presents the steps for developing a software application that will run on the Renesas Demo Kit for RX62N for controlling and monitoring the operation of the ADI part.
This section contains a description of the steps required to run the ADF4118 demonstration project on a Renesas RL78G13 platform.
For this project it was used the ADXL345 part installed on the Renesas Demonstration Kit (RDK) for RL78G13.