-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAX5144.h
37 lines (32 loc) · 990 Bytes
/
MAX5144.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef MAX5144_H
#define MAX5144_H
/**
* @class MAX5144
* @brief A class to control the MAX5144 DAC via SPI.
*/
class MAX5144 {
public:
/**
* @brief Constructor to initialize MAX5144.
* @param spiNumber SPI bus number (e.g., 0 for /dev/spidev0.x).
* @param spiChannel SPI channel (e.g., 0 or 1 for /dev/spidevX.x).
* @param csPin GPIO pin used for chip select (in BCM format).
* @param speed SPI communication speed (default: 500000 Hz).
* @param mode SPI mode (default: 0).
*/
MAX5144(int spiNumber, int spiChannel, int csPin, int speed = 500000, int mode = 0);
/**
* @brief Destructor to clean up resources.
*/
~MAX5144();
/**
* @brief Sets the DAC output value.
* @param value DAC output value (0-16383).
*/
void setDacOutput(int value);
private:
int csPin; // GPIO pin for chip select
int spiNumber; // SPI bus number
int spiChannel; // SPI channel
};
#endif // MAX5144_H