2024-02-10 23:51:55 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "pico/stdlib.h"
|
|
|
|
|
2024-02-09 12:20:30 +01:00
|
|
|
#include "keyer.h"
|
|
|
|
|
2024-02-10 23:51:55 +01:00
|
|
|
extern const uint LEFT_PADDLE_PIN;
|
|
|
|
|
|
|
|
bool left_paddle_pressed()
|
|
|
|
{
|
|
|
|
if (gpio_get(LEFT_PADDLE_PIN))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-02-09 12:20:30 +01:00
|
|
|
void Keyer::run()
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
2024-02-10 23:51:55 +01:00
|
|
|
case State::Wait:
|
|
|
|
if (left_paddle_pressed())
|
|
|
|
state = State::LeftPaddlePressed;
|
|
|
|
break;
|
|
|
|
case State::LeftPaddlePressed:
|
|
|
|
printf(".");
|
|
|
|
state = State::Wait;
|
2024-02-09 12:20:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|