GitHub - tvidal-net/kpi: K-Pi: Kotlin Native on the Raspberry-Pi
source link: https://github.com/tvidal-net/kpi
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
tvidal-net/kpi: K-Pi: Kotlin Native on the Raspberry-Pi
Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBranch: master Go to file
CodeREADME.md
A kotlin native library for the raspberry-pi.
This project is in a very early development stage, but I'm uploading it to github, to help other people who are, like I was a few days ago, looking for a kotlin native lib for the raspberry-pi.
As of now, this library is just a wrapper around the C Library for the Broadcom BCM 2835, created by Mike McCauley.
Is has been tested on a raspberry-pi zero.
To build for the linuxArm32Hfp
target, a linux
development environment is needed. I am using Debian Buster Desktop
Workstation to compile it.
Usage
Apart from the library's core module, I'm creating an executable module for each supported raspberry-pi feature.
GPIO is the only feature that doesn't require root. To work around this limitation, I usually set the suid as soon as the executable is uploaded to the raspberry pi.
Modules
Example:
bash -x scripts/send_to_pi 'gpio' '192.168.0.xxx'
Example:
import uk.tvidal.kpi.bcm2835.PWM import uk.tvidal.kpi.bcm2835.PWM.PWM_RANGE import uk.tvidal.kpi.bcm2835.delay import kotlin.time.ExperimentalTime @ExperimentalTime @ExperimentalUnsignedTypes fun main() { // enabled the PWM interface // using default settings PWM.init() for (i in 0 until PWM_RANGE) { PWM(i) delay(2) } }
scp -C 'pwm/build/bin/arm/debugExecutable/pwm.kexe' '[email protected]:~' ssh '[email protected]' 'sudo bash -' <<EOF chown root:pi 'pwm.kexe' chmod 04775 'pwm.kexe' ./pwm.kexe EOF
Road Map
- GPIO module
- Command-Line Argument Parser
- Support for SPI and I2C interfaces
- Alternative implementation wrapping the WiringPi lib
- Support the BCM 2836 and BCM 2837 chipsets through a common interface
- Better automated testing
- Benchmark comparison of multiple implementations
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK