Merge branch 'master' of ssh://vato.ddns.net:222/vato007/swiftrplidar

This commit is contained in:
=
2020-07-12 10:59:05 +09:30
4 changed files with 32 additions and 10 deletions

View File

@@ -7,4 +7,5 @@ public protocol LidarSerial {
func openPort() throws;
func readData(ofLength: Int) throws -> Data;
func writeData(_ data: Data) throws -> Int;
func setBaudrate(baudrate: Int)
}

View File

@@ -46,10 +46,10 @@ func processScan(raw: Data) throws -> LidarScan {
}
public struct LidarScan{
var newScan: Bool
var quality: UInt8
var angle: Float
var distance: Float
public let newScan: Bool
public let quality: UInt8
public let angle: Float
public let distance: Float
}
@@ -78,6 +78,7 @@ public class SwiftRPLidar {
public func connect() throws {
disconnect()
try serialPort!.openPort()
serialPort?.setBaudrate(baudrate: 115200)
}
public func disconnect(){