flowrs-engine/e2e/fixtures/firmware/mcu_io.fdsl
flowRS fd958c0547 flowRS engine, cut from flowRS 3451b065
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 19:04:39 -05:00

11 lines
910 B
Text

//! title: A board echoes its UART, reads a sensor and the ADC, and lights an LED while a button is up
//! description: Every embedded widget but PWM, as the board generator's own tests have them (codegen::board's io graph): the UART echoes up to 8 bytes, an I2C sensor at address 72 feeds an SPI transfer, the ADC and the interval timer run, and pin 11 is driven to the opposite of pin 10, high when anything fails. Exported with flowrsc firmware for the Nucleo-F401RE or the Pico.
let n0 = embedded.uart.read { max_len: 8 };
let n1 = embedded.uart.write(data: n0.data);
let n2 = embedded.i2c.read { address: 72, length: 2 };
let n3 = embedded.spi.transfer(tx_data: n2.data) { cs_pin: 9 };
let n4 = embedded.adc;
let n5 = embedded.timer.interval;
let n6 = embedded.gpio.digital_in { pin: 10 };
let n7 = logic.not(value: n6.state);
let n8 = embedded.gpio.digital_out(state: n7.result) { pin: 11, safe: high };