usr.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "usr.h"
  2. #include "system.h"
  3. #include "nrf_delay.h"
  4. #include "hal_ble_client.h"
  5. #include "hal_ble_host.h"
  6. #include "ble_comm.h"
  7. #include "hal_ws2812.h"
  8. #include "drv_lsm6ds3tr.h"
  9. __weak void usr1_Init(void)
  10. {
  11. // USR_SetName();
  12. slave_init(BLE_Client_Push);
  13. host_init(BLE_Host_Push);
  14. }
  15. void PRE_Init(void)
  16. {
  17. usr1_Init();
  18. Time_Init();
  19. }
  20. void IMU_Data_cb1(void* handle)
  21. {
  22. lsm6ds3tr_c_handle_t* target = (lsm6ds3tr_c_handle_t*)handle;
  23. nrf_gpio_pin_write(19,1);
  24. SEGGER_RTT_printf(0,"gry[0]=%d,gry[1]=%d,gry[2]=%d\r\n",target->gry[0],target->gry[1],target->gry[2]);
  25. SEGGER_RTT_printf(0,"acc[0]=%d,acc[1]=%d,acc[2]=%d\r\n",target->acc[0],target->acc[1],target->acc[2]);
  26. SEGGER_RTT_printf(0,"mag[0]=%d,mag[1]=%d,mag[2]=%d\r\n",target->mag[0],target->mag[1],target->mag[2]);
  27. nrf_gpio_pin_write(19,0);
  28. }
  29. void IMU_Data_cb2(void* handle)
  30. {
  31. }
  32. void IMU_Data_cb3(void* handle)
  33. {
  34. }
  35. void USR_Init(void)
  36. {
  37. nrf_gpio_cfg_output(19); nrf_gpio_pin_write(19,0); //µçÔ´¿ª¹Ø
  38. //Add your code here...
  39. WS2812_Initialize();
  40. LSM6DS3TR_C_Initialize();
  41. LSM6DS3TR_C_Regist(IMU_Data_cb1);
  42. LSM6DS3TR_C_Regist(IMU_Data_cb2);
  43. LSM6DS3TR_C_Regist(IMU_Data_cb3);
  44. }