2 * This file is free software: you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
7 * This file is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 * See the GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License along
13 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "AP_RCProtocol.h"
23 SERIAL_CONFIG_8N1
= 0, // DSM, SRXL etc, 8 bit, no parity, 1 stop bit
24 SERIAL_CONFIG_8E2I
= 1, // SBUS, 8 bit, even parity, 2 stop bits, inverted
25 SERIAL_CONFIG_8N1I
= 2, // FPort inverted, 8 bit, no parity, 1 stop bit
28 SoftSerial(uint32_t baudrate
, enum serial_config config
);
29 bool process_pulse(uint32_t width_s0
, uint32_t width_s1
, uint8_t &b
);
31 // get timestamp of the last byte
32 uint32_t get_byte_timestamp_us(void) const {
33 return byte_timestamp_us
;
36 uint32_t baud() const { return baudrate
; }
39 const uint32_t baudrate
;
40 const uint8_t half_bit
; // width of half a bit in microseconds
41 const enum serial_config config
;
46 uint32_t timestamp_us
;
47 uint32_t byte_timestamp_us
;