mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +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 {
|
typedef struct PRSwitchConfig {
|
||||||
bool_t clear; // Drive the clear output
|
bool_t clear; // Drive the clear output
|
||||||
bool_t hostEventsEnable; // 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 directMatrixScanLoopTime; // milliseconds
|
||||||
uint8_t pulsesBeforeCheckingRX;
|
uint8_t pulsesBeforeCheckingRX;
|
||||||
uint8_t inactivePulsesAfterBurst;
|
uint8_t inactivePulsesAfterBurst;
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
int rowEnableSelect;
|
int rowEnableSelect;
|
||||||
int lastCoilDriverGroup;
|
int lastCoilDriverGroup;
|
||||||
|
|
||||||
|
DEBUG(PRLog(kPRLogError, "In Defaults:, machineType = %x.\n", machineType));
|
||||||
switch (machineType)
|
switch (machineType)
|
||||||
{
|
{
|
||||||
case kPRMachineWPC:
|
case kPRMachineWPC:
|
||||||
@@ -349,6 +350,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults:, setup done.\n", machineType));
|
||||||
|
|
||||||
memset(&driverGlobalConfig, 0x00, sizeof(PRDriverGlobalConfig));
|
memset(&driverGlobalConfig, 0x00, sizeof(PRDriverGlobalConfig));
|
||||||
for (i = 0; i < kPRDriverCount; i++)
|
for (i = 0; i < kPRDriverCount; i++)
|
||||||
@@ -360,6 +362,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
if (resetFlags & kPRResetFlagUpdateDevice)
|
||||||
res = DriverUpdateState(driver);
|
res = DriverUpdateState(driver);
|
||||||
}
|
}
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers done.\n", machineType));
|
||||||
for (i = 0; i < kPRDriverGroupsMax; i++)
|
for (i = 0; i < kPRDriverGroupsMax; i++)
|
||||||
{
|
{
|
||||||
PRDriverGroupConfig *group = &driverGroups[i];
|
PRDriverGroupConfig *group = &driverGroups[i];
|
||||||
@@ -367,6 +370,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
group->groupNum = i;
|
group->groupNum = i;
|
||||||
group->polarity = globalPolarity;
|
group->polarity = globalPolarity;
|
||||||
}
|
}
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers groups set up.\n", machineType));
|
||||||
|
|
||||||
PRDriverGlobalConfig globals;
|
PRDriverGlobalConfig globals;
|
||||||
globals.enableOutputs = false;
|
globals.enableOutputs = false;
|
||||||
@@ -382,6 +386,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
globals.watchdogExpired = false;
|
globals.watchdogExpired = false;
|
||||||
globals.watchdogEnable = true;
|
globals.watchdogEnable = true;
|
||||||
globals.watchdogResetTime = watchdogResetTime;
|
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.
|
// 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:
|
// When we toggle enableOutputs like this P-ROC will reset the polarity:
|
||||||
@@ -399,6 +404,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
else
|
else
|
||||||
driverGlobalConfig = globals;
|
driverGlobalConfig = globals;
|
||||||
|
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers globals programmed.\n", machineType));
|
||||||
|
|
||||||
// Configure the groups. Each group corresponds to 8 consecutive drivers, starting
|
// Configure the groups. Each group corresponds to 8 consecutive drivers, starting
|
||||||
// with driver #32. The following 6 groups are configured for coils/flashlamps.
|
// with driver #32. The following 6 groups are configured for coils/flashlamps.
|
||||||
|
|
||||||
@@ -419,8 +426,11 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
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.
|
// The following 8 groups are configured for the feature lamp matrix.
|
||||||
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
||||||
DriverGetGroupConfig(i, &group);
|
DriverGetGroupConfig(i, &group);
|
||||||
@@ -437,7 +447,9 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
driverGroups[i] = group;
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults: group %x programmed.\n", i));
|
||||||
}
|
}
|
||||||
|
DEBUG(PRLog(kPRLogError, "Defaults: last groups programmed.\n", machineType));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,6 +810,8 @@ PRResult PRDevice::Open()
|
|||||||
|
|
||||||
PRSwitchConfig switchConfig;
|
PRSwitchConfig switchConfig;
|
||||||
switchConfig.clear = false;
|
switchConfig.clear = false;
|
||||||
|
switchConfig.use_column_9 = false;
|
||||||
|
switchConfig.use_column_8 = false;
|
||||||
switchConfig.hostEventsEnable = false;
|
switchConfig.hostEventsEnable = false;
|
||||||
switchConfig.directMatrixScanLoopTime = 2; // milliseconds
|
switchConfig.directMatrixScanLoopTime = 2; // milliseconds
|
||||||
switchConfig.pulsesBeforeCheckingRX = 10;
|
switchConfig.pulsesBeforeCheckingRX = 10;
|
||||||
|
|||||||
@@ -162,7 +162,11 @@ int32_t CreateSwitchUpdateConfigBurst ( uint32_t * burst, PRSwitchConfig *switch
|
|||||||
(switchConfig->pulsesPerBurst <<
|
(switchConfig->pulsesPerBurst <<
|
||||||
P_ROC_SWITCH_CONFIG_PULSES_PER_BURST_SHIFT) |
|
P_ROC_SWITCH_CONFIG_PULSES_PER_BURST_SHIFT) |
|
||||||
(switchConfig->pulseHalfPeriodTime <<
|
(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,
|
burst[2] = CreateBurstCommand (P_ROC_BUS_STATE_CHANGE_PROC_SELECT,
|
||||||
P_ROC_STATE_CHANGE_CONFIG_ADDR, 1 );
|
P_ROC_STATE_CHANGE_CONFIG_ADDR, 1 );
|
||||||
burst[3] = switchConfig->hostEventsEnable;
|
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_DRIVER_CONFIG_TABLE_DRIVER_NUM_SHIFT = 1;
|
||||||
|
|
||||||
const uint32_t P_ROC_SWITCH_CONFIG_CLEAR_SHIFT = 31;
|
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_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_PULSES_BEFORE_CHECKING_RX_SHIFT = 18;
|
||||||
const uint32_t P_ROC_SWITCH_CONFIG_INACTIVE_PULSES_AFTER_BURST_SHIFT = 12;
|
const uint32_t P_ROC_SWITCH_CONFIG_INACTIVE_PULSES_AFTER_BURST_SHIFT = 12;
|
||||||
|
|||||||
Reference in New Issue
Block a user