Add libcsp Rust integration layer with Linux I2C support#34
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vendor/libcspandvendor/libcsp-rustas git submodules, brings the CubeSat Space Protocol C library and its Rust FFI bindings.radsat-cspcrate (kubos/libs/radsat-csp) that wraps libcsp behind an Rust API usable by device APIs and services.scripts/apply-vendor-patches.sh) to fixlibcsp-rustraw-pointer slice expressions rejected by current Rust compilers underdangerous_implicit_autorefs.radsat-cspcrate featuresinitialize()backed bystd::sync::Once; called automatically byRouterWorkerandReservedServiceWorker.RouterWorker— spawns the libcsp routing thread and keeps it alive for the process lifetime.ReservedServiceWorker— handles standard CSP reserved-port services (ping, etc.).CspClient— helpers forping,send, and request/replytransactionwith configurable timeout and priority.--features i2c) —LinuxI2cCspInterfaceregisters libcsp's C I2C interface and useslinux-embedded-hal::I2cdevfor physical writes. Includesroute_node_via_i2c_addr()for when a device's CSP node id differs from its 7-bit I2C address, and explicitread_frame_from()/inject_received_frame()helpers for master-driven receive polling.Test plan
cargo build -p radsat-cspbuilds cleanly aftergit submodule update --init --recursive && sh scripts/apply-vendor-patches.shcargo build -p radsat-csp --features i2cbuilds with I2C support enabledcargo test -p radsat-csppasses the loopback smoke test (ping + echo transaction over the CSP loopback interface)cargo test -p radsat-csp --features i2cpasses the I2C command/frame encoding tests