mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +01:00
Added Stern parameters to ConfigureDrivers()
This commit is contained in:
@@ -94,8 +94,22 @@ PRResult LoadConfiguration(YAML::Node& yamlDoc, const char *yamlFilePath)
|
|||||||
void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yamlDoc)
|
void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yamlDoc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
const int WPCDriverLoopTime = 4; // milliseconds
|
||||||
|
const int SternDriverLoopTime = 2; // milliseconds
|
||||||
|
|
||||||
|
const int mappedWPCDriverGroupEnableIndex[] = {0, 0, 0, 0, 0, 2, 4, 3, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
const int mappedSternDriverGroupEnableIndex[] = {0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
|
||||||
|
const int mappedWPCDriverGroupSlowTime[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
const int mappedSternDriverGroupSlowTime[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, 0, 200, 0, 200, 0, 200, 0, 200, 0, 200, 0, 200, 0, 200};
|
||||||
|
const int mappedWPCDriverGroupActivateIndex[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
const int mappedSternDriverGroupActivateIndex[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
|
||||||
|
|
||||||
|
const int watchdogResetTime = 1000; // milliseconds
|
||||||
|
|
||||||
int mappedDriverGroupEnableIndex[kPRDriverGroupsMax];
|
int mappedDriverGroupEnableIndex[kPRDriverGroupsMax];
|
||||||
int mappedWPCDriverGroupEnableIndex[] = {0, 0, 0, 0, 0, 2, 4, 3, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0};
|
int mappedDriverGroupSlowTime[kPRDriverGroupsMax];
|
||||||
|
int mappedDriverGroupActivateIndex[kPRDriverGroupsMax];
|
||||||
int rowEnableIndex1;
|
int rowEnableIndex1;
|
||||||
int rowEnableIndex0;
|
int rowEnableIndex0;
|
||||||
bool tickleSternWatchdog;
|
bool tickleSternWatchdog;
|
||||||
@@ -104,19 +118,48 @@ void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yaml
|
|||||||
int driverLoopTime;
|
int driverLoopTime;
|
||||||
int watchdogResetTime;
|
int watchdogResetTime;
|
||||||
int slowGroupTime;
|
int slowGroupTime;
|
||||||
|
int numMatrixGroups;
|
||||||
|
bool encodeEnables;
|
||||||
|
|
||||||
switch (machineType)
|
switch (machineType)
|
||||||
{
|
{
|
||||||
case kPRMachineWPC: {
|
case kPRMachineWPC:
|
||||||
memcpy(mappedDriverGroupEnableIndex,mappedWPCDriverGroupEnableIndex, sizeof(mappedDriverGroupEnableIndex));
|
{
|
||||||
|
memcpy(mappedDriverGroupEnableIndex,mappedWPCDriverGroupEnableIndex,
|
||||||
|
sizeof(mappedDriverGroupEnableIndex));
|
||||||
rowEnableIndex1 = 6; // Unused in WPC
|
rowEnableIndex1 = 6; // Unused in WPC
|
||||||
rowEnableIndex0 = 6;
|
rowEnableIndex0 = 6;
|
||||||
tickleSternWatchdog = false;
|
tickleSternWatchdog = false;
|
||||||
globalPolarity = false;
|
globalPolarity = false;
|
||||||
activeLowMatrixRows = true;
|
activeLowMatrixRows = true;
|
||||||
driverLoopTime = 4; // milliseconds
|
driverLoopTime = 4; // milliseconds
|
||||||
watchdogResetTime = 1000; // milliseconds
|
memcpy(mappedDriverGroupSlowTime,mappedWPCDriverGroupSlowTime,
|
||||||
slowGroupTime = driverLoopTime * 100; // microseconds
|
sizeof(mappedDriverGroupSlowTime));
|
||||||
|
memcpy(mappedDriverGroupActivateIndex,mappedWPCDriverGroupActivateIndex,
|
||||||
|
sizeof(mappedDriverGroupActivateIndex));
|
||||||
|
numMatrixGroups = 8;
|
||||||
|
encodeEnables = false;
|
||||||
|
rowEnableSelect = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case kPRMachineStern:
|
||||||
|
{
|
||||||
|
memcpy(mappedDriverGroupEnableIndex,mappedSternDriverGroupEnableIndex,
|
||||||
|
sizeof(mappedDriverGroupEnableIndex));
|
||||||
|
rowEnableIndex1 = 6; // Unused in Stern
|
||||||
|
rowEnableIndex0 = 10;
|
||||||
|
tickleSternWatchdog = true;
|
||||||
|
globalPolarity = true;
|
||||||
|
activeLowMatrixRows = false;
|
||||||
|
driverLoopTime = 2; // milliseconds
|
||||||
|
memcpy(mappedDriverGroupSlowTime,mappedSternDriverGroupSlowTime,
|
||||||
|
sizeof(mappedDriverGroupSlowTime));
|
||||||
|
memcpy(mappedDriverGroupActivateIndex,mappedSternDriverGroupActivateIndex,
|
||||||
|
sizeof(mappedDriverGroupActivateIndex));
|
||||||
|
numMatrixGroups = 16;
|
||||||
|
encodeEnables = true;
|
||||||
|
rowEnableSelect = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +174,7 @@ void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yaml
|
|||||||
globals.matrixRowEnableIndex0 = rowEnableIndex0;
|
globals.matrixRowEnableIndex0 = rowEnableIndex0;
|
||||||
globals.activeLowMatrixRows = activeLowMatrixRows;
|
globals.activeLowMatrixRows = activeLowMatrixRows;
|
||||||
globals.tickleSternWatchdog = tickleSternWatchdog;
|
globals.tickleSternWatchdog = tickleSternWatchdog;
|
||||||
globals.encodeEnables = false;
|
globals.encodeEnables = encodeEnables;
|
||||||
globals.watchdogExpired = false;
|
globals.watchdogExpired = false;
|
||||||
globals.watchdogEnable = true;
|
globals.watchdogEnable = true;
|
||||||
globals.watchdogResetTime = watchdogResetTime;
|
globals.watchdogResetTime = watchdogResetTime;
|
||||||
@@ -158,7 +201,7 @@ void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yaml
|
|||||||
group.rowActivateIndex = 0;
|
group.rowActivateIndex = 0;
|
||||||
group.rowEnableSelect = 0;
|
group.rowEnableSelect = 0;
|
||||||
group.matrixed = false;
|
group.matrixed = false;
|
||||||
group.polarity = false;
|
group.polarity = globalPolarity;
|
||||||
group.active = 1;
|
group.active = 1;
|
||||||
group.disableStrobeAfter = false;
|
group.disableStrobeAfter = false;
|
||||||
|
|
||||||
@@ -166,16 +209,16 @@ void ConfigureDrivers(PRHandle proc, PRMachineType machineType, YAML::Node& yaml
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 < 18; i++) {
|
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
||||||
PRDriverGetGroupConfig(proc, i, &group);
|
PRDriverGetGroupConfig(proc, i, &group);
|
||||||
group.slowTime = slowGroupTime;
|
group.slowTime = mappedDriverGroupSlowTime[i];
|
||||||
group.enableIndex = mappedDriverGroupEnableIndex[i];
|
group.enableIndex = mappedDriverGroupEnableIndex[i];
|
||||||
group.rowActivateIndex = i - 10;
|
group.rowActivateIndex = mappedDriverGroupActivateIndex[i];
|
||||||
group.rowEnableSelect = 0;
|
group.rowEnableSelect = rowEnableSelect;
|
||||||
group.matrixed = 1;
|
group.matrixed = 1;
|
||||||
group.polarity = 0;
|
group.polarity = globalPolarity;
|
||||||
group.active = 1;
|
group.active = 1;
|
||||||
group.disableStrobeAfter = 1;
|
group.disableStrobeAfter = mappedDriverGroupSlowTime[i] != 0;
|
||||||
PRDriverUpdateGroupConfig(proc, &group);
|
PRDriverUpdateGroupConfig(proc, &group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,7 +487,7 @@ int main(int argc, const char **argv)
|
|||||||
// Pulse a coil for testing purposes.
|
// Pulse a coil for testing purposes.
|
||||||
//PRDriverPulse(proc, 53, 100);
|
//PRDriverPulse(proc, 53, 100);
|
||||||
// Schedule a feature lamp for testing purposes.
|
// Schedule a feature lamp for testing purposes.
|
||||||
//PRDriverSchedule(proc, 80, 0xFF00FF00, 0, 0);
|
PRDriverSchedule(proc, 80, 0xFF00FF00, 0, 0);
|
||||||
// Pitter-patter a feature lamp for testing purposes.
|
// Pitter-patter a feature lamp for testing purposes.
|
||||||
//PRDriverPatter(proc, 84, 127, 127, 0);
|
//PRDriverPatter(proc, 84, 127, 127, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user