MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / _write_fd

Method _write_fd

libraries/AP_HAL_Linux/SPIUARTDriver.cpp:91–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91int SPIUARTDriver::_write_fd(const uint8_t *buf, uint16_t size)
92{
93 if (_external) {
94 return UARTDriver::_write_fd(buf,size);
95 }
96
97 if (!_dev->get_semaphore()->take_nonblocking()) {
98 return 0;
99 }
100
101 _dev->transfer_fullduplex(buf, _buffer, size);
102
103 _dev->get_semaphore()->give();
104
105 uint16_t ret = size;
106
107 /* Since all SPI-transactions are transfers we need update
108 * the _readbuf. I do believe there is a way to encapsulate
109 * this operation since it's the same as in the
110 * UARTDriver::write().
111 */
112 _readbuf.write(_buffer, size);
113
114 return ret;
115}
116
117int SPIUARTDriver::_read_fd(uint8_t *buf, uint16_t n)
118{

Callers

nothing calls this directly

Calls 5

take_nonblockingMethod · 0.45
get_semaphoreMethod · 0.45
transfer_fullduplexMethod · 0.45
giveMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected