Search in sources :

Example 16 with DevicePeripherals

use of net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals in project usbdm-eclipse-plugins by podonoghue.

the class TestVectorTable method testHeaderFile.

static void testHeaderFile(String device) {
    DevicePeripheralsFactory factory = new DevicePeripheralsFactory();
    DevicePeripherals devicePeripherals = factory.getDevicePeripherals(device);
    StringWriter stringWriter = new StringWriter();
    PrintWriter printWriter = null;
    try {
        printWriter = new PrintWriter(stringWriter);
        devicePeripherals.writeHeaderFile(printWriter);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (printWriter != null) {
            printWriter.close();
        }
    }
    System.err.print(stringWriter.toString());
}
Also used : StringWriter(java.io.StringWriter) DevicePeripherals(net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals) DevicePeripheralsFactory(net.sourceforge.usbdm.peripheralDatabase.DevicePeripheralsFactory) PrintWriter(java.io.PrintWriter)

Example 17 with DevicePeripherals

use of net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals in project usbdm-eclipse-plugins by podonoghue.

the class TestDevicePeripheralSelectionDialogue method main.

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Selection");
    shell.setLayout(new FillLayout());
    DevicePeripheralSelectionDialogue dialogue;
    try {
        // SVDIdentifier svdIdentifier = new SVDIdentifier(Paths.get("C:/Program Files (x86)/pgo/USBDM 4.11.1.70/DeviceData/Device.SVD/Freescale/MK10D7.svd.xml"));
        // SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:FRDM_K64F]");
        SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:path=C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-plugins/net.sourceforge.usbdm.peripherals.stmicro/data/STM32F40x.svd.xml]");
        // SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:S9KEAZN8]");
        svdIdentifier = new SVDIdentifier(svdIdentifier.toString());
        dialogue = new DevicePeripheralSelectionDialogue(shell, svdIdentifier);
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }
    // DeviceSelectDialogue dialogue = new DeviceSelectDialogue(shell, "C:/Users/podonoghue/Development/USBDM/ARM_Devices/Generated/STMicro/STM32F40x.svd.xml");
    int result = dialogue.open();
    if (result != Window.OK) {
        // Cancelled etc
        System.err.println("**** Cancelled ****");
        return;
    }
    SVDIdentifier svdID = dialogue.getSVDId();
    System.err.println("svdID = " + svdID);
    try {
        System.err.println("svdID.getDeviceName() = " + svdID.getDeviceName());
        DevicePeripherals devicePeripherals = svdID.getDevicePeripherals();
        System.err.println("svdID.getDevicePeripherals() = " + devicePeripherals);
        System.err.println("devicePeripherals.getName() = " + devicePeripherals.getName());
        UsbdmDevicePeripheralsModel peripheralModel = UsbdmDevicePeripheralsModel.createModel(null, svdID);
        System.err.println("peripheralModel = " + peripheralModel);
    } catch (Exception e) {
        e.printStackTrace();
    }
    display.dispose();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) DevicePeripherals(net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals) DevicePeripheralSelectionDialogue(net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue) SVDIdentifier(net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Aggregations

DevicePeripherals (net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals)17 Path (java.nio.file.Path)8 IPath (org.eclipse.core.runtime.IPath)5 DevicePeripheralsFactory (net.sourceforge.usbdm.peripheralDatabase.DevicePeripheralsFactory)4 IOException (java.io.IOException)3 PrintWriter (java.io.PrintWriter)2 HashMap (java.util.HashMap)2 Pattern (java.util.regex.Pattern)2 PeripheralWithState (net.sourceforge.usbdm.deviceEditor.peripherals.PeripheralWithState)2 ProcessProjectActions (net.sourceforge.usbdm.deviceEditor.peripherals.ProcessProjectActions)2 WriteFamilyCpp (net.sourceforge.usbdm.deviceEditor.peripherals.WriteFamilyCpp)2 UsbdmException (net.sourceforge.usbdm.jni.UsbdmException)2 DeviceFileList (net.sourceforge.usbdm.peripheralDatabase.DeviceFileList)2 DeviceSvdInfo (net.sourceforge.usbdm.peripheralDatabase.DeviceFileList.DeviceSvdInfo)2 Peripheral (net.sourceforge.usbdm.peripheralDatabase.Peripheral)2 SVDIdentifier (net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1