void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, STM32!");
  pinMode(A1, INPUT_PULLUP);
}
uint8_t Button_isPress(uint16_t state){
  static uint16_t lastButtonState;
  static uint32_t lastDebounceTime;
  uint8_t retVal = 0;
  uint16_t currentButtonState;

  if(millis() - lastDebounceTime < 50){
    return retVal;
  }
  
  currentButtonState = state;
  if (lastButtonState != currentButtonState){
    lastDebounceTime = millis();
    if(lastButtonState == 1 && currentButtonState == 0){
      retVal = 1;
    } 
  }
  lastButtonState = currentButtonState;
  return retVal;
}
void loop() {
  // put your main code here, to run repeatedly:
  if(Button_isPress(digitalRead(A1))){
    Serial.println("Falling Edge Detected!");
  }
  delay(10); // this speeds up the simulation
}