2:I[231,["231","static/chunks/231-7054a12985b3b868.js","173","static/chunks/173-6d8e00193ae3f76c.js","638","static/chunks/app/articles/hardwareprogrammierung/page-5143bd222856ca4c.js"],""] 3:I[9275,[],""] 4:I[1343,[],""] 5:I[1747,["231","static/chunks/231-7054a12985b3b868.js","173","static/chunks/173-6d8e00193ae3f76c.js","867","static/chunks/867-a87251d1c6093b7e.js","185","static/chunks/app/layout-9ab2d417c52414ab.js"],"Providers"] 6:I[5107,["231","static/chunks/231-7054a12985b3b868.js","173","static/chunks/173-6d8e00193ae3f76c.js","867","static/chunks/867-a87251d1c6093b7e.js","185","static/chunks/app/layout-9ab2d417c52414ab.js"],"SidebarLayout"] 0:["CNcemyiCksiu8DGDV_gau",[[["",{"children":["articles",{"children":["hardwareprogrammierung",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["articles",{"children":["hardwareprogrammierung",{"children":["__PAGE__",{},[["$L1",["$","div",null,{"className":"sm:px-8 mt-16 lg:mt-32","children":["$","div",null,{"className":"mx-auto w-full max-w-7xl lg:px-8","children":["$","div",null,{"className":"relative px-4 sm:px-8 lg:px-12","children":["$","div",null,{"className":"mx-auto max-w-2xl lg:max-w-5xl","children":["$","div",null,{"className":"xl:relative","children":["$","div",null,{"className":"mx-auto max-w-2xl","children":[["$","$L2",null,{"href":"/articles","aria-label":"Go back to articles","className":"group mb-8 flex h-10 w-10 items-center justify-center rounded-full bg-white ring-1 shadow-md shadow-zinc-800/5 ring-zinc-900/5 transition lg:absolute lg:-left-5 lg:-mt-2 lg:mb-0 xl:-top-1.5 xl:left-0 xl:mt-0 dark:border dark:border-zinc-700/50 dark:bg-zinc-800 dark:ring-0 dark:ring-white/10 dark:hover:border-zinc-700 dark:hover:ring-white/20","children":["$","svg",null,{"viewBox":"0 0 16 16","fill":"none","aria-hidden":"true","className":"h-4 w-4 stroke-zinc-500 transition group-hover:stroke-zinc-700 dark:stroke-zinc-500 dark:group-hover:stroke-zinc-400","children":["$","path",null,{"d":"M7.25 11.25 3.75 8m0 0 3.5-3.25M3.75 8h8.5","strokeWidth":"1.5","strokeLinecap":"round","strokeLinejoin":"round"}]}]}],["$","article",null,{"children":[["$","header",null,{"className":"flex flex-col","children":[["$","h1",null,{"className":"mt-6 text-4xl font-bold tracking-tight text-zinc-800 sm:text-5xl dark:text-zinc-100","children":"Hardwareprogrammierung mit Rust und Low-Level-Optimierung"}],["$","time",null,{"dateTime":"2024-12-08","className":"order-first flex items-center text-base text-zinc-400 dark:text-zinc-500","children":[["$","span",null,{"className":"h-4 w-0.5 rounded-full bg-zinc-200 dark:bg-zinc-500"}],["$","span",null,{"className":"ml-3","children":"8. Dezember 2024"}]]}]]}],["$","div",null,{"className":"mt-8 prose dark:prose-invert","data-mdx-content":true,"children":[["$","p",null,{"children":"Als Entwickler mit Hintergrund in Technischer Informatik habe ich schon immer eine Faszination für die Verbindung zwischen Software und Hardware verspürt. Nach Jahren der Arbeit mit Hochsprachen wie JavaScript und Python wollte ich tiefer in die systemnahe Programmierung eintauchen. Die Wahl fiel auf Rust – eine Sprache, die Leistung und Sicherheit auf beeindruckende Weise vereint."}],"\n",["$","h2",null,{"children":"Warum Rust für Hardware-Programmierung?"}],"\n",["$","p",null,{"children":"Rust bietet eine einzigartige Kombination aus Leistung, Sicherheitsgarantien und modernen Sprachfeatures. Im Gegensatz zu C oder C++ verhindert das Ownership-System von Rust zur Kompilierzeit viele der typischen Fehlerquellen wie Speicherlecks, Null-Pointer-Dereferenzierungen und Race Conditions."}],"\n",["$","p",null,{"children":"Ein einfaches Beispiel für die Interaktion mit GPIO-Pins auf einem Embedded-System könnte in Rust so aussehen:"}],"\n",["$","pre",null,{"className":"language-rust","children":["$","code",null,{"className":"language-rust","children":[["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["embedded_hal",["$","span",null,{"className":"token punctuation","children":"::"}],"digital",["$","span",null,{"className":"token punctuation","children":"::"}],"v2",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token class-name","children":"OutputPin"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n",["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["rppal",["$","span",null,{"className":"token punctuation","children":"::"}],"gpio",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token punctuation","children":"{"}],["$","span",null,{"className":"token class-name","children":"Gpio"}],["$","span",null,{"className":"token punctuation","children":","}]," ",["$","span",null,{"className":"token class-name","children":"OutputPin"}]," ",["$","span",null,{"className":"token keyword","children":"as"}]," ",["$","span",null,{"className":"token class-name","children":"RppalOutputPin"}],["$","span",null,{"className":"token punctuation","children":"}"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n",["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["std",["$","span",null,{"className":"token punctuation","children":"::"}],"error",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token class-name","children":"Error"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n",["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["std",["$","span",null,{"className":"token punctuation","children":"::"}]]}],"thread",["$","span",null,{"className":"token punctuation","children":";"}],"\n",["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["std",["$","span",null,{"className":"token punctuation","children":"::"}],"time",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token class-name","children":"Duration"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n\n",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"main"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"->"}]," ",["$","span",null,{"className":"token class-name","children":"Result"}],["$","span",null,{"className":"token operator","children":"<"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":","}]," ",["$","span",null,{"className":"token class-name","children":"Box"}],["$","span",null,{"className":"token operator","children":"<"}],["$","span",null,{"className":"token keyword","children":"dyn"}]," ",["$","span",null,{"className":"token class-name","children":"Error"}],["$","span",null,{"className":"token operator","children":">>"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// GPIO-Pin 17 für die LED-Steuerung initialisieren"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," ",["$","span",null,{"className":"token keyword","children":"mut"}]," pin ",["$","span",null,{"className":"token operator","children":"="}]," ",["$","span",null,{"className":"token class-name","children":"Gpio"}],["$","span",null,{"className":"token punctuation","children":"::"}],["$","span",null,{"className":"token function","children":"new"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token operator","children":"?"}],["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"get"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token number","children":"17"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token operator","children":"?"}],["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"into_output"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n\n ",["$","span",null,{"className":"token comment","children":"// LED 10 Mal blinken lassen"}],"\n ",["$","span",null,{"className":"token keyword","children":"for"}]," _ ",["$","span",null,{"className":"token keyword","children":"in"}]," ",["$","span",null,{"className":"token number","children":"0"}],["$","span",null,{"className":"token punctuation","children":".."}],["$","span",null,{"className":"token number","children":"10"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n pin",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"set_high"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token namespace","children":["thread",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token function","children":"sleep"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token class-name","children":"Duration"}],["$","span",null,{"className":"token punctuation","children":"::"}],["$","span",null,{"className":"token function","children":"from_millis"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token number","children":"200"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n pin",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"set_low"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token namespace","children":["thread",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token function","children":"sleep"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token class-name","children":"Duration"}],["$","span",null,{"className":"token punctuation","children":"::"}],["$","span",null,{"className":"token function","children":"from_millis"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token number","children":"200"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n\n ",["$","span",null,{"className":"token class-name","children":"Ok"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":")"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n"]}]}],"\n",["$","p",null,{"children":"Die Eleganz dieses Codes liegt nicht nur in seiner Lesbarkeit, sondern auch in den Sicherheitsgarantien. Der Compiler stellt sicher, dass wir nicht versehentlich auf Hardware-Ressourcen zugreifen, die bereits anderweitig verwendet werden."}],"\n",["$","h2",null,{"children":"Performance-Optimierung auf niedriger Ebene"}],"\n",["$","p",null,{"children":"Bei der Low-Level-Programmierung ist Performanceoptimierung entscheidend. Hier ein Beispiel für eine optimierte Funktion zur schnellen Berechnung auf rohen Byte-Arrays:"}],"\n",["$","pre",null,{"className":"language-rust","children":["$","code",null,{"className":"language-rust","children":[["$","span",null,{"className":"token attribute attr-name","children":"#[inline(always)]"}],"\n",["$","span",null,{"className":"token keyword","children":"pub"}]," ",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"process_buffer"}],["$","span",null,{"className":"token punctuation","children":"("}],"buffer",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token operator","children":"&"}],["$","span",null,{"className":"token keyword","children":"mut"}]," ",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token keyword","children":"u8"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// SIMD-Optimierung, wenn verfügbar"}],"\n ",["$","span",null,{"className":"token attribute attr-name","children":["#[cfg(target_arch = ",["$","span",null,{"className":"token string","children":"\"x86_64\""}],")]"]}],"\n ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"if"}]," ",["$","span",null,{"className":"token macro property","children":"is_x86_feature_detected!"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token string","children":"\"avx2\""}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"return"}]," ",["$","span",null,{"className":"token keyword","children":"unsafe"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}]," ",["$","span",null,{"className":"token function","children":"process_buffer_avx2"}],["$","span",null,{"className":"token punctuation","children":"("}],"buffer",["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"}"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n\n ",["$","span",null,{"className":"token comment","children":"// Fallback für andere Architekturen"}],"\n ",["$","span",null,{"className":"token keyword","children":"for"}]," chunk ",["$","span",null,{"className":"token keyword","children":"in"}]," buffer",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"chunks_mut"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token number","children":"4"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"if"}]," chunk",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"len"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token operator","children":"=="}]," ",["$","span",null,{"className":"token number","children":"4"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," value ",["$","span",null,{"className":"token operator","children":"="}]," ",["$","span",null,{"className":"token keyword","children":"u32"}],["$","span",null,{"className":"token punctuation","children":"::"}],["$","span",null,{"className":"token function","children":"from_le_bytes"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":"["}],"chunk",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token number","children":"0"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":","}]," chunk",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token number","children":"1"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":","}]," chunk",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token number","children":"2"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":","}]," chunk",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token number","children":"3"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," processed ",["$","span",null,{"className":"token operator","children":"="}]," value",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"wrapping_mul"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token number","children":"0xDEADBEEF"}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," result ",["$","span",null,{"className":"token operator","children":"="}]," processed",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"to_le_bytes"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n chunk",["$","span",null,{"className":"token punctuation","children":"."}],["$","span",null,{"className":"token function","children":"copy_from_slice"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token operator","children":"&"}],"result",["$","span",null,{"className":"token punctuation","children":")"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n\n",["$","span",null,{"className":"token attribute attr-name","children":["#[cfg(target_arch = ",["$","span",null,{"className":"token string","children":"\"x86_64\""}],")]"]}],"\n",["$","span",null,{"className":"token attribute attr-name","children":["#[target_feature(enable = ",["$","span",null,{"className":"token string","children":"\"avx2\""}],")]"]}],"\n",["$","span",null,{"className":"token keyword","children":"unsafe"}]," ",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"process_buffer_avx2"}],["$","span",null,{"className":"token punctuation","children":"("}],"buffer",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token operator","children":"&"}],["$","span",null,{"className":"token keyword","children":"mut"}]," ",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token keyword","children":"u8"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"use"}]," ",["$","span",null,{"className":"token namespace","children":["std",["$","span",null,{"className":"token punctuation","children":"::"}],"arch",["$","span",null,{"className":"token punctuation","children":"::"}],"x86_64",["$","span",null,{"className":"token punctuation","children":"::"}]]}],["$","span",null,{"className":"token operator","children":"*"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n\n ",["$","span",null,{"className":"token comment","children":"// SIMD-Implementierung für AVX2"}],"\n ",["$","span",null,{"className":"token comment","children":"// (Komplexere Implementierung hier)"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n"]}]}],"\n",["$","p",null,{"children":"Diese Implementierung zeigt, wie Rust es ermöglicht, architekturspezifische Optimierungen zu nutzen, während die Fallback-Lösung sicher und portabel bleibt."}],"\n",["$","h2",null,{"children":"Der Übergang von Hochsprachen zu systemnaher Programmierung"}],"\n",["$","p",null,{"children":"Der Wechsel von Hochsprachen wie JavaScript zu Rust war herausfordernd, aber lohnend. Eine der größten Umstellungen war das Denken in Bezug auf Speicherverwaltung und Ownership. In JavaScript kümmert sich die Garbage Collection um den Speicher, in Rust muss ich explizit über Lebensdauer und Besitzverhältnisse nachdenken."}],"\n",["$","p",null,{"children":"Besonders interessant fand ich die Integration von Rust in bestehende Systeme. Mit WebAssembly lassen sich Rust-Module nahtlos in Webanwendungen integrieren:"}],"\n",["$","pre",null,{"className":"language-rust","children":["$","code",null,{"className":"language-rust","children":[["$","span",null,{"className":"token comment","children":"// Eine Funktion zur Bildverarbeitung, die in WebAssembly kompiliert werden kann"}],"\n",["$","span",null,{"className":"token attribute attr-name","children":"#[wasm_bindgen]"}],"\n",["$","span",null,{"className":"token keyword","children":"pub"}]," ",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"process_image"}],["$","span",null,{"className":"token punctuation","children":"("}],"pixels",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token operator","children":"&"}],["$","span",null,{"className":"token keyword","children":"mut"}]," ",["$","span",null,{"className":"token punctuation","children":"["}],["$","span",null,{"className":"token keyword","children":"u32"}],["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":","}]," width",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token keyword","children":"usize"}],["$","span",null,{"className":"token punctuation","children":","}]," height",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token keyword","children":"usize"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// Hochperformante Bildverarbeitung in Rust"}],"\n ",["$","span",null,{"className":"token keyword","children":"for"}]," y ",["$","span",null,{"className":"token keyword","children":"in"}]," ",["$","span",null,{"className":"token number","children":"0"}],["$","span",null,{"className":"token punctuation","children":".."}],"height ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"for"}]," x ",["$","span",null,{"className":"token keyword","children":"in"}]," ",["$","span",null,{"className":"token number","children":"0"}],["$","span",null,{"className":"token punctuation","children":".."}],"width ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," idx ",["$","span",null,{"className":"token operator","children":"="}]," y ",["$","span",null,{"className":"token operator","children":"*"}]," width ",["$","span",null,{"className":"token operator","children":"+"}]," x",["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token keyword","children":"let"}]," pixel ",["$","span",null,{"className":"token operator","children":"="}]," pixels",["$","span",null,{"className":"token punctuation","children":"["}],"idx",["$","span",null,{"className":"token punctuation","children":"]"}],["$","span",null,{"className":"token punctuation","children":";"}],"\n\n ",["$","span",null,{"className":"token comment","children":"// Einfache Farbumkehrung als Beispiel"}],"\n pixels",["$","span",null,{"className":"token punctuation","children":"["}],"idx",["$","span",null,{"className":"token punctuation","children":"]"}]," ",["$","span",null,{"className":"token operator","children":"="}]," ",["$","span",null,{"className":"token number","children":"0xFFFFFFFF"}]," ",["$","span",null,{"className":"token operator","children":"-"}]," pixel",["$","span",null,{"className":"token punctuation","children":";"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n ",["$","span",null,{"className":"token punctuation","children":"}"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n"]}]}],"\n",["$","h2",null,{"children":"Hardware-Programmierung und IoT-Projekte"}],"\n",["$","p",null,{"children":"In meinen Freizeit-Projekten kombiniere ich gerne meine Leidenschaft für Hardware und Programmierung. Ein aktuelles Projekt beinhaltet einen selbstgebauten Fahrsimulator mit Rust als Steuerungssoftware. Dabei war es besonders wertvoll, dass Rust sowohl für die Low-Level-Steuerung der Sensoren und Aktuatoren als auch für die Datenverarbeitung und Visualisierung eingesetzt werden kann."}],"\n",["$","pre",null,{"className":"language-rust","children":["$","code",null,{"className":"language-rust","children":[["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"read_sensors"}],["$","span",null,{"className":"token punctuation","children":"("}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"->"}]," ",["$","span",null,{"className":"token class-name","children":"SensorData"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// Lesen der Beschleunigungssensoren, Drucksensoren usw."}],"\n ",["$","span",null,{"className":"token comment","children":"// Echtzeitverarbeitung der Daten"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n\n",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"update_physics_model"}],["$","span",null,{"className":"token punctuation","children":"("}],"data",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token class-name","children":"SensorData"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"->"}]," ",["$","span",null,{"className":"token class-name","children":"PhysicsState"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// Berechnung des Fahrzeugverhaltens basierend auf Sensordaten"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n\n",["$","span",null,{"className":"token keyword","children":"fn"}]," ",["$","span",null,{"className":"token function-definition function","children":"update_force_feedback"}],["$","span",null,{"className":"token punctuation","children":"("}],"state",["$","span",null,{"className":"token punctuation","children":":"}]," ",["$","span",null,{"className":"token operator","children":"&"}],["$","span",null,{"className":"token class-name","children":"PhysicsState"}],["$","span",null,{"className":"token punctuation","children":")"}]," ",["$","span",null,{"className":"token punctuation","children":"{"}],"\n ",["$","span",null,{"className":"token comment","children":"// Steuerung der Motoren für Force-Feedback basierend auf dem physikalischen Modell"}],"\n",["$","span",null,{"className":"token punctuation","children":"}"}],"\n"]}]}],"\n",["$","h2",null,{"children":"Fazit und Ausblick"}],"\n",["$","p",null,{"children":"Nach über einem Jahr intensiver Arbeit mit Rust für Hardware-Projekte bin ich überzeugt, dass die Sprache eine hervorragende Wahl für systemnahe Programmierung ist. Die Kombination aus Sicherheit, Leistung und modernen Sprachfeatures macht sie ideal für anspruchsvolle Projekte."}],"\n",["$","p",null,{"children":"In Zukunft plane ich, meine Kenntnisse in der FPGA-Programmierung mit Rust zu vertiefen und weitere Hardware-Projekte umzusetzen. Die Rust-Community wächst stetig, und die Unterstützung für Embedded-Systeme verbessert sich kontinuierlich."}],"\n",["$","p",null,{"children":"Wenn du selbst in die Welt der Hardware-Programmierung mit Rust einsteigen möchtest, kann ich nur empfehlen, mit kleinen Projekten zu beginnen und sich nach und nach zu steigern. Die Lernkurve mag steil sein, aber die Ergebnisse sind die Mühe definitiv wert."}]]}]]}]]}]}]}]}]}]}]],null],null]},["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","articles","children","hardwareprogrammierung","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","articles","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},[["$","html",null,{"lang":"en","className":"h-full antialiased","suppressHydrationWarning":true,"children":["$","body",null,{"className":"flex h-full bg-zinc-50 dark:bg-black","children":["$","$L5",null,{"children":["$","div",null,{"className":"flex w-full","children":["$","div",null,{"className":"relative min-h-screen","children":[["$","div",null,{"className":"fixed inset-0 bg-white ring-1 ring-zinc-100 dark:bg-zinc-900 dark:ring-zinc-300/20"}],["$","div",null,{"className":"relative","children":["$","$L6",null,{"children":["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","main",null,{"className":"flex-1 px-4 sm:px-6 lg:px-8 py-8","children":["$","div",null,{"className":"mx-auto max-w-2xl lg:max-w-5xl","children":["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","div",null,{"className":"sm:px-8 flex h-full items-center pt-16 sm:pt-32","children":["$","div",null,{"className":"mx-auto w-full max-w-7xl lg:px-8","children":["$","div",null,{"className":"relative px-4 sm:px-8 lg:px-12","children":["$","div",null,{"className":"mx-auto max-w-2xl lg:max-w-5xl","children":["$","div",null,{"className":"flex flex-col items-center","children":[["$","p",null,{"className":"text-base font-semibold text-teal-500 dark:text-teal-400","children":"404"}],["$","h1",null,{"className":"mt-4 text-4xl font-bold tracking-tight text-zinc-800 sm:text-5xl dark:text-zinc-100","children":"Seite nicht gefunden"}],["$","p",null,{"className":"mt-4 text-base text-zinc-600 dark:text-zinc-400","children":"Entschuldigung, die gesuchte Seite konnte nicht gefunden werden."}],["$","div",null,{"className":"mt-8 flex space-x-4","children":[["$","$L2",null,{"className":"inline-flex items-center gap-2 justify-center rounded-md py-2 px-3 text-sm outline-offset-2 transition active:transition-none bg-zinc-800 font-semibold text-zinc-100 hover:bg-zinc-700 active:bg-zinc-800 active:text-zinc-100/70 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:active:bg-zinc-700 dark:active:text-zinc-100/70 transition-all duration-300 hover:scale-105","href":"/","children":"Zurück zur Startseite"}],["$","$L2",null,{"className":"inline-flex items-center gap-2 justify-center rounded-md py-2 px-3 text-sm outline-offset-2 transition active:transition-none bg-zinc-50 font-medium text-zinc-900 hover:bg-zinc-100 active:bg-zinc-100 active:text-zinc-900/60 dark:bg-zinc-800/50 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-zinc-50 dark:active:bg-zinc-800/50 dark:active:text-zinc-50/70 transition-all duration-300 hover:scale-105","href":"/projects","children":"Projekte entdecken"}]]}],["$","p",null,{"className":"mt-12 text-sm text-zinc-500 dark:text-zinc-500","children":["Du suchst etwas Bestimmtes? Schreib mir gerne eine"," ",["$","a",null,{"href":"mailto:christianc.pana@icloud.com","className":"text-teal-500 underline hover:text-teal-600 dark:text-teal-400 dark:hover:text-teal-300","children":"E-Mail"}],"."]}]]}]}]}]}]}],"notFoundStyles":[],"styles":null}]}]}],["$","footer",null,{"className":"mt-32 flex-none","children":["$","div",null,{"className":"sm:px-8","children":["$","div",null,{"className":"mx-auto w-full max-w-7xl lg:px-8","children":["$","div",null,{"className":"border-t border-zinc-100 pt-10 pb-16 dark:border-zinc-700/40","children":["$","div",null,{"className":"relative px-4 sm:px-8 lg:px-12","children":["$","div",null,{"className":"mx-auto max-w-2xl lg:max-w-5xl","children":["$","div",null,{"className":"flex flex-col items-center justify-between gap-6 md:flex-row","children":[["$","div",null,{"className":"flex flex-wrap justify-center gap-x-6 gap-y-1 text-sm font-medium text-zinc-800 dark:text-zinc-200","children":[["$","$L2",null,{"href":"/about","className":"transition hover:text-sky-500 dark:hover:text-sky-400","children":"Über mich"}],["$","$L2",null,{"href":"/projects","className":"transition hover:text-sky-500 dark:hover:text-sky-400","children":"Projekte"}],["$","$L2",null,{"href":"/uses","className":"transition hover:text-sky-500 dark:hover:text-sky-400","children":"Hardware"}]]}],["$","p",null,{"className":"text-sm text-zinc-400 dark:text-zinc-500","children":["© ",2025," Christian Pana. All rights reserved."]}]]}]}]}]}]}]}]}]]}]}]}]]}]}]}]}]}],null],null],[[["$","link","0",{"rel":"stylesheet","href":"./_next/static/css/7cfd9be33ea86463.css","precedence":"next","crossOrigin":"$undefined"}]],"$L7"]]]] 7:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Hardwareprogrammierung mit Rust und Low-Level-Optimierung - Christian Pana"}],["$","meta","3",{"name":"description","content":"Nach Jahren der Entwicklung mit verschiedenen Hochsprachen habe ich mich intensiv mit Rust für Low-Level-Hardwareprogrammierung beschäftigt. Hier sind meine Erfahrungen, warum Rust die perfekte Wahl für systemnahe Programmierung ist und wie es meine Herangehensweise an Optimierung verändert hat."}],["$","link","4",{"rel":"alternate","type":"application/rss+xml","href":"https://softflow.dev/feed.xml"}],["$","link","5",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"4096x4096"}]] 1:null