Shield Code 6.0
Loading...
Searching...
No Matches
Pip.hpp
Go to the documentation of this file.
1
14#ifndef PIP_HPP
15#define PIP_HPP
16#include <Arduino.h>
17#include <Wire.h>
18#include <Max1148.hpp>
19//default sweep parameters. can be modified with the constructor.
20#define SWEEP_DEFAULT_DELAY 1000
21#define SWEEP_DEFAULT_AVG_NUM 25
22#define SWEEP_DEFAULT_SAMPLES 28
23#define SWEEP_DEFAULT_MIN 0
24#define SWEEP_DEFAULT_MAX 4095
25#define SWEEP_MAX_SAMPLES 256
26#define DEFAULT_ADC_CHANNEL 0;
27
28#define DAC_PIN DAC0
29
33class Pip{
34 friend class PipController;
35 private:
39 uint8_t dac_pin;
52 uint16_t avg_num;
56 uint16_t num_samples;
60 uint16_t sweep_min;
61 uint16_t sweep_max;
62
69 void clear_data(uint16_t data[], uint16_t size);
70
71 uint16_t read_adc();
72 public:
77 Pip(int delay_us, uint16_t avg_num, uint16_t num_samples, uint16_t min, uint16_t max, uint8_t dac_pin, Max1148& adc);
82
83
84};
85#endif
Header file for the Max1148 library for Dartmouth's 317 Lab. Manages ADC communication through SPI.
#define SWEEP_MAX_SAMPLES
Definition: Pip.hpp:25
Manages interfacing with Max1148 ADC.
Definition: Max1148.hpp:57
Manages simultaneous sweep for two Pip sensors. A bit hacky, but allows easily managing simultaneous ...
Manages the Pip sensor sweep and associated data.
Definition: Pip.hpp:33
uint16_t sweep_max
Definition: Pip.hpp:61
Max1148 & adc
The ADC object for the Pip to use. Assuming each pip will use a different ADC channel.
Definition: Pip.hpp:48
uint16_t sweep_min
The minimum and maximum values for the sweep.
Definition: Pip.hpp:60
int delay_us
The delay between steps in the sweep. Measured in microseconds.
Definition: Pip.hpp:43
uint8_t dac_pin
The pin for the DAC output.
Definition: Pip.hpp:39
uint16_t avg_num
The number of samples to average when querying the ADC.
Definition: Pip.hpp:52
uint16_t read_adc()
Definition: Pip.cpp:20
uint16_t num_samples
The number of samples to take during the sweep. AKA the number of steps in the sweep.
Definition: Pip.hpp:56
uint16_t data[SWEEP_MAX_SAMPLES]
The data array for the sweep.
Definition: Pip.hpp:81
void clear_data(uint16_t data[], uint16_t size)
Clears the data array.
Definition: Pip.cpp:14