Refactor CB 3, 4, 5 with complex modular source code and compiled UF2/BIN files

This commit is contained in:
Kevin Thomas committed 2026-10-09 15:23:55 -04:00
1 parent 0b5353ac50
commit 95ab2e0e8d
24 files changed
+584 -62

No files matched your search

BIN
View File
Binary file not shown.
Binary file not shown.
+76 -4
View File
@@ -1,11 +1,83 @@
# MIT License
#
# Copyright (c) 2026 Kevin Thomas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Author: Kevin Thomas
# Email: kevin@mytechnotalent.com
# GitHub: https://github.com/mytechnotalent
# File: CMakeLists.txt
# Desc: Configures RP2350 Pico SDK project for Operation Ghost Light Firmware
# Created: 2026
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.2.0)
set(toolchainVersion 14_2_Rel1)
set(picotoolVersion 2.2.0-a4)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
set(PICO_BOARD pico2 CACHE STRING "Board type")
include(pico_sdk_import.cmake)
project(0x0020a_cb C CXX ASM)
pico_sdk_init()
add_executable(0x0020a_cb src/main.c)
target_link_libraries(0x0020a_cb pico_stdlib)
project(0x0020a_cb C CXX ASM)
pico_sdk_init()
add_executable(0x0020a_cb
src/main.c
src/ir_rx.c
src/dazzler.c
)
pico_set_program_name(0x0020a_cb "0x0020a_cb")
pico_set_program_version(0x0020a_cb "0.1")
pico_enable_stdio_uart(0x0020a_cb 1)
pico_enable_stdio_usb(0x0020a_cb 1)
target_compile_definitions(0x0020a_cb PRIVATE
PICO_DEFAULT_UART_BAUD_RATE=115200
)
target_link_libraries(0x0020a_cb
pico_stdlib
hardware_gpio
hardware_uart
hardware_pwm
)
target_include_directories(0x0020a_cb PRIVATE
${CMAKE_CURRENT_LIST_DIR}/include
)
pico_add_extra_outputs(0x0020a_cb)
+22
View File
@@ -0,0 +1,22 @@
/**
* @file dazzler.h
* @brief Operation Ghost Light Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#ifndef DAZZLER_H
#define DAZZLER_H
#include <stdint.h>
#include <stdbool.h>
typedef struct {
uint32_t active_ir_code;
bool is_locked_out;
} dazzler_t;
extern dazzler_t laser_sys;
void dazzler_init(void);
void parse_nec_code(void);
#endif
+15
View File
@@ -0,0 +1,15 @@
/**
* @file ir_rx.h
* @brief Operation Ghost Light Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#ifndef IR_RX_H
#define IR_RX_H
#include <stdint.h>
uint32_t get_latest_ir_code(void);
#endif
+46
View File
@@ -0,0 +1,46 @@
/**
* @file dazzler.c
* @brief Operation Ghost Light Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#include "dazzler.h"
#include "ir_rx.h"
#include <stdio.h>
#include "pico/stdlib.h"
dazzler_t laser_sys;
void dazzler_init(void) {
laser_sys.active_ir_code = 0x00FF00FF;
laser_sys.is_locked_out = false;
}
void __noinline parse_nec_code(void) {
if (laser_sys.is_locked_out) {
printf("[!] SYSTEM LOCKED. REBOOT REQUIRED.\r\n");
return;
}
uint32_t code = get_latest_ir_code();
if (code == 0xFF0055AA) {
printf("[+] DAZZLER POWER LEVEL: MAX\r\n");
} else if (code == 0xFF00AA55) {
printf("[+] DAZZLER TRACKING: ENGAGED\r\n");
} else if (code == 0xFF0011EE) {
printf("[+] DAZZLER POWER LEVEL: LOW\r\n");
} else if (code == 0xDEADBEEF) {
printf("[-] FRIENDLY FIRE LOCKOUT TRIGGERED. DAZZLER DISABLED.\r\n");
laser_sys.is_locked_out = true;
while(1) { tight_loop_contents(); }
} else if (code == 0x00FF00FF) {
printf("[-] DAZZLER IDLE.\r\n");
} else {
printf("[?] UNKNOWN IR COMMAND: 0x%08X\r\n", code);
}
}
+16
View File
@@ -0,0 +1,16 @@
/**
* @file ir_rx.c
* @brief Operation Ghost Light Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#include "ir_rx.h"
uint32_t simulated_ir_rx_code = 0x00FF00FF;
uint32_t get_latest_ir_code(void) {
return simulated_ir_rx_code;
}
+19 -17
View File
@@ -1,25 +1,27 @@
/**
* @file main.c
* @brief Operation Ghost Light Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#include <stdio.h>
#include "pico/stdlib.h"
uint32_t simulated_ir_rx_code = 0x00FF00FF;
static void parse_nec_code(uint32_t code) {
if (code == 0xFF0055AA) {
printf("DAZZLER POWER LEVEL: MAX\r\n");
} else if (code == 0xFF00AA55) {
printf("DAZZLER TRACKING: ENGAGED\r\n");
} else if (code == 0xDEADBEEF) {
printf("FRIENDLY FIRE LOCKOUT TRIGGERED. DAZZLER DISABLED.\r\n");
while(1); // Permanent lockout
} else {
printf("UNKNOWN IR COMMAND.\r\n");
}
}
#include "dazzler.h"
int main(void) {
stdio_init_all();
dazzler_init();
sleep_ms(2000);
printf("SYSTEM BOOT: GHOST LIGHT DAZZLER ONLINE.\r\n");
while (true) {
parse_nec_code(simulated_ir_rx_code);
sleep_ms(1000);
parse_nec_code();
sleep_ms(1500);
}
return 0;
}