Merge pull request #11939 from blckmn/flash-fix
[betaflight.git] / src / main / drivers / vtx_table.h
blob0783f8ab29b97db4fba22e2952c8c158c014c567
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 /* Created by jflyper */
23 #include <stdint.h>
25 #include "platform.h"
27 #include "drivers/vtx_common.h"
29 #ifdef USE_VTX_TABLE
30 #define VTX_TABLE_MAX_BANDS 8 // Maximum number of bands
31 #define VTX_TABLE_MAX_CHANNELS 8 // Maximum number of channels per band
32 #define VTX_TABLE_MAX_POWER_LEVELS 8 // Maximum number of power levels
33 #define VTX_TABLE_CHANNEL_NAME_LENGTH 1
34 #define VTX_TABLE_BAND_NAME_LENGTH 8
35 #define VTX_TABLE_POWER_LABEL_LENGTH 3
36 #else
37 #define VTX_TABLE_MAX_BANDS 5 // default freq table has 5 bands
38 #define VTX_TABLE_MAX_CHANNELS 8 // and eight channels
39 #define VTX_TABLE_MAX_POWER_LEVELS 5 //max of VTX_TRAMP_POWER_COUNT, VTX_SMARTAUDIO_POWER_COUNT and VTX_RTC6705_POWER_COUNT
40 #define VTX_TABLE_CHANNEL_NAME_LENGTH 1
41 #define VTX_TABLE_BAND_NAME_LENGTH 8
42 #define VTX_TABLE_POWER_LABEL_LENGTH 3
43 #endif
46 #define VTX_TABLE_MIN_USER_FREQ 5000
47 #define VTX_TABLE_MAX_USER_FREQ 5999
48 #define VTX_TABLE_DEFAULT_BAND 4
49 #define VTX_TABLE_DEFAULT_CHANNEL 1
50 #define VTX_TABLE_DEFAULT_FREQ 5740
51 #define VTX_TABLE_DEFAULT_PITMODE_FREQ 0
52 #define VTX_TABLE_DEFAULT_POWER 1 //1-based indexing. 0 means unknown and 1 is the lowest actual power mode
54 struct vtxTableConfig_s;
55 void vtxTableInit(void);
56 void vtxTableStrncpyWithPad(char *dst, const char *src, int length);
57 void vtxTableConfigClearBand(struct vtxTableConfig_s *config, int band);
58 void vtxTableConfigClearPowerValues(struct vtxTableConfig_s *config, int start);
59 void vtxTableConfigClearPowerLabels(struct vtxTableConfig_s *config, int start);
60 void vtxTableConfigClearChannels(struct vtxTableConfig_s *config, int band, int channels);
61 #ifndef USE_VTX_TABLE
62 void vtxTableSetFactoryBands(bool isFactory);
63 #endif
65 extern int vtxTableBandCount;
66 extern int vtxTableChannelCount;
67 extern uint16_t vtxTableFrequency[VTX_TABLE_MAX_BANDS][VTX_TABLE_MAX_CHANNELS];
68 extern const char *vtxTableBandNames[VTX_TABLE_MAX_BANDS + 1];
69 extern char vtxTableBandLetters[VTX_TABLE_MAX_BANDS + 1];
70 extern const char *vtxTableChannelNames[VTX_TABLE_MAX_CHANNELS + 1];
71 extern bool vtxTableIsFactoryBand[VTX_TABLE_MAX_BANDS];
72 extern int vtxTablePowerLevels;
73 extern uint16_t vtxTablePowerValues[VTX_TABLE_MAX_POWER_LEVELS];
74 extern const char *vtxTablePowerLabels[VTX_TABLE_MAX_POWER_LEVELS + 1];