SerPlot_drv.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __FILE_SERPLOT_DRV_H__
  2. #define __FILE_SERPLOT_DRV_H__
  3. #include "prj_com.h"
  4. // must be sure that (1+size_of(DAT)*DATNUM_MAX)*SPS*10 < Baud Rate
  5. #define SERPLOT_DATNUM_MAX (5)
  6. #define SERPLOT_PRINT_1FLOAT_1PREAMBLE(f1) \
  7. SerPlot.f.Data[0] = (f1); \
  8. SerPlot_DmaTxAct((char *)&(SerPlot.b.SOP_1P), 1+4*1)
  9. #define SERPLOT_PRINT_2FLOAT_1PREAMBLE(f1, f2) \
  10. SerPlot.f.Data[0] = (f1); \
  11. SerPlot.f.Data[1] = (f2); \
  12. SerPlot_DmaTxAct((char *)&(SerPlot.b.SOP_1P), 1+4*2)
  13. #define SERPLOT_PRINT_3FLOAT_1PREAMBLE(f1, f2, f3) \
  14. SerPlot.f.Data[0] = (f1); \
  15. SerPlot.f.Data[1] = (f2); \
  16. SerPlot.f.Data[2] = (f3); \
  17. SerPlot_DmaTxAct((char *)&(SerPlot.b.SOP_1P), 1+4*3)
  18. #define SERPLOT_PRINT_4FLOAT_1PREAMBLE(f1, f2, f3, f4) \
  19. SerPlot.f.Data[0] = (f1); \
  20. SerPlot.f.Data[1] = (f2); \
  21. SerPlot.f.Data[2] = (f3); \
  22. SerPlot.f.Data[3] = (f4); \
  23. SerPlot_DmaTxAct((char *)&(SerPlot.b.SOP_1P), 1+4*4)
  24. #define SERPLOT_PRINT_5FLOAT_1PREAMBLE(f1, f2, f3, f4, f5) \
  25. SerPlot.f.Data[0] = (f1); \
  26. SerPlot.f.Data[1] = (f2); \
  27. SerPlot.f.Data[2] = (f3); \
  28. SerPlot.f.Data[3] = (f4); \
  29. SerPlot.f.Data[4] = (f5); \
  30. SerPlot_DmaTxAct((char *)&(SerPlot.b.SOP_1P), 1+4*5)
  31. #define SERPLOT_DMATX_OFF (0x0001u)
  32. typedef union {
  33. struct {
  34. uint32_t Preamble;
  35. float Data[SERPLOT_DATNUM_MAX];
  36. } f;
  37. struct{
  38. uint8_t SOP_4P;
  39. uint8_t SOP_3P;
  40. uint8_t SOP_2P;
  41. uint8_t SOP_1P;
  42. } b;
  43. } SerPlot_NxFloat_t;
  44. extern void SerPlot_DmaTxAct(char *Ptr, uint16_t Len);
  45. extern SerPlot_NxFloat_t SerPlot;
  46. #endif