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.

39 satır
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 bytes
  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 bytes
  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 bytes
  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