let Common   = system.getScript("/driverlib/Common.js");
let Pinmux   = system.getScript("/driverlib/pinmux.js");

/* Intro splash on GUI */
let longDescription = "An FSI peripheral is used to translate data between " +
    "the chip and a serial port. The SCI driver simplifies reading " +
    "and writing to any of the UART peripherals on the board, with " +
    "multiple modes of operation and performance. These include " +
    "blocking, non-blocking, and polling, as well as text/binary " +
    "mode, echo and return characters.";

/* Array of CAN configurables that are common across device families */
let config = [
    {
        name: "useCase",
        displayName : "Use Case",
        description : 'Peripheral use case',
        hidden      : false,
        default     : 'ALL',
        options     : Pinmux.getPeripheralUseCaseNames("EMIF1"),
        onChange    : Pinmux.useCaseChanged,
    },
];


/*
 *  ======== filterHardware ========
 *  Control RX, TX Pin usage by the user specified dataDirection.
 *
 *  param component - hardware object describing signals and
 *                     resources they're attached to
 *
 *  returns Boolean indicating whether or not to allow the component to
 *           be assigned to an instance's $hardware config
 */
function filterHardware(component)
{
    return (Common.typeMatches(component.type, ["EMIF1"]));
}

if (Common.onlyPinmux())
{
    config = [config[config.length - 1]];
}
config = [config[config.length - 1]];

var emif1Module = {
    peripheralName: "EMIF1",
    displayName: "EMIF1",
    maxInstances: Common.peripheralCount("EMIF1"),
    defaultInstanceName: "myEMIF1",
    description: "External Memory Interface Peripheral 1 Peripheral",
    filterHardware : filterHardware,
    config: config,
    templates: {
        boardc : "/driverlib/emif1/emif1.board.c.xdt",
        boardh : "/driverlib/emif1/emif1.board.h.xdt"
    },
    pinmuxRequirements    : Pinmux.emif1PinmuxRequirements
};


if (emif1Module.maxInstances <= 0)
{
    delete emif1Module.pinmuxRequirements;
}
else
{
    Pinmux.addCustomPinmuxEnumToConfig(emif1Module)
}

exports = emif1Module;