2 * Author - Bertrand Songis <bsongis@gmail.com>
4 * Based on th9x -> http://code.google.com/p/th9x/
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
19 #if !defined(NUM_LOGICAL_SWITCH) && defined(NUM_CSW)
20 #define NUM_LOGICAL_SWITCH NUM_CSW
30 #ifdef SETVALUES_IMPORT
31 #undef SETVALUES_IMPORT
32 for (int i
=0; i
<NUM_STICKS
; i
++)
33 g_anas
[i
] = inputs
.sticks
[i
];
34 for (int i
=0; i
<NUM_POTS
; i
++)
35 g_anas
[NUM_STICKS
+i
] = inputs
.pots
[i
];
36 for (int i
=0; i
<C9X_NUM_SWITCHES
; i
++)
37 simuSetSwitch(i
, inputs
.switches
[i
]);
38 for (int i
=0; i
<C9X_NUM_KEYS
; i
++)
39 simuSetKey(i
, inputs
.keys
[i
]);
40 for (int i
=0; i
<NUM_STICKS
*2; i
++)
41 simuSetTrim(i
, inputs
.trims
[i
]);
46 if (inputs
.rotenc
) pind
|= 0x20;
50 if (inputs
.rotenc
) PIOB
->PIO_PDSR
&= ~0x40; else PIOB
->PIO_PDSR
|= 0x40;
53 #if defined(PCBTARANIS) && defined(REV9E)
54 if (inputs
.rotenc
) simuSetKey(KEY_ENTER
, true);
58 #ifdef GETVALUES_IMPORT
59 #undef GETVALUES_IMPORT
60 memset(outputs
.chans
, 0, sizeof(outputs
.chans
));
61 for (unsigned int i
=0; i
<DIM(g_chans512
); i
++)
62 outputs
.chans
[i
] = g_chans512
[i
];
63 for (int i
=0; i
<NUM_LOGICAL_SWITCH
; i
++)
64 #if defined(BOLD_FONT)
65 outputs
.vsw
[i
] = getSwitch(SWSRC_SW1
+i
);
67 outputs
.vsw
[i
] = getSwitch(SWSRC_SW1
+i
, 0);
69 #ifdef GVAR_VALUE // defined(GVARS)
70 /* TODO it could be a good idea instead of getPhase() / getPhaseName() outputs.phase = getFlightMode(); */
72 for (int fm
=0; fm
<MAX_FLIGHT_MODES
; fm
++) {
73 for (int gv
=0; gv
<MAX_GVARS
; gv
++) {
74 outputs
.gvars
[fm
][gv
] = GVAR_VALUE(gv
, getGVarFlightPhase(fm
, gv
));
79 #endif //GETVALUES_IMPORT
81 #ifdef LCDCHANGED_IMPORT
82 #undef LCDCHANGED_IMPORT
84 lightEnable
= isBacklightEnable();
91 #ifdef TIMER10MS_IMPORT
92 #undef TIMER10MS_IMPORT
93 if (!main_thread_running
)
101 return (::uint8_t *)lcd_buf
;
104 #ifdef GETERROR_IMPORT
105 #undef GETERROR_IMPORT
106 return main_thread_error
;
109 #ifdef SETTRAINER_IMPORT
110 #undef SETTRAINER_IMPORT
112 g_ppmIns
[inputNumber
] = LIMIT
< ::int16_t>(-512, value
, 512);