2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
26 #include "drivers/serial.h"
27 #include "drivers/serial_softserial.h"
28 #include "drivers/serial_uart.h"
30 #include "io/serial.h"
33 #include "pg/pg_ids.h"
36 void serialInit(bool softserialEnabled
, serialPortIdentifier_e serialPortToDisable
);
38 PG_REGISTER(rxConfig_t
, rxConfig
, PG_RX_CONFIG
, 0);
41 #include "unittest_macros.h"
42 #include "gtest/gtest.h"
44 TEST(IoSerialTest
, TestFindPortConfig
)
47 serialInit(false, SERIAL_PORT_NONE
);
50 const serialPortConfig_t
*portConfig
= findSerialPortConfig(FUNCTION_MSP
);
53 EXPECT_EQ(NULL
, portConfig
);
59 void delay(uint32_t) {}
61 bool isSerialTransmitBufferEmpty(const serialPort_t
*) { return true; }
63 void systemResetToBootloader(void) {}
65 bool telemetryCheckRxPortShared(const serialPortConfig_t
*) { return false; }
67 uint32_t serialRxBytesWaiting(const serialPort_t
*) { return 0; }
68 uint8_t serialRead(serialPort_t
*) { return 0; }
69 void serialWrite(serialPort_t
*, uint8_t) {}
71 serialPort_t
*usbVcpOpen(void) { return NULL
; }
73 serialPort_t
*uartOpen(UARTDevice_e
, serialReceiveCallbackPtr
, void *, uint32_t, portMode_e
, portOptions_e
) {
77 serialPort_t
*openSoftSerial(softSerialPortIndex_e
, serialReceiveCallbackPtr
, void *, uint32_t, portMode_e
, portOptions_e
) {
81 void serialSetCtrlLineStateCb(serialPort_t
*, void (*)(void *, uint16_t ), void *) {}
82 void serialSetCtrlLineState(serialPort_t
*, uint16_t ) {}
83 uint32_t serialTxBytesFree(const serialPort_t
*) {return 1;}
85 void serialSetBaudRateCb(serialPort_t
*, void (*)(serialPort_t
*context
, uint32_t baud
), serialPort_t
*) {}
87 void pinioSet(int, bool) {}