MCPcopy Create free account
hub / github.com/bdring/FluidNC / uart_write

Function uart_write

FluidNC/capture/fnc_uart.cpp:61–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61int uart_write(uint32_t uart_num, const uint8_t* buf, size_t len) {
62 if (vfd_simulator[uart_num]) {
63 int32_t this_ms = get_ms();
64 vfd_simulator[uart_num]->update((int32_t)this_ms - (int32_t)vfd_ms);
65 vfd_ms = this_ms;
66 vfd_output = vfd_simulator[uart_num]->processModbusMessage(std::vector<uint8_t> { buf, buf + len });
67
68 return 0;
69 }
70
71 auto key = uart_key(uart_num);
72 auto val = Inputs::instance().get(key);
73 for (size_t i = 0; i < len; ++i) {
74 val.push_back(uint32_t(uint8_t(buf[i])));
75 }
76 Inputs::instance().set(key, val);
77 return int(len);
78}
79
80void uart_mode(uint32_t uart_num, uint32_t baud, UartData dataBits, UartParity parity, UartStop stopBits) {}
81

Callers

nothing calls this directly

Calls 6

get_msFunction · 0.85
processModbusMessageMethod · 0.80
uart_keyFunction · 0.70
updateMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected