[WIP] PI
This commit is contained in:
parent
a6bf9b8db6
commit
28cb9af267
12
controls-pi/build.gradle.kts
Normal file
12
controls-pi/build.gradle.kts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
plugins {
|
||||||
|
id("space.kscience.gradle.jvm")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies{
|
||||||
|
api(project(":controls-core"))
|
||||||
|
implementation("com.pi4j:pi4j-ktx:2.4.0") // Kotlin DSL
|
||||||
|
implementation("com.pi4j:pi4j-core:2.3.0")
|
||||||
|
implementation("com.pi4j:pi4j-plugin-raspberrypi:2.3.0")
|
||||||
|
implementation("com.pi4j:pi4j-plugin-pigpio:2.3.0")
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package space.kscience.controls.pi
|
||||||
|
|
||||||
|
import com.pi4j.io.serial.FlowControl
|
||||||
|
import com.pi4j.io.serial.Parity
|
||||||
|
import com.pi4j.io.serial.Serial
|
||||||
|
import com.pi4j.io.serial.StopBits
|
||||||
|
import com.pi4j.ktx.io.open
|
||||||
|
import com.pi4j.ktx.io.piGpioSerialProvider
|
||||||
|
import com.pi4j.ktx.io.serial
|
||||||
|
import space.kscience.controls.ports.AbstractPort
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
|
public class PiSerialPort(
|
||||||
|
context: Context,
|
||||||
|
coroutineContext: CoroutineContext = context.coroutineContext,
|
||||||
|
public val serialBuilder: () -> Serial,
|
||||||
|
) : AbstractPort(context, coroutineContext) {
|
||||||
|
|
||||||
|
private val serial by lazy { serialBuilder() }
|
||||||
|
|
||||||
|
override suspend fun write(data: ByteArray) {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
}
|
@ -43,6 +43,7 @@ include(
|
|||||||
":controls-core",
|
":controls-core",
|
||||||
":controls-ktor-tcp",
|
":controls-ktor-tcp",
|
||||||
":controls-serial",
|
":controls-serial",
|
||||||
|
":controls-pi",
|
||||||
":controls-server",
|
":controls-server",
|
||||||
":controls-opcua",
|
":controls-opcua",
|
||||||
":controls-modbus",
|
":controls-modbus",
|
||||||
|
Loading…
Reference in New Issue
Block a user