1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

rewritten drv_uart to suck slightly less

tested w/o GPS

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@382 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2013-08-22 07:48:07 +00:00
parent 1ff0036dec
commit cbb580f753
10 changed files with 403 additions and 321 deletions

View file

@ -48,29 +48,28 @@
// from sensors.c
extern uint8_t batteryCellCount;
static void sendDataHead(uint8_t id)
{
uartWrite(PROTOCOL_HEADER);
uartWrite(id);
uartWrite(core.telemport, PROTOCOL_HEADER);
uartWrite(core.telemport, id);
}
static void sendTelemetryTail(void)
{
uartWrite(PROTOCOL_TAIL);
uartWrite(core.telemport, PROTOCOL_TAIL);
}
static void serializeFrsky(uint8_t data)
{
// take care of byte stuffing
if (data == 0x5e) {
uartWrite(0x5d);
uartWrite(0x3e);
uartWrite(core.telemport, 0x5d);
uartWrite(core.telemport, 0x3e);
} else if (data == 0x5d) {
uartWrite(0x5d);
uartWrite(0x3d);
uartWrite(core.telemport, 0x5d);
uartWrite(core.telemport, 0x3d);
} else
uartWrite(data);
uartWrite(core.telemport, data);
}
static void serialize16(int16_t a)
@ -183,7 +182,7 @@ static void sendVoltage(void)
/*
* Send voltage with ID_VOLTAGE_AMP
*/
static void sendVoltageAmp()
static void sendVoltageAmp(void)
{
uint16_t voltage = (vbat * 110) / 21;