Repository for my experiments into Kotlin Native and interacting with GPIO or I2C. This makes use of the interoperability with C libraries.
As such, this isn't meant to be used as a library or production-ready software. I'm just doing my own thing: experimenting
But maybe this will help someone else who is crazy enough and stubborn like me to give this a stab.
Short answer: Read above
Long answer: I just really like Kotlin and decided to give this a shot and explore unexplored territory (at least for myself)
Because I was too lazy to figure out how to get that working with interop. Also, just learning how each component of the code works.
The GPIO class makes cinterop calls to libgpiod
The I2C class makes cinterop calls to smbus
That's for future me to figure out
- Raspberry Pi Zero 2 W (should work with other Pis as long as it's 64-bit)
- Make sure it has the
libgpiodandlibi2cpackages installed - You may need to enable I2C for your Pi
- Make sure it has the
- 7-Segment Display
- LEDs
- Button
- SSD1306 Display (128x64)
Resources used in this project:
- Kotlin Native: Interoperability with C
- RPI Pinout
- Adafruit SSD1306 Library
- starnight/libgpiod-example
- Linux Kernel: I2C & SMBus
- Michael Bolt's Blog Post on I2C + SSD1306
- lynniemagoo/oled-font-pack
- My sweet lovely girlfriend for reminding me that look-up tables exist
Go crazy if you want to