Complete KISSCC and fix simplex TX case

This commit is contained in:
jflyper 2017-02-10 22:07:29 +09:00 committed by borisbstyle
parent e34ad5d6c2
commit ddd78af0e7
2 changed files with 15 additions and 8 deletions

View File

@ -260,7 +260,16 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
return NULL;
softSerial->txIO = txIO;
softSerial->exTimerHardware = timerTx;
if (!(mode & MODE_RX)) {
// TX Simplex, must have a timer
if (!timerTx)
return NULL;
softSerial->timerHardware = timerTx;
} else {
// Duplex
softSerial->exTimerHardware = timerTx;
}
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex) + RESOURCE_SOFT_OFFSET);
}
}
@ -449,7 +458,6 @@ void processRxState(softSerial_t *softSerial)
void onSerialTimerOverflow(timerOvrHandlerRec_t *cbRec, captureCompare_t capture)
{
UNUSED(capture);
softSerial_t *self = container_of(cbRec, softSerial_t, overCb);
if (self->port.mode & MODE_TX)

View File

@ -64,7 +64,6 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10
@ -75,13 +74,13 @@
#define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7)
// XXX 11 is out of bound
/*
#ifdef KISSCC
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 11
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 11
#define USE_SOFTSERIAL1
#define SOFTSERIAL1_TX_PIN PA13
#define SERIAL_PORT_COUNT 5
#else
#define SERIAL_PORT_COUNT 4
#endif
*/
#define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA