Below is the sample code and the apis;
package demo; import eapi.*;
public class App {
public static void main(String args[]) {
final Led led = Led.init('C', 13); // Port C Pin 13
PushButton pushButton = PushButton.init('A',
8, //Port A Pin 8
GPIO.INPUT_PULL_UP,
GPIO.FALLING_EDGE,
200, //debounce
(time) -> {
Core.println("push button event");
led.flip();
});
while (true) {
Looper.loop();
}
}Analog.inSetup(Analog.IN1); Analog.read(Analog.IN1);
Analog.outSetup(Analog.OUT5); Analog.write(Analog.OUT5, (short)255);
I2C.setup(I2C.I2C2, 400); SPI.setup(SPI.SPI_ID2, 0, SPI.SPI_MODE_3, SPI.SPI_FB_MSB);
References: https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html