drv_sensors.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-05-08 flaybreak add sensor port file
  9. */
  10. #include <board.h>
  11. #ifdef BSP_USING_ICM20608
  12. #include <sensor_inven_mpu6xxx.h>
  13. static int rt_hw_icm20608_port(void)
  14. {
  15. struct rt_sensor_config cfg;
  16. cfg.intf.dev_name = "i2c3";
  17. cfg.intf.type = RT_SENSOR_INTF_I2C;
  18. cfg.intf.arg = (void *)MPU6XXX_ADDR_DEFAULT;
  19. cfg.irq_pin.pin = PIN_IRQ_PIN_NONE;
  20. rt_hw_mpu6xxx_init("icm", &cfg);
  21. return RT_EOK;
  22. }
  23. INIT_ENV_EXPORT(rt_hw_icm20608_port);
  24. #endif /* BSP_USING_ICM20608 */
  25. #ifdef BSP_USING_AP3216C
  26. #include <sensor_lsc_ap3216c.h>
  27. static int rt_hw_ap3216c_port(void)
  28. {
  29. struct rt_sensor_config cfg;
  30. cfg.intf.dev_name = "i2c3";
  31. cfg.intf.type = RT_SENSOR_INTF_I2C;
  32. cfg.intf.arg = RT_NULL;
  33. cfg.irq_pin.pin = PIN_IRQ_PIN_NONE;
  34. rt_hw_ap3216c_init("ap3216c", &cfg);
  35. return RT_EOK;
  36. }
  37. INIT_ENV_EXPORT(rt_hw_ap3216c_port);
  38. #endif /* BSP_USING_AP3216C */
  39. #ifdef BSP_USING_AHT10
  40. #include <sensor_asair_aht10.h>
  41. static int rt_hw_aht10_port(void)
  42. {
  43. struct rt_sensor_config cfg;
  44. cfg.intf.dev_name = "i2c4";
  45. cfg.intf.type = RT_SENSOR_INTF_I2C;
  46. cfg.intf.arg = (void *)AHT10_I2C_ADDR;
  47. cfg.irq_pin.pin = PIN_IRQ_PIN_NONE;
  48. rt_hw_aht10_init("aht10", &cfg);
  49. return RT_EOK;
  50. }
  51. INIT_ENV_EXPORT(rt_hw_aht10_port);
  52. #endif /* BSP_USING_AHT10 */