<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>03-外设 on 编程那些事儿</title><link>https://before80.github.io/prgms/Rust/embedded/peripherals/</link><description>Recent content in 03-外设 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 11 Aug 2026 23:57:44 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Rust/embedded/peripherals/index.xml" rel="self" type="application/rss+xml"/><item><title>01-用 Rust 的第一次尝试</title><link>https://before80.github.io/prgms/Rust/embedded/peripherals/01-a-first-attempt-in-rust/</link><pubDate>Sat, 01 Aug 2026 10:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/embedded/peripherals/01-a-first-attempt-in-rust/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/stable/embedded-book/"&gt;The Embedded Rust Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="a-first-attempt"&gt;用 Rust 的第一次尝试&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/stable/embedded-book/peripherals/a-first-attempt.html"&gt;https://doc.rust-lang.org/stable/embedded-book/peripherals/a-first-attempt.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="the-registers"&gt;寄存器&lt;/h2&gt;
&lt;p&gt;我们来看一下「SysTick」外设 —— 每个 Cortex-M 处理器核都自带的一个简单定时器。通常你会在芯片厂商的数据手册或*技术参考手册（Technical Reference Manual）*里查找这些内容，但这个例子对所有 ARM Cortex-M 核都通用，我们来看 &lt;a href="http://infocenter.arm.com/help/topic/com.arm.doc.dui0553a/Babieigh.html"&gt;ARM reference manual&lt;/a&gt;。可以看到有四个寄存器：&lt;/p&gt;</description></item><item><title>02-借用检查器</title><link>https://before80.github.io/prgms/Rust/embedded/peripherals/02-the-borrow-checker/</link><pubDate>Sat, 01 Aug 2026 10:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/embedded/peripherals/02-the-borrow-checker/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/stable/embedded-book/"&gt;The Embedded Rust Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="the-borrow-checker"&gt;借用检查器&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/stable/embedded-book/peripherals/borrowck.html"&gt;https://doc.rust-lang.org/stable/embedded-book/peripherals/borrowck.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="mutable-global-state"&gt;可变全局状态&lt;/h2&gt;
&lt;p&gt;不幸的是，硬件基本上就是可变全局状态，这对 Rust 开发者来说可能相当吓人。硬件独立于我们编写的代码结构而存在，并且随时可能被现实世界修改。&lt;/p&gt;</description></item><item><title>03-单例</title><link>https://before80.github.io/prgms/Rust/embedded/peripherals/03-singletons/</link><pubDate>Sat, 01 Aug 2026 10:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/embedded/peripherals/03-singletons/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/stable/embedded-book/"&gt;The Embedded Rust Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="singletons"&gt;单例&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/stable/embedded-book/peripherals/singletons.html"&gt;https://doc.rust-lang.org/stable/embedded-book/peripherals/singletons.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;在软件工程中，单例模式是一种设计模式，它把一个类的实例化限制为一个对象。&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Wikipedia: &lt;a href="https://en.wikipedia.org/wiki/Singleton_pattern"&gt;Singleton Pattern&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="but-why-cant-we-just-use-global-variables"&gt;但我们为什么不能直接用全局变量？&lt;/h2&gt;
&lt;p&gt;我们可以把一切都做成公开的 static，像这样：&lt;/p&gt;</description></item></channel></rss>