選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

39 行
1.5KB

  1. #ifndef AnalogBinLogger_h
  2. #define AnalogBinLogger_h
  3. //------------------------------------------------------------------------------
  4. // First block of file.
  5. struct metadata_t {
  6. unsigned long adcFrequency; // ADC clock frequency
  7. unsigned long cpuFrequency; // CPU clock frequency
  8. unsigned long sampleInterval; // Sample interval in CPU cycles.
  9. unsigned long recordEightBits; // Size of ADC values, nonzero for 8-bits.
  10. unsigned long pinCount; // Number of analog pins in a sample.
  11. unsigned long pinNumber[123]; // List of pin numbers in a sample.
  12. };
  13. //------------------------------------------------------------------------------
  14. // Data block for 8-bit ADC mode.
  15. const size_t DATA_DIM8 = 508;
  16. struct block8_t {
  17. unsigned short count; // count of data values
  18. unsigned short overrun; // count of overruns since last block
  19. unsigned char data[DATA_DIM8];
  20. };
  21. //------------------------------------------------------------------------------
  22. // Data block for 10-bit ADC mode.
  23. const size_t DATA_DIM16 = 254;
  24. struct block16_t {
  25. unsigned short count; // count of data values
  26. unsigned short overrun; // count of overruns since last block
  27. unsigned short data[DATA_DIM16];
  28. };
  29. //------------------------------------------------------------------------------
  30. // Data block for PC use
  31. struct adcdata_t {
  32. unsigned short count; // count of data values
  33. unsigned short overrun; // count of overruns since last block
  34. union {
  35. unsigned char u8[DATA_DIM8];
  36. unsigned short u16[DATA_DIM16];
  37. } data;
  38. };
  39. #endif // AnalogBinLogger_h