renamed to raspi_keyer
This commit is contained in:
parent
10d56f8a8b
commit
31993ca952
3 changed files with 12 additions and 12 deletions
58
src/raspi_keyer.cpp
Normal file
58
src/raspi_keyer.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#include "settings.h"
|
||||
#include "keyer.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
extern const uint LED_PIN = PICO_DEFAULT_LED_PIN;
|
||||
extern const uint LEFT_PADDLE_PIN = 14;
|
||||
extern const uint RIGHT_PADDLE_PIN = 15;
|
||||
extern const uint BUZZER_PIN = 13;
|
||||
|
||||
void setup()
|
||||
{
|
||||
stdio_init_all();
|
||||
gpio_init(LED_PIN);
|
||||
gpio_set_dir(LED_PIN, GPIO_OUT);
|
||||
gpio_put(LED_PIN, 0);
|
||||
|
||||
// Setup pins for left and right paddles
|
||||
gpio_init(LEFT_PADDLE_PIN);
|
||||
gpio_set_dir(LEFT_PADDLE_PIN, GPIO_IN);
|
||||
gpio_pull_up(LEFT_PADDLE_PIN);
|
||||
gpio_init(RIGHT_PADDLE_PIN);
|
||||
gpio_set_dir(RIGHT_PADDLE_PIN, GPIO_IN);
|
||||
gpio_pull_up(RIGHT_PADDLE_PIN);
|
||||
|
||||
sleep_ms(1000);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
timer_hw->dbgpause = 0; // fix problem with debug and sleep_ms https://github.com/raspberrypi/pico-sdk/issues/1152#issuecomment-1418248639
|
||||
|
||||
setup();
|
||||
|
||||
Settings settings{read_settings()};
|
||||
|
||||
// printf("\nIambic mode (loaded): %d\n", static_cast<int>(settings.mode));
|
||||
// printf("WPM (loaded): %d\n", settings.wpm);
|
||||
// printf("Element duration (u_sec): %" PRIu64 "\n", element_duration_us(settings.wpm));
|
||||
printf("\n");
|
||||
|
||||
Keyer keyer(25);
|
||||
|
||||
while (true)
|
||||
{
|
||||
keyer.run();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue