MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / FanBusInterface

Method FanBusInterface

Controllers/FanBusController/FanBusInterface.cpp:13–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace std::chrono_literals;
12
13FanBusInterface::FanBusInterface(const char* portname)
14{
15 port_name = portname;
16 serialport = new serial_port(portname, 38400);
17
18 /*-----------------------------------------------------*\
19 | Flush any data in the receive queue |
20 \*-----------------------------------------------------*/
21 char read_buf[6];
22
23 while(serialport->serial_read(read_buf, 6) > 0)
24 {
25
26 }
27
28 read_buf[0] = 0xFF;
29
30 serialport->serial_write(read_buf, 1);
31
32 std::this_thread::sleep_for(10ms);
33
34 int test = serialport->serial_read(read_buf, 1);
35
36 if(test > 0)
37 {
38 half_duplex = true;
39 }
40 else
41 {
42 half_duplex = false;
43 }
44}
45
46FanBusInterface::~FanBusInterface()
47{

Callers

nothing calls this directly

Calls 2

serial_readMethod · 0.80
serial_writeMethod · 0.80

Tested by

no test coverage detected