1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     *
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     *
    11     * --/COPYRIGHT--*/
    12    import ti.catalog.msp430.peripherals.comparator.IComparator as Comparator;
    13    
    14    /*!
    15     *  ======== GPIO for MSP430G2210 ========
    16     *  MSP430 General Purpose Input Output Ports
    17     */
    18    metaonly module GPIO_MSP430G2210 inherits IGPIO {
    19        /*!
    20         *  ======== create ========
    21         *  Create an instance of this peripheral.
    22         */
    23        create(Comparator.Instance comparator);
    24    
    25    instance:
    26        /*! @_nodoc */
    27        config Comparator.Instance comparator;
    28    
    29       /*! Define an array to describe all device pins. The 1st dimension
    30        *  denotes the port, the second the pin on that port. On an
    31        *  MSP430G2210 device, there are 8 + 1 = 8 pins total.
    32        */
    33    
    34        /* TODO: This here should really be a module-wide feature, rather than an instance feature,
    35         * however due to limitations in XDCtools 3.21.0.0 the data is located here */
    36        /* TODO: For this device the config variable definition has been moved into the
    37         * corresponding XS file due to its size. This needs a more consistent solution. */
    38        config DevicePin_t devicePins[1][8];
    39    
    40        /*! Implementation of Device Pin Functional Configuration */
    41        override config DevicePinFunctionSetting_t devicePinSetting[1][8];
    42    
    43        /*! Determine if each Register needs to be forced set or not */
    44        readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
    45        [
    46            { register : "P1OUT" , regForceSet : true  },
    47            { register : "P1SEL" , regForceSet : false },
    48            { register : "P1DIR" , regForceSet : false },
    49            { register : "P1REN" , regForceSet : false },
    50            { register : "P1IES" , regForceSet : true },
    51            { register : "P1IFG" , regForceSet : true },
    52            { register : "P1IE"  , regForceSet : false }
    53        ];
    54    
    55        /*
    56         *  GPIO Digital I/O Registers
    57         *
    58         *  One GIPO instance defines the configuration of an entire,
    59         *  8-bit wide digital I/O port.
    60         */
    61    
    62        /*! Port 1 Output Register */
    63        config GpioBits8PxOut_t P1OUT = {
    64            Bit0        : BIT0_OFF,
    65            Bit1        : BIT1_OFF,
    66            Bit2        : BIT2_OFF,
    67            Bit3        : BIT3_OFF,
    68            Bit4        : BIT4_OFF,
    69            Bit5        : BIT5_OFF,
    70            Bit6        : BIT6_OFF,
    71            Bit7        : BIT7_OFF
    72        };
    73    
    74        /*! Port 1 Port Select Register */
    75        config GpioBits8PxSel_t P1SEL = {
    76            Bit0        : BIT0_OFF,
    77            Bit1        : BIT1_OFF,
    78            Bit2        : BIT2_OFF,
    79            Bit3        : BIT3_OFF,
    80            Bit4        : BIT4_OFF,
    81            Bit5        : BIT5_OFF,
    82            Bit6        : BIT6_OFF,
    83            Bit7        : BIT7_OFF
    84        };
    85    
    86        /*! Port 1 Direction Register */
    87        config GpioBits8PxDir_t P1DIR = {
    88            Bit0        : BIT0_OFF,
    89            Bit1        : BIT1_OFF,
    90            Bit2        : BIT2_OFF,
    91            Bit3        : BIT3_OFF,
    92            Bit4        : BIT4_OFF,
    93            Bit5        : BIT5_OFF,
    94            Bit6        : BIT6_OFF,
    95            Bit7        : BIT7_OFF
    96        };
    97    
    98        /*! Port 1 Resistor Enable Register */
    99        config GpioBits8PxRen_t P1REN = {
   100            Bit0        : BIT0_OFF,
   101            Bit1        : BIT1_OFF,
   102            Bit2        : BIT2_OFF,
   103            Bit3        : BIT3_OFF,
   104            Bit4        : BIT4_OFF,
   105            Bit5        : BIT5_OFF,
   106            Bit6        : BIT6_OFF,
   107            Bit7        : BIT7_OFF
   108        };
   109    }