dev_accel.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /***************************************************************************//**
  2. * @file dev_accel.h
  3. * @brief Accelerometer driver of RT-Thread RTOS for EFM32
  4. * COPYRIGHT (C) 2011, RT-Thread Development Team
  5. * @author onelife
  6. * @version 0.4 beta
  7. *******************************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file
  10. * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
  11. *******************************************************************************
  12. * @section Change Logs
  13. * Date Author Notes
  14. * 2011-07-13 onelife Initial creation for using EFM32 ADC module to
  15. * interface the Freescale MMA7361L
  16. ******************************************************************************/
  17. #ifndef __DEV_ACCEL_H__
  18. #define __DEV_ACCEL_H__
  19. /* Includes ------------------------------------------------------------------*/
  20. /* Exported types ------------------------------------------------------------*/
  21. struct efm32_accel_result_t
  22. {
  23. rt_uint32_t x;
  24. rt_uint32_t y;
  25. rt_uint32_t z;
  26. };
  27. /* Exported constants --------------------------------------------------------*/
  28. /* Exported macro ------------------------------------------------------------*/
  29. #define ACCEL_X_ADC_CH ADC_SCANCTRL_INPUTMASK_CH2
  30. #define ACCEL_Y_ADC_CH ADC_SCANCTRL_INPUTMASK_CH3
  31. #define ACCEL_Z_ADC_CH ADC_SCANCTRL_INPUTMASK_CH4
  32. /* Exported functions ------------------------------------------------------- */
  33. rt_err_t efm_accel_get_data(struct efm32_accel_result_t *data);
  34. rt_err_t efm_accel_auto_zero(rt_tick_t period);
  35. rt_err_t efm_accel_init(void);
  36. #endif /*__DEV_ACCEL_H__ */