forked from nanoframework/nanoFramework.IoT.Device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QtrBase.cs
64 lines (55 loc) · 2.3 KB
/
QtrBase.cs
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Device.Gpio;
namespace Iot.Device.QtrSensors
{
/// <summary>
/// Qtr Sensors Base class.
/// </summary>
public abstract class QtrBase
{
/// <summary>
/// Gets or sets the Emitter selection.
/// </summary>
public abstract EmitterSelection EmitterSelection { get; set; }
/// <summary>
/// Gets or sets the EmmiterValue..
/// </summary>
public abstract PinValue EmitterValue { get; set; }
/// <summary>
/// Gets or sets the samples per sensor at each read.
/// </summary>
public byte SamplesPerSensor { get; set; } = 1;
/// <summary>
/// Calibrates the sensors.
/// </summary>
/// <param name="itteration">Number of itterations.</param>
/// <param name="emitterOn">True to set the emmitters on.</param>
/// <returns>The calibration data.</returns>
public abstract CalibrationData[] Calibrate(int itteration, bool emitterOn);
/// <summary>
/// Resets the calibration.
/// </summary>
/// <param name="emitterOn">True to reset the emitters on.</param>
public abstract void ResetCalibration(bool emitterOn);
/// <summary>
/// Returns the values in a ration from 0.0 to 1.0.
/// </summary>
/// <returns>An array of raw values.</returns>
public abstract double[] ReadRatio();
/// <summary>
/// Reads the values as Raw values.
/// </summary>
/// <returns>An array of raw values.</returns>
public abstract double[] ReadRaw();
/// <summary>
/// Reads the position of the line from -1.0 to 1.0, 0 is centered. -1 means full left, +1 means full right, 0 means centered.
/// By convention, full left is the sensor 0 and full right is the last sensor.
/// If no position is found, the last position will be returned.
/// </summary>
/// <param name="blackLine">True for a black line, false for a white line.</param>
/// <returns>The position between -1.0 and 1.0.</returns>
public abstract double ReadPosition(bool blackLine = true);
}
}