hmc5883_sample.c 650 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-03-10 MyGuo the first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdbg.h> // LOG_E
  12. #include "hmc5883.h"
  13. #include "sensor_intf_hmc5883.h"
  14. #include "hmc5883_sample.h"
  15. struct hmc5883_device *mag;
  16. void mag_thread_entry(void* parameter)
  17. {
  18. struct rt_sensor_config cfg;
  19. cfg.intf.dev_name = "i2c1";
  20. cfg.intf.user_data = (void *)HMC5883_ADDR;
  21. rt_hw_hmc5883_init("hmc", &cfg);
  22. while (1)
  23. {
  24. rt_thread_delay(1000);
  25. }
  26. }