Modular Electronics  0.1
 All Classes Namespaces Functions Variables Pages
tetra_dac.h
1 // Class for tetraDac
2 // Copyright (C) 2018 Carlos Kometter
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 
17 #ifndef TETRADAC_h_
18 #define TETRADAC_h_
19 
20 // #include "board.h"
21 #include "AD5791.h"
22 #include "eeprom.h"
23 
31 class TetraDac : public DacSpi {
32  private:
33  static const uint8_t n_channels_ = 4;
34  AD5791 dacs_[n_channels_];
35  EepromSpi eeprom;
36  public:
37  TetraDac(void) = default;
48  TetraDac(uint8_t dac_sync_pins[n_channels_], uint8_t eeprom_sync_pin,
49  uint8_t dac_spi_bus_config_pin, uint8_t eeprom_spi_bus_config_pin,
50  uint8_t ldac_pin, double full_scale = 10.0,
51  uint8_t slot_number = 0);
55  uint8_t Begin(void);
59  uint8_t Initialize(void);
63  uint8_t SetVoltage(uint8_t channel, double voltage,
64  bool update_outputs = true);
68  uint8_t GetVoltage(uint8_t channel);
72  void UpdateAnalogOutputs(void);
73 };
74 #endif
uint8_t GetVoltage(uint8_t channel)
Definition: tetra_dac.cpp:51
Definition: dac.h:35
void UpdateAnalogOutputs(void)
Definition: tetra_dac.cpp:56
uint8_t SetVoltage(uint8_t channel, double voltage, bool update_outputs=true)
Definition: tetra_dac.cpp:45
uint8_t Initialize(void)
Definition: tetra_dac.cpp:38
Definition: tetra_dac.h:31
Definition: eeprom.h:30
uint8_t Begin(void)
Definition: tetra_dac.cpp:30
Definition: AD5791.h:29