53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
#include "main.h"
|
|
#include <Arduino.h>
|
|
#include "epaperdisplay.h"
|
|
#include "button.h"
|
|
#include "coinacceptor.h"
|
|
#include "state.h"
|
|
//#include "lnurlutil.h"
|
|
#include "config.h"
|
|
|
|
EpaperDisplay epDisp(DSPLY_PIN_CS, DSPLY_PIN_DC, DSPLY_PIN_RST, DSPLY_PIN_BUSY);
|
|
AtmButton ok_button(OK_BUTTON_PIN, OK_LED_BUTTON_PIN);
|
|
AtmButton cancel_button(OK_BUTTON_PIN, OK_LED_BUTTON_PIN);
|
|
CoinAcceptor cacc(COIN_PIN, MOSFET_PIN, COINS, COINS_COUNT, COIN_PULSE_WIDTH_MS, MAX_ALLOWED_EUROCENT_VALUE);
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
epDisp.init(); // Init eInk display
|
|
|
|
epDisp.initScreen();
|
|
|
|
cacc.begin(); // Init Coin acceptor
|
|
cacc.disable(); // Disable coin detection
|
|
ok_button.begin(); // Init OK button
|
|
ok_button.reset(); // Reset Ok button - if already pressed
|
|
cancel_button.begin(); // Init Cancel button
|
|
cancel_button.reset(); // Reset cancel button - if already pressed
|
|
cancel_button.ledOff();
|
|
|
|
/* activate both buttons and wait until at least one is pressed */
|
|
while(
|
|
true == ok_button.iswaitingUntilPressed(/* maxTimeToWaitMs0= */ 0, /* blinkPeriodMs= */ 1000) &&
|
|
true == cancel_button.iswaitingUntilPressed(/* maxTimeToWaitMs0= */ 0, /* blinkPeriodMs= */ 1000)
|
|
)
|
|
{}
|
|
cancel_button.softPress(); // just do a 'soft press' to both buttons to stop waiting and blink for the unpressed as well
|
|
ok_button.softPress(); // just do a 'soft press' to both buttons to stop waiting and blink for the unpressed as well
|
|
|
|
atm::reset(); // reset the ATM state machine and go to init state!
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
/* now start the ATM state machine in the endless loop*/
|
|
atm::stateMachine();
|
|
}
|
|
|
|
|
|
|