| 89 | } |
| 90 | |
| 91 | int 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 | |
| 117 | int SPIUARTDriver::_read_fd(uint8_t *buf, uint16_t n) |
| 118 | { |
nothing calls this directly
no test coverage detected