mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-10-13 03:07:28 +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
@@ -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