Refactoring of perMainArm(), hw specific stuff moved to targets
This commit is contained in:
@@ -42,6 +42,13 @@ volatile uint32_t Tenms ;
|
||||
volatile uint8_t lcdLock;
|
||||
volatile uint32_t lcdInputs;
|
||||
|
||||
#if !defined(REVA)
|
||||
uint16_t Current_analogue;
|
||||
uint16_t Current_max;
|
||||
uint32_t Current_accumulator;
|
||||
uint32_t Current_used;
|
||||
#endif
|
||||
|
||||
extern "C" void sam_boot( void ) ;
|
||||
|
||||
// Prototype
|
||||
@@ -672,3 +679,28 @@ void setSticksGain(uint8_t gains)
|
||||
padc->ADC_CGR = gain;
|
||||
padc->ADC_COR = offset;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(REVA)
|
||||
void calcConsumption()
|
||||
{
|
||||
Current_accumulator += Current_analogue ;
|
||||
static uint32_t OneSecTimer;
|
||||
if (++OneSecTimer >= 100) {
|
||||
OneSecTimer -= 100 ;
|
||||
Current_used += Current_accumulator / 100 ; // milliAmpSeconds (but scaled)
|
||||
Current_accumulator = 0 ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void checkTrainerSettings()
|
||||
{
|
||||
if (SLAVE_MODE()) {
|
||||
PIOC->PIO_PDR = PIO_PC22;
|
||||
}
|
||||
else {
|
||||
PIOC->PIO_PER = PIO_PC22;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,11 +168,14 @@ extern uint16_t Current_max;
|
||||
extern uint32_t Current_accumulator;
|
||||
extern uint32_t Current_used;
|
||||
extern uint16_t sessionTimer;
|
||||
void calcConsumption();
|
||||
#endif
|
||||
|
||||
#define SLAVE_MODE() (pwrCheck() == e_power_trainer)
|
||||
#define JACK_PPM_OUT() PIOC->PIO_PDR = PIO_PC22
|
||||
#define JACK_PPM_IN() PIOC->PIO_PER = PIO_PC22
|
||||
// #define JACK_PPM_OUT() PIOC->PIO_PDR = PIO_PC22
|
||||
// #define JACK_PPM_IN() PIOC->PIO_PER = PIO_PC22
|
||||
void checkTrainerSettings();
|
||||
|
||||
|
||||
void setSticksGain(uint8_t gains);
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ extern "C" {
|
||||
#define TIMER_MULT_APB1 2
|
||||
#define TIMER_MULT_APB2 2
|
||||
|
||||
#define JACK_PPM_OUT()
|
||||
#define JACK_PPM_IN()
|
||||
// #define JACK_PPM_OUT()
|
||||
// #define JACK_PPM_IN()
|
||||
|
||||
#define PIN_MODE_MASK 0x0003
|
||||
#define PIN_INPUT 0x0000
|
||||
|
||||
Reference in New Issue
Block a user