Compare commits

..

2 commits

6 changed files with 7 additions and 24 deletions

View file

@ -1,6 +1,6 @@
# Generated Cmake Pico project file # Generated Cmake Pico project file
cmake_minimum_required(VERSION 3.26) cmake_minimum_required(VERSION 3.28)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
@ -14,8 +14,8 @@ set(PICO_BOARD pico CACHE STRING "Board type")
# Pull in Raspberry Pi Pico SDK (must be before project) # Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake) include(pico_sdk_import.cmake)
if (PICO_SDK_VERSION_STRING VERSION_LESS "1.5.0") if (PICO_SDK_VERSION_STRING VERSION_LESS "2.0.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.5.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}") message(FATAL_ERROR "Raspberry Pi Pico SDK version 2.0.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif() endif()
project(raspikeyer VERSION "0.0.1" LANGUAGES C CXX ASM) project(raspikeyer VERSION "0.0.1" LANGUAGES C CXX ASM)

View file

@ -2,10 +2,10 @@
#include <stdio.h> #include <stdio.h>
#include <utility> #include <utility>
#include <functional>
#include "bsp/board.h" #include "bsp/board.h"
#include "hardware/adc.h" #include "hardware/adc.h"
#include "pico/flash.h"
#include "pico/binary_info/code.h" #include "pico/binary_info/code.h"
#include "pico/multicore.h" #include "pico/multicore.h"
#include "pico/stdlib.h" #include "pico/stdlib.h"
@ -102,10 +102,6 @@ void core1_main()
} }
} }
void test() {
printf("Test\n");
}
int main() int main()
{ {
timer_hw->dbgpause = 0; // workaround for problem with debug and sleep_ms timer_hw->dbgpause = 0; // workaround for problem with debug and sleep_ms
@ -135,10 +131,7 @@ int main()
KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, currentWpm, settings.mode, 0}; KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, currentWpm, settings.mode, 0};
queue_add_blocking(&keyerQueue, &keyerQueueData); queue_add_blocking(&keyerQueue, &keyerQueueData);
std::function<void()> f_observer = test;
WinKeyer winKeyer; WinKeyer winKeyer;
winKeyer.addObserver(f_observer);
pio_hw_t *pio = pio0; pio_hw_t *pio = pio0;
TM1637 display {DISPLAY_DIO_PIN, DISPLAY_CLK_PIN, pio}; TM1637 display {DISPLAY_DIO_PIN, DISPLAY_CLK_PIN, pio};

View file

@ -1,6 +1,7 @@
#include <cstring> #include <cstring>
#include "pico/stdlib.h" #include "pico/stdlib.h"
#include "pico/flash.h"
#include "settings.h" #include "settings.h"
@ -66,4 +67,4 @@ Settings read_settings()
} }
return settings; return settings;
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "pico/flash.h" #include "hardware/flash.h"
const uint16_t MAGIC_NUMBER = 4; const uint16_t MAGIC_NUMBER = 4;

View file

@ -103,10 +103,4 @@ void WinKeyer::run(queue_t &queue)
m_commandState = CommandState::None; m_commandState = CommandState::None;
} }
} }
}
void WinKeyer::addObserver(std::function<void()> obs) {
m_observers.push_back(obs);
obs();
} }

View file

@ -1,15 +1,11 @@
#pragma once #pragma once
#include <vector>
#include <functional>
#include "pico/util/queue.h" #include "pico/util/queue.h"
class WinKeyer final class WinKeyer final
{ {
public: public:
void run(queue_t &queue); void run(queue_t &queue);
void addObserver(std::function<void()> obs);
private: private:
enum class CommandState { enum class CommandState {
@ -28,5 +24,4 @@ class WinKeyer final
CommandState m_commandState {CommandState::None}; CommandState m_commandState {CommandState::None};
WkMode m_wkMode {WkMode::WK1}; WkMode m_wkMode {WkMode::WK1};
bool m_hostOpen {false}; bool m_hostOpen {false};
std::vector<std::function<void()>> m_observers;
}; };