You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

  1. /*
  2. * @Author: sunlight 2524828700@qq.com
  3. * @Date: 2024-09-12 21:05:22
  4. * @LastEditors: sunlight 2524828700@qq.com
  5. * @LastEditTime: 2024-09-23 13:22:31
  6. * @FilePath: \auxiliary_addition\Usr\opration\core.c
  7. * @Description:
  8. */
  9. #include "core.h"
  10. #include "./Processer/tjc_screen_process.h"
  11. #include "./Processer/tjc_screen_receive.h"
  12. #include "module/feite_servo/servo_driver.h"
  13. #include "module/feite_servo/servo_package_process.h"
  14. #include "module/feite_servo/servo_reg_map.h"
  15. #include "tim.h"
  16. #include "time_slice/time_slice.h"
  17. #include "usart.h"
  18. #include "zgpio.h"
  19. static uint32_t ticktime_sleep;
  20. static uint8_t data = 1000;
  21. void core_init(void) {
  22. HAL_TIM_Base_Start_IT(&htim2);
  23. tjc_process_init();
  24. // HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, SET);
  25. servo_uart_init(&huart3);
  26. servo_drive_single(4, kRegServoAcc, W_DATA, 200, 1);
  27. servo_drive_single(4, kRegServoRunSpeed, W_DATA, 1000, 1);
  28. }
  29. static int i = 0;
  30. void core_loop(void) {
  31. if (GetFlag(tjc_process)) {
  32. tjc_processe();
  33. ClearFlag(tjc_process);
  34. }
  35. if (GetFlag(debug_light)) {
  36. debuglightloop();
  37. ClearFlag(debug_light);
  38. }
  39. if (GetFlag(low_power)) {
  40. // Power_SleepMode();
  41. servo_drive_single(4, kRegServoTargetPos, W_DATA,&i, 1); // ���Գ���
  42. if (i > 2000)
  43. i -= 50;
  44. else
  45. i += 50;
  46. // Power_StopMode();
  47. // Power_StandByMode();
  48. ClearFlag(low_power);
  49. }
  50. // printf("printf\n");
  51. }
  52. void core_main() {
  53. core_init();
  54. while (1) {
  55. core_loop();
  56. }
  57. }