Loading...
Searching...
No Matches
max11635.h
Go to the documentation of this file.
1
17#pragma once
18
19#include <stddef.h>
20#include <stdint.h>
21
22namespace max11635 {
23
25constexpr uint8_t kChannels = 4;
27constexpr uint32_t kMaxTimedBurstHz = 20000;
29constexpr uint32_t kMaxBurstHz = 300000;
30
32void begin();
33
40void setAveraging(uint8_t samples);
41
46uint8_t averaging();
47
53uint16_t read(uint8_t channel);
54
61bool scan(uint8_t last_channel, uint16_t* results);
62
74bool readDifferential(uint8_t pair, bool bipolar, int16_t* code);
75
90uint32_t startBurst(uint8_t channel, uint16_t* buffer, size_t count, uint32_t sample_rate_hz);
91
96bool burstDone();
97
99void stopBurst();
100
101} // namespace max11635
constexpr uint8_t kChannels
Number of input channels (AIN0-AIN3).
Definition max11635.h:25
uint8_t averaging()
Current averaging setting.
uint16_t read(uint8_t channel)
Runs one conversion (averaged if setAveraging() is on).
constexpr uint32_t kMaxTimedBurstHz
Fastest burst taken with a timer interrupt (clock mode 00), in samples per second.
Definition max11635.h:27
uint32_t startBurst(uint8_t channel, uint16_t *buffer, size_t count, uint32_t sample_rate_hz)
Starts sampling one channel at a fixed rate into buffer, in the background.
bool readDifferential(uint8_t pair, bool bipolar, int16_t *code)
True differential conversion of a channel pair, both inputs sampled at once.
bool scan(uint8_t last_channel, uint16_t *results)
Converts channels 0 to last_channel in one scan, a few µs apart.
void setAveraging(uint8_t samples)
Sets how many conversions the chip averages for each result.
bool burstDone()
Whether the burst has finished; tidies up the chip and SPI when it has.
void begin()
Configures SPI0 and the control pins, resets the ADC and applies the averaging setting....
constexpr uint32_t kMaxBurstHz
Fastest burst (clock mode 11, SCLK = 16 x rate, at most 4.8 MHz), in samples per second.
Definition max11635.h:29
void stopBurst()
Stops a running burst; the buffer's contents are then not valid.