Skip to content

Commit ea8baab

Browse files
author
dcyoung
committed
Updated ReadMe with API
1 parent ce0cca6 commit ea8baab

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,88 @@ bool bSuccess = device.stopScanning();
7474
```
7575
7676
77+
# API
7778
79+
```c++
80+
Sweep(Stream &serial)
81+
```
82+
83+
Constructs a sweep device on the provided Stream object.
84+
85+
```c++
86+
bool bIsScanning
87+
```
88+
89+
True if the device is currently scanning.
90+
91+
```c++
92+
bool startScanning()
93+
```
94+
Signals the sweep device to start scanning. Initiates an indefinite stream of individual sensor readings until `stopScanning()` is called.
95+
During an active data stream, any attempt to communicate with the device other than `stopScanning()` will fail.
96+
97+
98+
```c++
99+
bool stopScanning()
100+
```
101+
102+
Signals the sweep device to stop scanning.
103+
104+
```c++
105+
bool getReading(ScanPacket &reading)
106+
```
107+
108+
Reads a single sensor reading from the serial buffer. Must be called frequently enough to keep up with the data stream.
109+
110+
```c++
111+
struct ScanPacket
112+
{
113+
bool bIsSync; // 1 -> first reading of new scan, 0 otherwise
114+
float angle; // degrees
115+
uint16_t distance; // cm
116+
uint8_t signalStrength; // 0:255, higher is better
117+
}
118+
```
119+
120+
Structure representing a single sensor reading (ranging). ie: a full 360deg scan would be composed of many such readings.
121+
122+
```c++
123+
int32_t getMotorSpeed()
124+
```
125+
126+
Returns the current motor speed setting in HZ
127+
128+
```c++
129+
bool setMotorSpeed(const uint8_t motorSpeedCode[2])
130+
131+
// Available Codes
132+
MOTOR_SPEED_CODE_1_HZ
133+
MOTOR_SPEED_CODE_2_HZ
134+
MOTOR_SPEED_CODE_3_HZ
135+
MOTOR_SPEED_CODE_4_HZ
136+
MOTOR_SPEED_CODE_5_HZ
137+
MOTOR_SPEED_CODE_6_HZ
138+
MOTOR_SPEED_CODE_7_HZ
139+
MOTOR_SPEED_CODE_8_HZ
140+
MOTOR_SPEED_CODE_9_HZ
141+
MOTOR_SPEED_CODE_10_HZ
142+
```
143+
144+
Adjusts the motor speed setting to the provided code. Recommend users pass one of the const codes defined by library:
145+
146+
```c++
147+
int32_t getSampleRate()
148+
```
149+
150+
Returns the current sample rate setting in HZ.
151+
152+
```c++
153+
bool setSampleRate(const uint8_t sampleRateCode[2])
154+
155+
// Available Codes
156+
SAMPLE_RATE_CODE_500_HZ
157+
SAMPLE_RATE_CODE_750_HZ
158+
SAMPLE_RATE_CODE_1000_HZ
159+
```
160+
161+
Adjusts the sample rate setting to the provided code. Recommend users pass one of the const codes defined by library:

0 commit comments

Comments
 (0)