mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Totally rework software serial to provide tx at the same time as rx using only one timer.
First cut at polymorphic serial port implementation. Split serialPort_t into uartPort_t and serialPort_t. Calls to uartWrite() can now be replaced with calls to serialWrite(). Replacing calls to serialWriteByte(softSerial_t*, char) with calls to serialWrite(serialPort_t*, char). This completes the proof of concept for polymorphic serial port implementations (uartPort and softSerialPort). Renaming isSerialAvailable to uartTotalBytesWaiting. Renaming serialAvailable to softSerialTotalBytesWaiting. Adding serialTotalBytesWaiting to serial API and updating calls to the former methods to use the serial API. Renaming serialRead to softSerialRead. Adding serialRead to serial API and updating calls to uartRead and softSerialRead to use the serial API. Renamed uartPrint to serialPrint which now works on any serialPort implementation. Replacing calls to isUartTransmitEmpty with isSoftSerialTransmitBufferEmpty. Replacing remaing calls to uartWrite with serialWrite. Adding isSoftSerialTransmitBufferEmpty to the serial API. Adding serialSet/GetBaudRate to the serial API. Since softSerial does not implement serialSetBaudRate some GPS serial initialisation code has been updated. At this point it is probably possible to switch around all the ports and use a software serial implementation if desired. By Dominic Clifton / https://github.com/hydra/baseflight/ git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@423 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
7c595e4110
commit
28d5927836
17 changed files with 523 additions and 265 deletions
|
@ -126,7 +126,7 @@ typedef void (* sensorInitFuncPtr)(sensor_align_e align); // sensor init proto
|
|||
typedef void (* sensorReadFuncPtr)(int16_t *data); // sensor read and align prototype
|
||||
typedef void (* baroOpFuncPtr)(void); // baro start operation
|
||||
typedef void (* baroCalculateFuncPtr)(int32_t *pressure, int32_t *temperature); // baro calculation (filled params are pressure and temperature)
|
||||
typedef void (* uartReceiveCallbackPtr)(uint16_t data); // used by uart2 driver to return frames to app
|
||||
typedef void (* serialReceiveCallbackPtr)(uint16_t data); // used by serial drivers to return frames to app
|
||||
typedef uint16_t (* rcReadRawDataPtr)(uint8_t chan); // used by receiver driver to return channel data
|
||||
typedef void (* pidControllerFuncPtr)(void); // pid controller function prototype
|
||||
|
||||
|
@ -244,6 +244,7 @@ typedef struct baro_t
|
|||
#include "drv_l3g4200d.h"
|
||||
#include "drv_pwm.h"
|
||||
#include "drv_timer.h"
|
||||
#include "drv_serial.h"
|
||||
#include "drv_uart.h"
|
||||
#include "drv_softserial.h"
|
||||
#else
|
||||
|
@ -264,6 +265,7 @@ typedef struct baro_t
|
|||
#include "drv_l3g4200d.h"
|
||||
#include "drv_pwm.h"
|
||||
#include "drv_timer.h"
|
||||
#include "drv_serial.h"
|
||||
#include "drv_uart.h"
|
||||
#include "drv_softserial.h"
|
||||
#include "drv_hcsr04.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue