mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
need implement fake eeprom & fake IO need implement fake system function can compile, stuck in isEEPROMContentValid() EEPROM in memory work EEPROM as file should work fix some complie warning MSP over TCP work (add dyad.c) a little clean up fix FLASH_CONFIG_Size in ld script & implement some pwmout IO to simulator work!! need to check direction & scale!! can fly but Gyro buggy move dyad.c fix busy-loop (limit to max 20kHz) can simulatie in different speed now! (hard code) add option for IMU calculation add README.md move dyad.c and fix F3 overrun the flash size explanation SITL in README.md and reuse CFLAGS, ASFLAGS
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
/*
|
|
* This file is part of Cleanflight.
|
|
*
|
|
* Cleanflight is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Cleanflight is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <netinet/in.h>
|
|
#include <pthread.h>
|
|
#include "dyad.h"
|
|
// Since serial ports can be used for any function these buffer sizes should be equal
|
|
// The two largest things that need to be sent are: 1, MSP responses, 2, UBLOX SVINFO packet.
|
|
|
|
// Size must be a power of two due to various optimizations which use 'and' instead of 'mod'
|
|
// Various serial routines return the buffer occupied size as uint8_t which would need to be extended in order to
|
|
// increase size further.
|
|
#define RX_BUFFER_SIZE 1400
|
|
#define TX_BUFFER_SIZE 1400
|
|
|
|
typedef struct {
|
|
serialPort_t port;
|
|
volatile uint8_t rxBuffer[RX_BUFFER_SIZE];
|
|
volatile uint8_t txBuffer[TX_BUFFER_SIZE];
|
|
|
|
dyad_Stream *serv;
|
|
dyad_Stream *conn;
|
|
pthread_mutex_t txLock;
|
|
pthread_mutex_t rxLock;
|
|
bool connected;
|
|
uint16_t clientCount;
|
|
uint8_t id;
|
|
} uartPort_t;
|
|
|
|
serialPort_t *uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr rxCallback, uint32_t baudRate, portMode_t mode, portOptions_t options);
|
|
|
|
// serialPort API
|
|
void tcpWrite(serialPort_t *instance, uint8_t ch);
|
|
void tcpDataIn(uartPort_t *instance, uint8_t* ch, int size);
|
|
uint32_t tcpTotalRxBytesWaiting(const serialPort_t *instance);
|
|
uint32_t tcpTotalTxBytesFree(const serialPort_t *instance);
|
|
uint8_t tcpRead(serialPort_t *instance);
|
|
void tcpDataOut(uartPort_t *instance);
|
|
bool isTcpTransmitBufferEmpty(const serialPort_t *s);
|
|
|
|
bool tcpIsStart(void);
|
|
bool* tcpGetUsed(void);
|
|
uartPort_t* tcpGetPool(void);
|
|
|