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
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
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
200
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
7
3.9k
OTel × Datadog で 「AI活用」を計測し、改善に繋げる
shihochan
2
800
AIが自律的に回る開発ループを設計してチーム開発に組み込む
nekorush14
0
130
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
130
水を運ぶ人としてのリーダーシップ
izumii19
4
1k
元銀行員がAIだけでアプリを量産!「バイブコーディング実演セミナー 」
tatsuya1970
0
110
クラウドファンディング版StackChan 3体(4体)をインタラクティブな体験型作品にして展示もした話 / スタックチャンお誕生日会2026
you
PRO
0
190
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
870
[チョークトーク資料]AWS DevOps Agent を使いこなす / AWS Dev Ops Agent Chalk Talk AWS Summit Japan 2026
kinunori
4
770
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
520
40代で“やっとエンジニアになれた”――閉じた学びを開き、空の青さを知る / 20260628 Naoki Takahashi
shift_evolve
PRO
4
890
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Color Theory Basics | Prateek | Gurzu
gurzu
0
370
Six Lessons from altMBA
skipperchong
29
4.3k
Scaling GitHub
holman
464
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Navigating Weather and Climate Data
rabernat
0
240
The Curse of the Amulet
leimatthew05
2
13k
Making Projects Easy
brettharned
120
6.7k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Mind Mapping
helmedeiros
PRO
1
260
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
Building a Scalable Design System with Sketch
lauravandoore
463
34k
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