generated from MiaFoxcat/Polyform-perimeter-nc-noai
Initial commit
This commit is contained in:
parent
22fc87e7f7
commit
30b3c0aaf5
11 changed files with 2103 additions and 2 deletions
8
.cargo/config.toml
Normal file
8
.cargo/config.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[target.thumbv8m.main-none-eabi] # <-change for your platform
|
||||||
|
runner = 'probe-rs run --chip RP235x' # <- change for your chip
|
||||||
|
|
||||||
|
[build]
|
||||||
|
target = "thumbv8m.main-none-eabi" # <-change for your platform
|
||||||
|
|
||||||
|
[env]
|
||||||
|
DEFMT_LOG = "trace" # <- can change to info, warn, or error
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.direnv/
|
||||||
|
target/
|
||||||
|
.envrc
|
1857
Cargo.lock
generated
Normal file
1857
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
3
Cargo.toml
Normal file
3
Cargo.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[workspace]
|
||||||
|
resolver = "3"
|
||||||
|
members = ["ir-reader"]
|
|
@ -1,6 +1,6 @@
|
||||||
# [project]
|
# ac-control
|
||||||
---
|
---
|
||||||
(c) 2025 [author]
|
(c) 2025 MiaFoxcat
|
||||||
|
|
||||||
Distributed under the terms outlined in license.txt.
|
Distributed under the terms outlined in license.txt.
|
||||||
TL;DR: Dual-licensed under PolyForm Noncommercial and PolyForm Perimeter (choose one), use for AI training is forbidden.
|
TL;DR: Dual-licensed under PolyForm Noncommercial and PolyForm Perimeter (choose one), use for AI training is forbidden.
|
||||||
|
|
74
ir-reader/Cargo.toml
Normal file
74
ir-reader/Cargo.toml
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
name = "ir-reader"
|
||||||
|
license = "Polyform-NC or Polyform-Perimeter, NO AI TRAINING"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
embassy-embedded-hal = { version = "0.4.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"defmt",
|
||||||
|
] }
|
||||||
|
embassy-sync = { version = "0.7.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"defmt",
|
||||||
|
] }
|
||||||
|
embassy-executor = { version = "0.8.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"arch-cortex-m",
|
||||||
|
"executor-thread",
|
||||||
|
"executor-interrupt",
|
||||||
|
"defmt",
|
||||||
|
] }
|
||||||
|
embassy-time = { version = "0.4.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"defmt",
|
||||||
|
"defmt-timestamp-uptime",
|
||||||
|
] }
|
||||||
|
embassy-rp = { version = "0.7.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"defmt",
|
||||||
|
"unstable-pac",
|
||||||
|
"time-driver",
|
||||||
|
"critical-section-impl",
|
||||||
|
"rp235xa",
|
||||||
|
] }
|
||||||
|
embassy-futures = { version = "0.1.1", git = "https://github.com/embassy-rs/embassy.git" }
|
||||||
|
|
||||||
|
embassy-usb-logger = { version = "0.5.0", git = "https://github.com/embassy-rs/embassy.git" }
|
||||||
|
|
||||||
|
embassy-net = { version = "0.7.0", git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||||
|
"defmt",
|
||||||
|
"tcp",
|
||||||
|
"udp",
|
||||||
|
"dhcpv4",
|
||||||
|
"medium-ethernet",
|
||||||
|
] }
|
||||||
|
|
||||||
|
defmt = "1.0"
|
||||||
|
defmt-rtt = "1.0"
|
||||||
|
fixed = "1.29.0"
|
||||||
|
fixed-macro = "1.2"
|
||||||
|
|
||||||
|
cortex-m = { version = "0.7.7", features = ["inline-asm"] }
|
||||||
|
cortex-m-rt = "0.7.5"
|
||||||
|
panic-probe = { version = "1.0", features = ["print-defmt"] }
|
||||||
|
futures = { version = "0.3.31", default-features = false, features = [
|
||||||
|
"async-await",
|
||||||
|
"cfg-target-has-atomic",
|
||||||
|
"unstable",
|
||||||
|
] }
|
||||||
|
heapless = "0.8"
|
||||||
|
|
||||||
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0" }
|
||||||
|
embedded-hal-async = "1.0.0"
|
||||||
|
embedded-hal-bus = { version = "0.3.0", features = ["async"] }
|
||||||
|
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
||||||
|
#embedded-storage = { version = "0.3" }
|
||||||
|
static_cell = "2"
|
||||||
|
portable-atomic = { version = "1.11", features = ["critical-section"] }
|
||||||
|
log = "0.4"
|
||||||
|
pio-proc = "0.3"
|
||||||
|
pio = "0.3.0"
|
||||||
|
rand = { version = "0.9.1", default-features = false }
|
||||||
|
|
||||||
|
# Below configs are here to mute the rust-analyzer error.
|
||||||
|
# "Can't find crate for 'test'" as this is a no_std project
|
||||||
|
[[bin]]
|
||||||
|
name = "ir-reader"
|
||||||
|
test = false
|
||||||
|
bench = false
|
35
ir-reader/build.rs
Normal file
35
ir-reader/build.rs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//! This build script copies the `memory.x` file from the crate root into
|
||||||
|
//! a directory where the linker can always find it at build time.
|
||||||
|
//! For many projects this is optional, as the linker always searches the
|
||||||
|
//! project root directory -- wherever `Cargo.toml` is. However, if you
|
||||||
|
//! are using a workspace or have a more complicated build setup, this
|
||||||
|
//! build script becomes required. Additionally, by requesting that
|
||||||
|
//! Cargo re-run the build script whenever `memory.x` is changed,
|
||||||
|
//! updating `memory.x` ensures a rebuild of the application with the
|
||||||
|
//! new memory settings.
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Put `memory.x` in our output directory and ensure it's
|
||||||
|
// on the linker search path.
|
||||||
|
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
|
File::create(out.join("memory.x"))
|
||||||
|
.unwrap()
|
||||||
|
.write_all(include_bytes!("memory.x"))
|
||||||
|
.unwrap();
|
||||||
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
|
||||||
|
// By default, Cargo will re-run a build script whenever
|
||||||
|
// any file in the project changes. By specifying `memory.x`
|
||||||
|
// here, we ensure the build script is only re-run when
|
||||||
|
// `memory.x` is changed.
|
||||||
|
println!("cargo:rerun-if-changed=memory.x");
|
||||||
|
|
||||||
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
|
}
|
75
ir-reader/memory.x
Normal file
75
ir-reader/memory.x
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
MEMORY {
|
||||||
|
/*
|
||||||
|
* The RP2350 has either external or internal flash.
|
||||||
|
*
|
||||||
|
* 2 MiB is a safe default here, although a Pico 2 has 4 MiB.
|
||||||
|
*/
|
||||||
|
FLASH : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||||
|
/*
|
||||||
|
* RAM consists of 8 banks, SRAM0-SRAM7, with a striped mapping.
|
||||||
|
* This is usually good for performance, as it distributes load on
|
||||||
|
* those banks evenly.
|
||||||
|
*/
|
||||||
|
RAM : ORIGIN = 0x20000000, LENGTH = 512K
|
||||||
|
/*
|
||||||
|
* RAM banks 8 and 9 use a direct mapping. They can be used to have
|
||||||
|
* memory areas dedicated for some specific job, improving predictability
|
||||||
|
* of access times.
|
||||||
|
* Example: Separate stacks for core0 and core1.
|
||||||
|
*/
|
||||||
|
SRAM8 : ORIGIN = 0x20080000, LENGTH = 4K
|
||||||
|
SRAM9 : ORIGIN = 0x20081000, LENGTH = 4K
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Boot ROM info
|
||||||
|
*
|
||||||
|
* Goes after .vector_table, to keep it in the first 4K of flash
|
||||||
|
* where the Boot ROM (and picotool) can find it
|
||||||
|
*/
|
||||||
|
.start_block : ALIGN(4)
|
||||||
|
{
|
||||||
|
__start_block_addr = .;
|
||||||
|
KEEP(*(.start_block));
|
||||||
|
KEEP(*(.boot_info));
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
} INSERT AFTER .vector_table;
|
||||||
|
|
||||||
|
/* move .text to start /after/ the boot info */
|
||||||
|
_stext = ADDR(.start_block) + SIZEOF(.start_block);
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Picotool 'Binary Info' Entries
|
||||||
|
*
|
||||||
|
* Picotool looks through this block (as we have pointers to it in our
|
||||||
|
* header) to find interesting information.
|
||||||
|
*/
|
||||||
|
.bi_entries : ALIGN(4)
|
||||||
|
{
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_start = .;
|
||||||
|
/* Here are the entries */
|
||||||
|
KEEP(*(.bi_entries));
|
||||||
|
/* Keep this block a nice round size */
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_end = .;
|
||||||
|
} > FLASH
|
||||||
|
} INSERT AFTER .text;
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Boot ROM extra info
|
||||||
|
*
|
||||||
|
* Goes after everything in our program, so it can contain a signature.
|
||||||
|
*/
|
||||||
|
.end_block : ALIGN(4)
|
||||||
|
{
|
||||||
|
__end_block_addr = .;
|
||||||
|
KEEP(*(.end_block));
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
} INSERT AFTER .uninit;
|
||||||
|
|
||||||
|
PROVIDE(start_to_end = __end_block_addr - __start_block_addr);
|
||||||
|
PROVIDE(end_to_start = __start_block_addr - __end_block_addr);
|
4
ir-reader/rust-toolchain.toml
Normal file
4
ir-reader/rust-toolchain.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "stable"
|
||||||
|
components = ["rust-src", "rustfmt", "llvm-tools"]
|
||||||
|
targets = ["thumbv8m.main-none-eabi"]
|
11
ir-reader/src/main.rs
Normal file
11
ir-reader/src/main.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
loop {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
31
shell.nix
Normal file
31
shell.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
}:
|
||||||
|
pkgs.callPackage (
|
||||||
|
{
|
||||||
|
mkShell,
|
||||||
|
stdenv,
|
||||||
|
pkgs,
|
||||||
|
}:
|
||||||
|
mkShell {
|
||||||
|
strictDeps = true;
|
||||||
|
# host/target agnostic programs
|
||||||
|
depsBuildBuild = [
|
||||||
|
pkgs.picotool
|
||||||
|
pkgs.rustfmt
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
];
|
||||||
|
# compilers & linkers & dependecy finding programs
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.rustup
|
||||||
|
];
|
||||||
|
# libraries
|
||||||
|
buildInputs = [
|
||||||
|
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
export PATH="''${CARGO_HOME:-~/.cargo}/bin":"$PATH"
|
||||||
|
export PATH="''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-${stdenv.hostPlatform.rust.rustcTarget}/bin":"$PATH"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
) { }
|
Loading…
Add table
Add a link
Reference in a new issue