]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21304ed)
Add build recipes for Raspberry Pi Pico SDK
Mon, 6 Sep 2021 21:31:57 +0000 (23:31 +0200)
Tue, 7 Sep 2021 10:06:11 +0000 (12:06 +0200)
This commit adds recipes for a quick implementation of tic2json on
Raspberry Pi Pico SDK.

The included main() stub sets up a serial conversion with raw TIC on
input (RX) and JSON on output (TX).

The build recipe is hackish, but it get things done.

embedded/Pico/picotic/.gitignore [new file with mode: 0644] patch | blob
embedded/Pico/picotic/CMakeLists.txt [new file with mode: 0644] patch | blob
embedded/Pico/picotic/README.md [new file with mode: 0644] patch | blob
embedded/Pico/picotic/picotic.c [new file with mode: 0644] patch | blob

diff --git a/embedded/Pico/picotic/.gitignore b/embedded/Pico/picotic/.gitignore
new file mode 100644 (file)
index 0000000..875eed3
--- /dev/null
+++ b/embedded/Pico/picotic/.gitignore
@@ -0,0 +1,2 @@
+.vscode
+build/
diff --git a/embedded/Pico/picotic/CMakeLists.txt b/embedded/Pico/picotic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9a114d1
--- /dev/null
+++ b/embedded/Pico/picotic/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated Cmake Pico project file
+
+cmake_minimum_required(VERSION 3.13)
+
+OPTION(TICVERSION_01 "Support TIC v01 (historique)")
+OPTION(TICVERSION_02 "Support TIC v02 (standard)")
+
+if(TICVERSION_01)
+add_definitions(-DTICBAUDRATE=1200)
+else()
+add_definitions(-DTICBAUDRATE=9600)
+endif()
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
+
+if (NOT EXISTS $ENV{PICO_SDK_PATH})
+message(FATAL_ERROR "Missing environment variable PICO_SDK_PATH")
+endif ()
+
+# Pull in Raspberry Pi Pico SDK (must be before project)
+include($ENV{PICO_SDK_PATH}/pico_sdk_init.cmake)
+
+project(picotic C CXX ASM)
+
+add_subdirectory(tic2json)
+
+# Initialise the Raspberry Pi Pico SDK
+pico_sdk_init()
+
+# Add executable. Default name is the project name, version 0.1
+
+add_executable(picotic picotic.c )
+
+pico_set_program_name(picotic "picotic")
+pico_set_program_version(picotic "0.1")
+
+# Add the standard library to the build
+target_link_libraries(picotic pico_stdlib tic2json)
+
+pico_add_extra_outputs(picotic)
diff --git a/embedded/Pico/picotic/README.md b/embedded/Pico/picotic/README.md
new file mode 100644 (file)
index 0000000..034264c
--- /dev/null
+++ b/embedded/Pico/picotic/README.md
@@ -0,0 +1,19 @@
+# _picotic_
+
+Quick & dirty implementation of tic2json for Raspberry Pi Pico.
+Gets TIC data on RX pin, outputs formatted JSON on UART TX.
+
+### Configure the project
+
+* Set environnment variable `PICO_SDK_PATH`
+* Run CMake and set **either** of the top CMakeLists.txt options (`TICVERSION_01` or `TICVERSION_02`):
+
+`cmake -B build . -DTICVERSION_02=ON`
+
+### Build and Flash
+
+Build the project and flash it to the board:
+
+`make -C build`
+
+See the Getting Started Guide for full steps to configure and use the Pico SDK to build projects.
diff --git a/embedded/Pico/picotic/picotic.c b/embedded/Pico/picotic/picotic.c
new file mode 100644 (file)
index 0000000..3febd63
--- /dev/null
+++ b/embedded/Pico/picotic/picotic.c
@@ -0,0 +1,38 @@
+//
+// picotic.c
+// app stub for Raspberry Pi Pico
+//
+// (C) 2021 Thibaut VARENE
+// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
+//
+
+/**
+ * @file
+ * Receives TIC on RX, outputs JSON on TX.
+ */
+
+#include "pico/stdio_uart.h"
+#include "hardware/uart.h"
+
+#define UART_ID uart0
+#define UART_TX_PIN PICO_DEFAULT_UART_TX_PIN
+#define UART_RX_PIN PICO_DEFAULT_UART_RX_PIN
+
+#ifndef TICBAUDRATE
+ #define TICBAUDRATE 1200
+#endif
+
+void tic2json_main(void);
+
+int main()
+{
+ stdio_uart_init_full(UART_ID, TICBAUDRATE, UART_TX_PIN, UART_RX_PIN);
+
+ uart_set_hw_flow(UART_ID, false, false);
+ uart_set_format(UART_ID, 7, 1, UART_PARITY_EVEN);
+
+ while (1)
+ tic2json_main();
+
+ return 0;
+}
diff --git a/embedded/Pico/picotic/tic2json/CMakeLists.txt b/embedded/Pico/picotic/tic2json/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2e985b4
--- /dev/null
+++ b/embedded/Pico/picotic/tic2json/CMakeLists.txt
@@ -0,0 +1,11 @@
+execute_process(COMMAND make -C ${CMAKE_CURRENT_LIST_DIR}/src csources)
+file(GLOB FILES src/*.c src/*.h)
+add_library(tic2json ${FILES})
+target_compile_options(tic2json PRIVATE -DBAREBUILD)
+
+if(TICVERSION_01)
+add_definitions(-DTICV01)
+endif()
+if(TICVERSION_02)
+add_definitions(-DTICV02)
+endif()
diff --git a/embedded/Pico/picotic/tic2json/src b/embedded/Pico/picotic/tic2json/src
new file mode 120000 (symlink)
index 0000000..11a54ed
--- /dev/null
+++ b/embedded/Pico/picotic/tic2json/src
@@ -0,0 +1 @@
+../../../../
\ No newline at end of file
tic2json TIC parser/converter
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /