-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDACController.h
More file actions
101 lines (76 loc) · 1.9 KB
/
DACController.h
File metadata and controls
101 lines (76 loc) · 1.9 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// DACWriter.h
// Author A Michel
// Date 25/08/15
// lego2nano 2015
#ifndef _DACCONTROLLER_h
#define _DACCONTROLLER_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#define DAC_TLC_5620_CONTROLLER "0.0.1"
// Defines a digital to analog controller for TLC5620CN
class DACController {
private:
// Number of increments per pixel
int stepSize;
// number of pixels in line
int lineSize;
// amplification
bool useRNG;
// data pin number
int dataPin;
// clock pin number
int clockPin;
// load pin number
int loadPin;
// ldac pin number
int ldacPin;
// the current pixel position in the image.
// each pixel has a unique x,yi position.
unsigned int currentStep;
// sends an on bit to the chip
int setBitOn();
// sends an off bit to the chip
int setBitOff();
// load DAC
int loadDAC();
// send data to dac.
int go(int, int);
// set the x & y coordinates
int setCoordinates();
// current x position in the matrix
int currentX;
// current y position in the matrix
int currentY;
// not used; intended to store height information.
int currentZ;
// scan 90-degree angle
bool invertChannels;
public:
// constructor
DACController(int, int, int, int, int, int, bool);
// destructor
~DACController();
// reset parameters
unsigned int reset(int, int, int, int, int, int, bool);
// increase voltage by one step (8 bit steps given by chip)
unsigned int increaseVoltage();
// decrease voltage by one step
unsigned int decreaseVoltage();
// go to end of current line
// returns current point in matrix.
unsigned int eol();
// return line size.
int getLineSize();
// move to the first pixel of the new line.
unsigned int nextLine();
// reset to x & y coordinates to 0,0
unsigned int reset();
// return current voltage for selected channel (A - x, B - y, C - z).
int getVoltage(int);
// invert channel A(X) & B(Y)
void invert();
};
#endif