mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-10-12 02:37:11 +02:00
Refactor CB 3, 4, 5 with complex modular source code and compiled UF2/BIN files
This commit is contained in:
1 parent
0b5353ac50
commit
95ab2e0e8d
24 files changed
+584
-62
No files matched your search
Executable
BIN
Binary file not shown.
Binary file not shown.
@@ -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 Iron Net 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(0x001aa_cb C CXX ASM)
|
||||
pico_sdk_init()
|
||||
add_executable(0x001aa_cb src/main.c)
|
||||
target_link_libraries(0x001aa_cb pico_stdlib)
|
||||
|
||||
project(0x001aa_cb C CXX ASM)
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(0x001aa_cb
|
||||
src/main.c
|
||||
src/dht11.c
|
||||
src/logic.c
|
||||
)
|
||||
|
||||
pico_set_program_name(0x001aa_cb "0x001aa_cb")
|
||||
pico_set_program_version(0x001aa_cb "0.1")
|
||||
|
||||
pico_enable_stdio_uart(0x001aa_cb 1)
|
||||
pico_enable_stdio_usb(0x001aa_cb 1)
|
||||
|
||||
target_compile_definitions(0x001aa_cb PRIVATE
|
||||
PICO_DEFAULT_UART_BAUD_RATE=115200
|
||||
)
|
||||
|
||||
target_link_libraries(0x001aa_cb
|
||||
pico_stdlib
|
||||
hardware_gpio
|
||||
hardware_uart
|
||||
hardware_pwm
|
||||
)
|
||||
|
||||
target_include_directories(0x001aa_cb PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/include
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(0x001aa_cb)
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @file dht11.h
|
||||
* @brief Operation Iron Net Firmware
|
||||
* @author Kevin Thomas
|
||||
* @date 2026
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2026 Kevin Thomas
|
||||
*/
|
||||
|
||||
#ifndef DHT11_H
|
||||
#define DHT11_H
|
||||
#include <stdint.h>
|
||||
typedef struct {
|
||||
uint8_t humidity_int;
|
||||
uint8_t humidity_dec;
|
||||
uint8_t temp_int;
|
||||
uint8_t temp_dec;
|
||||
uint8_t checksum;
|
||||
} dht11_data_t;
|
||||
void dht11_init(void);
|
||||
dht11_data_t* dht11_read(void);
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @file logic.h
|
||||
* @brief Operation Iron Net Firmware
|
||||
* @author Kevin Thomas
|
||||
* @date 2026
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2026 Kevin Thomas
|
||||
*/
|
||||
|
||||
#ifndef LOGIC_H
|
||||
#define LOGIC_H
|
||||
void evaluate_environment(void);
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @file dht11.c
|
||||
* @brief Operation Iron Net Firmware
|
||||
* @author Kevin Thomas
|
||||
* @date 2026
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2026 Kevin Thomas
|
||||
*/
|
||||
|
||||
#include "dht11.h"
|
||||
#include <stdio.h>
|
||||
|
||||
dht11_data_t current_reading;
|
||||
|
||||
void dht11_init(void) {
|
||||
current_reading.humidity_int = 45;
|
||||
current_reading.humidity_dec = 0;
|
||||
current_reading.temp_int = 22;
|
||||
current_reading.temp_dec = 0;
|
||||
current_reading.checksum = 0;
|
||||
}
|
||||
|
||||
dht11_data_t* dht11_read(void) {
|
||||
// Simulated read
|
||||
return ¤t_reading;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file logic.c
|
||||
* @brief Operation Iron Net Firmware
|
||||
* @author Kevin Thomas
|
||||
* @date 2026
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2026 Kevin Thomas
|
||||
*/
|
||||
|
||||
#include "logic.h"
|
||||
#include "dht11.h"
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/gpio.h"
|
||||
|
||||
#define PAYLOAD_GPIO 15
|
||||
|
||||
void __noinline evaluate_environment(void) {
|
||||
dht11_data_t* reading = dht11_read();
|
||||
|
||||
// Complex bitwise checksum logic for students to reverse
|
||||
uint8_t calculated = (reading->humidity_int ^ 0xAF) & 0x3C;
|
||||
|
||||
if (calculated == 0x18) {
|
||||
printf("[*] STRIKE AUTHORIZED. DEPLOYING PAYLOAD.\r\n");
|
||||
gpio_init(PAYLOAD_GPIO);
|
||||
gpio_set_dir(PAYLOAD_GPIO, GPIO_OUT);
|
||||
gpio_put(PAYLOAD_GPIO, 1);
|
||||
sleep_ms(500);
|
||||
gpio_put(PAYLOAD_GPIO, 0);
|
||||
printf("[+] DEPLOYMENT SUCCESSFUL.\r\n");
|
||||
} else {
|
||||
printf("[-] ENVIRONMENT SUB-OPTIMAL. HOLDING.\r\n");
|
||||
}
|
||||
}
|
||||
+20
-17
@@ -1,25 +1,28 @@
|
||||
/**
|
||||
* @file main.c
|
||||
* @brief Operation Iron Net Firmware
|
||||
* @author Kevin Thomas
|
||||
* @date 2026
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2026 Kevin Thomas
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
// Simulated DHT11 single-wire data
|
||||
uint8_t current_humidity = 45;
|
||||
uint8_t current_temp = 22;
|
||||
|
||||
static void check_environmental_lock() {
|
||||
// Complex bitwise checksum logic
|
||||
uint8_t checksum = (current_humidity ^ 0xAF) & 0x3C;
|
||||
|
||||
if (checksum == 0x18) {
|
||||
printf("STRIKE AUTHORIZED.\r\n");
|
||||
} else {
|
||||
printf("ENVIRONMENT SUB-OPTIMAL. HOLDING.\r\n");
|
||||
}
|
||||
}
|
||||
#include "dht11.h"
|
||||
#include "logic.h"
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
dht11_init();
|
||||
|
||||
sleep_ms(2000);
|
||||
printf("SYSTEM BOOT: IRON NET SENSOR NODE ONLINE.\r\n");
|
||||
|
||||
while (true) {
|
||||
check_environmental_lock();
|
||||
sleep_ms(1000);
|
||||
evaluate_environment();
|
||||
sleep_ms(1500);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user