mirror of
https://github.com/preble/libpinproc
synced 2026-02-22 18:15:25 +01:00
Added support for WPC switch matrix columns 8 and 9.
This commit is contained in:
@@ -294,6 +294,8 @@ PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents);
|
||||
typedef struct PRSwitchConfig {
|
||||
bool_t clear; // Drive the clear output
|
||||
bool_t hostEventsEnable; // Drive the clear output
|
||||
bool_t use_column_9; // Use switch matrix column 9
|
||||
bool_t use_column_8; // Use switch matrix column 8
|
||||
uint8_t directMatrixScanLoopTime; // milliseconds
|
||||
uint8_t pulsesBeforeCheckingRX;
|
||||
uint8_t inactivePulsesAfterBurst;
|
||||
|
||||
@@ -303,6 +303,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
int rowEnableSelect;
|
||||
int lastCoilDriverGroup;
|
||||
|
||||
DEBUG(PRLog(kPRLogError, "In Defaults:, machineType = %x.\n", machineType));
|
||||
switch (machineType)
|
||||
{
|
||||
case kPRMachineWPC:
|
||||
@@ -349,6 +350,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG(PRLog(kPRLogError, "Defaults:, setup done.\n", machineType));
|
||||
|
||||
memset(&driverGlobalConfig, 0x00, sizeof(PRDriverGlobalConfig));
|
||||
for (i = 0; i < kPRDriverCount; i++)
|
||||
@@ -360,6 +362,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
||||
res = DriverUpdateState(driver);
|
||||
}
|
||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers done.\n", machineType));
|
||||
for (i = 0; i < kPRDriverGroupsMax; i++)
|
||||
{
|
||||
PRDriverGroupConfig *group = &driverGroups[i];
|
||||
@@ -367,6 +370,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
group->groupNum = i;
|
||||
group->polarity = globalPolarity;
|
||||
}
|
||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers groups set up.\n", machineType));
|
||||
|
||||
PRDriverGlobalConfig globals;
|
||||
globals.enableOutputs = false;
|
||||
@@ -382,6 +386,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
globals.watchdogExpired = false;
|
||||
globals.watchdogEnable = true;
|
||||
globals.watchdogResetTime = watchdogResetTime;
|
||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers globals set up.\n", machineType));
|
||||
|
||||
// We want to start up safely, so we'll update the global driver config twice.
|
||||
// When we toggle enableOutputs like this P-ROC will reset the polarity:
|
||||
@@ -398,6 +403,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
res = DriverUpdateGlobalConfig(&globals);
|
||||
else
|
||||
driverGlobalConfig = globals;
|
||||
|
||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers globals programmed.\n", machineType));
|
||||
|
||||
// Configure the groups. Each group corresponds to 8 consecutive drivers, starting
|
||||
// with driver #32. The following 6 groups are configured for coils/flashlamps.
|
||||
@@ -419,7 +426,10 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
res = DriverUpdateGroupConfig(&group);
|
||||
else
|
||||
driverGroups[i] = group;
|
||||
DEBUG(PRLog(kPRLogError, "Defaults: group %x programmed.\n", i));
|
||||
}
|
||||
|
||||
DEBUG(PRLog(kPRLogError, "Defaults: First groups programmed.\n", machineType));
|
||||
|
||||
// The following 8 groups are configured for the feature lamp matrix.
|
||||
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
||||
@@ -437,7 +447,9 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
||||
res = DriverUpdateGroupConfig(&group);
|
||||
else
|
||||
driverGroups[i] = group;
|
||||
DEBUG(PRLog(kPRLogError, "Defaults: group %x programmed.\n", i));
|
||||
}
|
||||
DEBUG(PRLog(kPRLogError, "Defaults: last groups programmed.\n", machineType));
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -798,6 +810,8 @@ PRResult PRDevice::Open()
|
||||
|
||||
PRSwitchConfig switchConfig;
|
||||
switchConfig.clear = false;
|
||||
switchConfig.use_column_9 = false;
|
||||
switchConfig.use_column_8 = false;
|
||||
switchConfig.hostEventsEnable = false;
|
||||
switchConfig.directMatrixScanLoopTime = 2; // milliseconds
|
||||
switchConfig.pulsesBeforeCheckingRX = 10;
|
||||
|
||||
@@ -162,7 +162,11 @@ int32_t CreateSwitchUpdateConfigBurst ( uint32_t * burst, PRSwitchConfig *switch
|
||||
(switchConfig->pulsesPerBurst <<
|
||||
P_ROC_SWITCH_CONFIG_PULSES_PER_BURST_SHIFT) |
|
||||
(switchConfig->pulseHalfPeriodTime <<
|
||||
P_ROC_SWITCH_CONFIG_MS_PER_PULSE_HALF_PERIOD_SHIFT);
|
||||
P_ROC_SWITCH_CONFIG_MS_PER_PULSE_HALF_PERIOD_SHIFT) |
|
||||
(switchConfig->use_column_8 <<
|
||||
P_ROC_SWITCH_CONFIG_USE_COLUMN_8) |
|
||||
(switchConfig->use_column_9 <<
|
||||
P_ROC_SWITCH_CONFIG_USE_COLUMN_9);
|
||||
burst[2] = CreateBurstCommand (P_ROC_BUS_STATE_CHANGE_PROC_SELECT,
|
||||
P_ROC_STATE_CHANGE_CONFIG_ADDR, 1 );
|
||||
burst[3] = switchConfig->hostEventsEnable;
|
||||
|
||||
@@ -172,6 +172,8 @@ const uint32_t P_ROC_DRIVER_CONFIG_PATTER_ENABLE_SHIFT = 30;
|
||||
const uint32_t P_ROC_DRIVER_CONFIG_TABLE_DRIVER_NUM_SHIFT = 1;
|
||||
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_CLEAR_SHIFT = 31;
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_USE_COLUMN_9 = 30;
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_USE_COLUMN_8 = 29;
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_MS_PER_DM_SCAN_LOOP_SHIFT = 24;
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_PULSES_BEFORE_CHECKING_RX_SHIFT = 18;
|
||||
const uint32_t P_ROC_SWITCH_CONFIG_INACTIVE_PULSES_AFTER_BURST_SHIFT = 12;
|
||||
|
||||
Reference in New Issue
Block a user