intHardwareSerial::read(void){// if the head isn't ahead of the tail, we don't have any characters
if(_rx_buffer_head==_rx_buffer_tail){return-1;}else{unsignedcharc=_rx_buffer[_rx_buffer_tail];_rx_buffer_tail=(rx_buffer_index_t)(_rx_buffer_tail+1)%SERIAL_RX_BUFFER_SIZE;returnc;}}
入力はありません。戻り値はintです。
1
2
intHardwareSerial::read(void){
受信バッファのheadとtailが同じ場合は、何も受信していないので、-1を返します。
3
4
5
6
// if the head isn't ahead of the tail, we don't have any characters
if(_rx_buffer_head==_rx_buffer_tail){return-1;}else{