Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Zinc at Rust London '14
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Vladimir Pouzanov
August 14, 2014
Technology
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Zinc at Rust London '14
Vladimir Pouzanov
August 14, 2014
More Decks by Vladimir Pouzanov
See All by Vladimir Pouzanov
Pixels Everywhere!
farcaller
0
170
Prepare to Dock
farcaller
1
280
REPL Done Right
farcaller
1
330
iOS in Motion
farcaller
1
150
Reversing WTF
farcaller
2
130
iOS TDD
farcaller
1
190
Clang 3.0 Memory Management
farcaller
1
130
Effective Multithreading in iOS
farcaller
1
140
GameKit and Social APIs
farcaller
1
95
Other Decks in Technology
See All in Technology
現場のトークンマネジメント
dak2
1
190
AIはどのように 組織のアジリティを変えるのか?
junki
4
1.4k
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
200
AIチャットの改善から見えた、良いAI体験とは / What Constitutes a Good AI Experience: Insights from Improving AI Chat
kubode
0
120
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
270
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
250
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
140
クラウドファンディング版StackChan 3体(4体)をインタラクティブな体験型作品にして展示もした話 / スタックチャンお誕生日会2026
you
PRO
0
190
When Platform Engineering Meets GenAI
sucitw
0
180
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
GitHub Copilot app最速の発信の裏側
tomokusaba
1
260
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
180
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Scaling GitHub
holman
464
140k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Claude Code のすすめ
schroneko
67
230k
HDC tutorial
michielstock
2
720
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
240
Faster Mobile Websites
deanohume
310
32k
Designing Experiences People Love
moore
143
24k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
Transcript
Zn 30 65.38 Vladimir Pouzanov <
[email protected]
>
rust
embedded
None
None
zinc
why rust?
fun
embedded
it's C and C++ all the way down
useful features
safe
expressive
still not 1.0
metaprogramming
a typical embedded program
think arduino "hello world" in rust
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
pub unsafe fn main() { init_stack();
init_data(); system_clock::init_clock(&Clock { source: system_clock::Main(12000000), pll: Some(PLL0 { m: 50, n: 3, divisor: 4 }) }); let timer = Timer::new(Timer1, 25, 4); let led1 = Pin::new(Port1, 18, GPIO, Some(Out)); let led2 = Pin::new(Port1, 20, GPIO, Some(Out)); loop { run(&pt::run_args { led1: &led1, led2: &led2, timer: &timer }); } }
fn run(args: &pt::run_args) { args.led1.set_high(); args.led2.set_low();
args.timer.wait(1); ! args.led1.set_low(); args.led2.set_high(); args.timer.wait(1); }
fn run(args: &pt::run_args) { args.led1.set_high(); args.led2.set_low();
args.timer.wait(1); ! args.led1.set_low(); args.led2.set_high(); args.timer.wait(1); } WHAT IF I SAY THIS IS THE ONLY CODE YOU NEED?
platform definition and verification in code
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
lpc17xx@mcu { clock {
source = "main-‐oscillator"; source_frequency = 12_000_000; pll { m = 50; n = 3; divisor = 4; } } ! timer { timer@1 { counter = 25; divisor = 4; } } ! gpio { 1 { led1@18 { direction = "out"; } led2@20 { direction = "out"; } } } } ! os { single_task { loop = "run"; args { timer = &timer; led1 = &led1; led2 = &led2; } } }
compile-time validation
example: configure SPI pin
None
Pin::new(Port1, 11, Function3, Some(Out)); X
spi_ck@11 { function = "sck"; }
spi_ck@11 { function = "sck"; }
hiding complexity from user
single_task { loop = "run";
args { timer = &timer; uart = &uart; dht = &dht; } } } ! pub struct run_args<'a, P, Q> { pub dht: &'a zinc::drivers::dht22::DHT22<'a, P, Q>, pub timer: &'a zinc::hal::lpc17xx::timer::Timer, pub uart: &'a zinc::hal::lpc17xx::uart::UART, }
#[zinc_task] fn run(args: &pt::run_args) {
... }
#[zinc_task] fn run(args: &pt::run_args) {
... }
fn run<P: zinc::hal::timer::Timer,
Q: zinc::hal::pin::GPIO>(args: &pt::run_args<P, Q>) { ... }
thanks! questions? http://vfp.in/zinc-london