-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathScanner.h
More file actions
89 lines (69 loc) · 1.89 KB
/
Scanner.h
File metadata and controls
89 lines (69 loc) · 1.89 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
// Scanner.h
// Author A Michel
// Date 25/08/15
// Lego2nano 2015
/**
Definition of Scanner.
This class controls the scanning process and stores the pixel values.
It uses a controller to send commands to a TLC5620CN digital-to-analog chip and a SignalSampler
to collect pixel data. It uses an instance of RTx to send the data to the interface.
It also holds instance variables to keep track of the scanning time, scanning in progress and
line count for information purposes.
**/
#ifndef _SCANNER_h
#define _SCANNER_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include "DACController.h"
#include "SignalSampler.h"
#include "RTx.h"
#define SCANNER_VERSION "0.0.1"
class Scanner
{
private:
// DAC controller
DACController controller;
// Sampler
SignalSampler sampler;
// RTx (com)
RTx phone;
// number of lines scanned during the
// scanning process.
unsigned int linesScanned;
// start time at Scanner.start()
unsigned long startTime;
// end time at Scanner.stop() or when the scanning finished.
unsigned long endTime;
// the length of the line (number of pixels)
int lineLength;
// pointer to the pixel array
int *pixels;
// indicates if scanning is in progress.
bool scanning;
// scans one line (trace and retrace) storing the data in the pixels array.
int scanLine();
protected:
public:
// Constructor
Scanner(const DACController&, const SignalSampler&, const RTx&, const int lineLength);
// destructor
~Scanner();
// resets all parameters. Should call controller.reset(), sampler.reset() and rtx.reset()
void reset();
// start scanning sequential scan
int start();
// stops the scanning processs
int stop();
// starts sending continous stream of data
int stream();
// update a param value
void setParam(String param, String value);
// get lapsed time
unsigned long getLapsedTime();
//
void invertChannels();
};
#endif