auto-sync

This commit is contained in:
rusEfi 2015-01-02 18:03:37 -06:00
parent 6a642e4de5
commit 65a4c697ef
3 changed files with 24 additions and 10 deletions

View File

@ -371,8 +371,10 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
engineConfiguration->isJoystickEnabled = true;
boardConfiguration->joystickCenterPin = GPIOD_10;
boardConfiguration->joystickCenterA = GPIOD_8;
boardConfiguration->joystickCenterC = GPIOD_9;
boardConfiguration->joystickAPin = GPIOD_8;
boardConfiguration->joystickBPin = GPIO_UNASSIGNED;
boardConfiguration->joystickCPin = GPIOD_9;
boardConfiguration->joystickDPin = GPIOD_11;
// engineConfiguration->isCanEnabled = true;
boardConfiguration->canTxPin = GPIOB_6;

View File

@ -259,12 +259,18 @@ typedef struct {
brain_pin_e spi3misoPin;
brain_pin_e spi3sckPin;
// offset 6228
float hip9011Gain;
// offset 6232
brain_pin_e joystickCenterPin;
brain_pin_e joystickCenterA;
brain_pin_e joystickCenterB;
brain_pin_e joystickCenterC;
brain_pin_e joystickCenterD;
// offset 6236
brain_pin_e joystickAPin;
// offset 6240
brain_pin_e joystickBPin;
// offset 6244
brain_pin_e joystickCPin;
// offset 6248
brain_pin_e joystickDPin;
int unusedbs[7];
le_formula_t le_formulas[LE_COMMAND_COUNT];

View File

@ -15,9 +15,11 @@
EXTERN_ENGINE;
static int joyTotal = 0;
static int joyCenter;
static int joyA = 0;
static int joyB = 0;
static int joyC = 0;
static int joyD = 0;;
static Logging *sharedLogger;
@ -25,7 +27,7 @@ static Logging *sharedLogger;
static void extCallback(EXTDriver *extp, expchannel_t channel) {
joyTotal++;
if (channel == 8) {
if (channel == getHwPin(boardConfiguration->joystickAPin)) {
joyA++;
} else if (channel == 9) {
joyB++;
@ -35,8 +37,12 @@ static void extCallback(EXTDriver *extp, expchannel_t channel) {
}
static void joystickInfo(void) {
scheduleMsg(sharedLogger, "total %d a %d b %d c %d", joyTotal, joyA, joyB,
joyC);
scheduleMsg(sharedLogger, "total %d center=%d@%s", joyTotal,
joyCenter, hwPortname(boardConfiguration->joystickCenterPin));
scheduleMsg(sharedLogger, "a=%d@%s", joyA, hwPortname(boardConfiguration->joystickAPin));
scheduleMsg(sharedLogger, "b=%d@%s", joyB, hwPortname(boardConfiguration->joystickBPin));
scheduleMsg(sharedLogger, "c=%d@%s", joyC, hwPortname(boardConfiguration->joystickCPin));
scheduleMsg(sharedLogger, "d=%d@%s", joyD, hwPortname(boardConfiguration->joystickDPin));
}
/**
@ -89,7 +95,7 @@ void initJoystick(Logging *shared) {
| EXT_MODE_GPIOD; // PD11
extcfg.channels[11].cb = extCallback;
mySetPadMode("joy center", GPIOD, 10, PAL_MODE_INPUT_PULLUP);
mySetPadMode2("joy center", boardConfiguration->joystickCenterPin, PAL_MODE_INPUT_PULLUP);
mySetPadMode("joy B", GPIOC, 8, PAL_MODE_INPUT_PULLUP);
mySetPadMode("joy D", GPIOD, 11, PAL_MODE_INPUT_PULLUP);