STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
adcs_pulse.h
Go to the documentation of this file.
1// // adc.h
2// // Minimal interface for fast multi-channel ADS1263 reads
3
4// #ifndef ADCS_H_
5// #define ADCS_H_
6
7// #include <Arduino.h>
8// #include <ADS126X.h>
9// #include <SPI.h>
10// #include <stdint.h>
11// #include <stddef.h>
12
13// namespace adcs {
14
15// // Sentinels for “skip this setting”
16// static constexpr uint8_t REF_SKIP = 0xFF;
17// static constexpr uint8_t FILT_SKIP = 0xFF;
18
19// // ADC Read Struct
20// struct ReadResult {
21// int32_t raw; // signed ADC code
22// uint32_t sample_time; //Sample read abs time
23// uint32_t read_time_dur; // SPI read time in us. Total time of
24// adc::read() uint32_t conv_time_dur; // Conversion time. Time from
25// startADC to DRDY bool ok; // true if DRDY arrived
26// };
27
28// struct ChannelRead {
29// uint8_t channel;
30// ReadResult result;
31// };
32
33// constexpr size_t MAX_CHANNELS = 10;
34
35// struct AllResults {
36// ChannelRead samples[MAX_CHANNELS]; // outputs of read(chs[i])
37// size_t count; // how many entries are valid
38// uint32_t total_time; // total sweep time (us)
39// uint32_t failures; // number of channels where ok ==
40// false
41// };
42
43// // Call once at startup. Sets up SPI, pins, resets the ADC, waits for DRDY.
44// // Returns true if the ADC responds. Initializes the ADS1263.
45// bool init();
46
47// bool configure(uint8_t negativeReference = REF_SKIP,
48// uint8_t positiveReference = REF_SKIP,
49// bool bypassPGA = false,
50// uint8_t gainPGA = 1,
51// uint8_t chopMode = ADS126X_CHOP_0,
52// uint8_t sincFilter = FILT_SKIP,
53// uint8_t rate = ADS126X_RATE_38400);
54
55// ADS126X& device(void);
56
57// void setChannel(uint8_t channel); // Checks if MUX has changed, if so -> sets
58// new MUX. This uses moloriouses adcread1 rn...
59// // but it should not take up extra time, as
60// no conversion has happened yet
61
62// // Read one channel once, blocking until DRDY.
63// // Returns signed 32-bit raw ADC code and 32-bit unsigned read time
64// ReadResult read(uint8_t channel);
65
66// AllResults readAll(const uint8_t* channels, size_t num_channels);
67
68// } // namespace adcs
69
70// #endif // ADCS_H_