5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef OPENTX_MULTI_FIRMWARE_H
22 #define OPENTX_MULTI_FIRMWARE_H
26 /* Signature format is multi-[board type]-[bootloader support][check for bootloader][multi telemetry type][telemetry inversion][debug]-[firmware version]
28 [board type] is avr, stm, or orx
29 [bootloader support] b for optiboot (AVR) / USB (STM) or u (unsupported)
30 [check for bootloader] is c (CHECK_FOR_BOOTLOADER) or u (undefined)
31 [telemetry type] is t (MULTI_TELEMETRY), s (MULTI_STATUS), or u (undefined) for neither
32 [telemetry inversion] is i (INVERT_TELEMETRY) or u (undefined)
33 [firmware version] is the version padded to two bytes per segment, without seperators e.g. 01020176
35 For example: REM multi-stm-bcsid-01020176
38 class MultiFirmwareInformation
{
40 enum MultiFirmwareBoardType
{
41 FIRMWARE_MULTI_AVR
= 0,
46 enum MultiFirmwareTelemetryType
{
47 FIRMWARE_MULTI_TELEM_NONE
= 0,
48 FIRMWARE_MULTI_TELEM_MULTI_STATUS
, // erSkyTX
49 FIRMWARE_MULTI_TELEM_MULTI_TELEMETRY
, // OpenTX
52 bool isMultiStmFirmware() const
54 return boardType
== FIRMWARE_MULTI_STM
;
57 bool isMultiAvrFirmware() const
59 return boardType
== FIRMWARE_MULTI_AVR
;
62 bool isMultiOrxFirmware() const
64 return boardType
== FIRMWARE_MULTI_ORX
;
67 bool isMultiWithBootloaderFirmware() const
69 return optibootSupport
;
72 bool isMultiInternalFirmware() const
74 return (boardType
== FIRMWARE_MULTI_STM
&& telemetryInversion
== false && optibootSupport
== true && bootloaderCheck
== true && telemetryType
== FIRMWARE_MULTI_TELEM_MULTI_TELEMETRY
);
77 bool isMultiExternalFirmware() const
79 return (telemetryInversion
== true && optibootSupport
== true && bootloaderCheck
== true && telemetryType
== FIRMWARE_MULTI_TELEM_MULTI_TELEMETRY
);
82 const char * readMultiFirmwareInformation(const char * filename
);
83 const char * readMultiFirmwareInformation(FIL
* file
);
86 bool optibootSupport
:1;
87 bool telemetryInversion
:1;
88 bool bootloaderCheck
:1;
90 uint8_t telemetryType
:2;
94 uint8_t firmwareVersionMajor;
95 uint8_t firmwareVersionMinor;
96 uint8_t firmwareVersionRevision;
97 uint8_t firmwareVersionSubRevision;
100 const char * readV1Signature(const char * buffer
);
101 const char * readV2Signature(const char * buffer
);
104 bool multiFlashFirmware(uint8_t module
, const char * filename
);
106 #endif //OPENTX_MULTI_FIRMWARE_H