Search in sources :

Example 1 with PinCategory

use of net.sourceforge.usbdm.deviceEditor.model.ModelFactory.PinCategory in project usbdm-eclipse-plugins by podonoghue.

the class DeviceSignalsModel method createModels.

private void createModels(DeviceInfo fDeviceInfo) {
    fMappingInfos = new ArrayList<MappingInfo>();
    final ArrayList<PinCategory> categories = new ArrayList<PinCategory>();
    // Construct categories
    for (char c = 'A'; c <= 'I'; c++) {
        categories.add(new PinCategory("Port " + c, "PT" + c + ".*"));
    }
    categories.add(new PinCategory("Power", "((VDD|VSS|VREGIN|VBAT|VOUT|(VREF(H|L)))).*"));
    categories.add(new PinCategory("Miscellaneous", ".*"));
    // Group pins into categories
    for (String pName : fDeviceInfo.getPins().keySet()) {
        Pin pinInformation = fDeviceInfo.getPins().get(pName);
        if (pinInformation.isAvailableInPackage()) {
            // Only add if available in package
            for (PinCategory category : categories) {
                if (category.tryAdd(pinInformation)) {
                    break;
                }
            }
        }
    }
    for (PinCategory pinCategory : categories) {
        if (pinCategory.getPins().isEmpty()) {
            continue;
        }
        CategoryModel categoryModel = new CategoryModel(this, pinCategory.getName(), "");
        for (Pin pinInformation : pinCategory.getPins()) {
            new PinModel(categoryModel, pinInformation);
            for (MappingInfo mappingInfo : pinInformation.getMappableSignals().values()) {
                if (mappingInfo.getMux() == MuxSelection.fixed) {
                    continue;
                }
                if (mappingInfo.getMux() == MuxSelection.unassigned) {
                    continue;
                }
                if (mappingInfo.getSignals().get(0) == Signal.DISABLED_SIGNAL) {
                    continue;
                }
                fMappingInfos.add(mappingInfo);
            }
        }
    }
}
Also used : Pin(net.sourceforge.usbdm.deviceEditor.information.Pin) ArrayList(java.util.ArrayList) MappingInfo(net.sourceforge.usbdm.deviceEditor.information.MappingInfo) PinCategory(net.sourceforge.usbdm.deviceEditor.model.ModelFactory.PinCategory)

Aggregations

ArrayList (java.util.ArrayList)1 MappingInfo (net.sourceforge.usbdm.deviceEditor.information.MappingInfo)1 Pin (net.sourceforge.usbdm.deviceEditor.information.Pin)1 PinCategory (net.sourceforge.usbdm.deviceEditor.model.ModelFactory.PinCategory)1