| 59 | } |
| 60 | |
| 61 | int 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 | |
| 80 | void uart_mode(uint32_t uart_num, uint32_t baud, UartData dataBits, UartParity parity, UartStop stopBits) {} |
| 81 | |