This commit is contained in:
Alexander Nozik 2023-05-18 09:50:39 +03:00
parent a6bf9b8db6
commit 28cb9af267
3 changed files with 38 additions and 0 deletions

View 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")
}

View File

@ -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()
}
}

View File

@ -43,6 +43,7 @@ include(
":controls-core",
":controls-ktor-tcp",
":controls-serial",
":controls-pi",
":controls-server",
":controls-opcua",
":controls-modbus",