new file mode 100644
 (file)
index 0000000..
875eed3 
--- /dev/null
+.vscode
+build/
 
new file mode 100644
 (file)
index 0000000..
9a114d1 
--- /dev/null
+# 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)
 
new file mode 100644
 (file)
index 0000000..
034264c 
--- /dev/null
+# _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.
 
new file mode 100644
 (file)
index 0000000..
3febd63 
--- /dev/null
+//
+// 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;
+}
 
new file mode 100644
 (file)
index 0000000..
2e985b4 
--- /dev/null
+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()
 
new file mode 120000
 (symlink)
index 0000000..
11a54ed 
--- /dev/null
+../../../../
\ No newline at end of file