AlphaSerpentis/KotlinNativeGPIOExperiments

My first dive into Kotlin Native by using it to control stuff through GPIO and I2C

★ 1Forks 0CGitHub ↗Compare
gpioi2ckotlinkotlin-nativessd1306

README

Kotlin Native GPIO Experiments

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.

Why Don't You Just Use C or Python?

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)

If Part of the Code References Adafruit's Library, Why Not Just Interop?

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.

Interfaces

GPIO

The GPIO class makes cinterop calls to libgpiod

I2C

The I2C class makes cinterop calls to smbus

SPI

That's for future me to figure out

Hardware Referenced in this Project

  • Raspberry Pi Zero 2 W (should work with other Pis as long as it's 64-bit)
    • Make sure it has the libgpiod and libi2c packages installed
    • You may need to enable I2C for your Pi
  • 7-Segment Display
  • LEDs
  • Button
  • SSD1306 Display (128x64)

Resources

Resources used in this project:

Contributing

Go crazy if you want to

License

The Unlicense

Contributors

AlphaSerpentis

Issues