use of net.sourceforge.usbdm.deviceEditor.peripherals.ProcessProjectActions in project usbdm-eclipse-plugins by podonoghue.
the class DeviceInfo method generateCppFiles.
/**
* Generate CPP files (pin_mapping.h, gpio.h)<br>
* Used for testing (files created relative to executable)
*
* @throws Exception
*/
public void generateCppFiles() throws Exception {
// Output directory for test files
Path folder = Paths.get("Testing");
// Generate device header file
Path headerfilePath = folder.resolve(UsbdmConstants.PROJECT_INCLUDE_FOLDER).resolve(getDeviceSubFamily() + ".h");
DevicePeripherals devicePeripherals = getDevicePeripherals();
devicePeripherals.writeHeaderFile(headerfilePath, new NullProgressMonitor());
// Generate pinmapping.h etc
WriteFamilyCpp writer = new WriteFamilyCpp();
writer.writeCppFiles(folder, "", this);
// Regenerate vectors.cpp
Map<String, String> variableMap = getSimpleSymbolMap();
generateVectorTable(variableMap, devicePeripherals, new NullProgressMonitor());
FileUtility.refreshFile(folder.resolve(UsbdmConstants.PROJECT_VECTOR_CPP_PATH), variableMap);
ProcessProjectActions processProjectActions = new ProcessProjectActions();
regenerateProjectFiles(processProjectActions, null, new NullProgressMonitor());
for (String key : fPeripheralsMap.keySet()) {
Peripheral p = fPeripheralsMap.get(key);
if (p instanceof PeripheralWithState) {
((PeripheralWithState) p).regenerateProjectFiles(processProjectActions, null, new NullProgressMonitor());
}
}
}
use of net.sourceforge.usbdm.deviceEditor.peripherals.ProcessProjectActions in project usbdm-eclipse-plugins by podonoghue.
the class DeviceInfo method generateCppFiles.
/**
* Generate CPP files (pin_mapping.h, gpio.h etc) within an Eclipse C++ project
*
* @param project Destination Eclipse C++ project
* @param monitor
* @throws Exception
*/
public void generateCppFiles(IProject project, IProgressMonitor monitor) throws Exception {
SubMonitor subMonitor = SubMonitor.convert(monitor, (fPeripheralsMap.size() + 5) * 100);
// Generate device header file
Path projectDirectory = Paths.get(project.getLocation().toPortableString());
Path headerfilePath = projectDirectory.resolve(UsbdmConstants.PROJECT_INCLUDE_FOLDER).resolve(getDeviceSubFamily() + ".h");
subMonitor.subTask("Parse SVD file");
DevicePeripherals devicePeripherals = getDevicePeripherals();
subMonitor.worked(10);
devicePeripherals.writeHeaderFile(headerfilePath, subMonitor.newChild(10));
// Generate pinmapping.h etc
WriteFamilyCpp writer = new WriteFamilyCpp();
writer.writeCppFiles(project, this, subMonitor.newChild(10));
// Regenerate vectors.cpp
Map<String, String> variableMap = new HashMap<String, String>();
generateVectorTable(variableMap, devicePeripherals, subMonitor.newChild(10));
FileUtility.refreshFile(project, UsbdmConstants.PROJECT_VECTOR_CPP_PATH, variableMap, subMonitor.newChild(10));
ProcessProjectActions processProjectActions = new ProcessProjectActions();
regenerateProjectFiles(processProjectActions, project, subMonitor.newChild(10));
for (String key : fPeripheralsMap.keySet()) {
Peripheral p = fPeripheralsMap.get(key);
if (p instanceof PeripheralWithState) {
((PeripheralWithState) p).regenerateProjectFiles(processProjectActions, project, subMonitor.newChild(10));
}
}
}
Aggregations