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

Method read

Controllers/FanBusController/FanBusInterface.cpp:57–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57int FanBusInterface::read
58 (
59 unsigned char dev_addr,
60 unsigned char int_addr
61 )
62{
63 unsigned char fanbus_msg[] = { 0x01, int_addr, dev_addr, 0x00, 0xFF };
64
65 serialport->serial_write((char *)fanbus_msg, 5);
66
67 std::this_thread::sleep_for(10ms);
68
69 char read_buf[6];
70
71 if(half_duplex)
72 {
73 if(serialport->serial_read(read_buf, 6) == 6)
74 {
75 return(read_buf[5]);
76 }
77 else
78 {
79 return(-1);
80 }
81 }
82 else
83 {
84 if(serialport->serial_read(read_buf, 1) == 1)
85 {
86 return(read_buf[0]);
87 }
88 else
89 {
90 return(-1);
91 }
92 }
93}
94
95int FanBusInterface::write
96 (

Callers

nothing calls this directly

Calls 2

serial_writeMethod · 0.80
serial_readMethod · 0.80

Tested by

no test coverage detected