1    import ti.catalog.msp430.peripherals.clock.IClock;
     2    import ti.catalog.msp430.peripherals.special_function.IE2;
     3    
     4    /*!
     5     * Universal Serial Communication Interface B0 I2C 2xx
     6     */
     7    metaonly module USCI_B0_I2C_2xx inherits IUSCI_B0_I2C {
     8    
     9        /*
    10         *  ======== create ========
    11         */
    12        create(IClock.Instance clock , IE2.Instance interruptEnableRegister2);
    13        
    14        /*! Not-acknowledge interrupt enable */
    15        enum UCNACKIE_t {
    16            UCNACKIE_OFF = 0x00,    /*! Interrupt disabled */
    17            UCNACKIE = 0x80         /*! Interrupt enabled */
    18        };
    19        
    20        /*! Stop condition interrupt enable */
    21        enum UCSTPIE_t {
    22            UCSTPIE_OFF = 0x00,     /*! Interrupt disabled */
    23            UCSTPIE = 0x80          /*! Interrupt enabled */
    24        };
    25        
    26        /*! Start condition interrupt enable */
    27        enum UCSTTIE_t {
    28            UCSTTIE_OFF = 0x00,     /*! Interrupt disabled */
    29            UCSTTIE = 0x80          /*! Interrupt enabled */
    30        };
    31        
    32        /*! Arbitration lost interrupt enable */
    33        enum UCALIE_t {
    34            UCALIE_OFF = 0x00,      /*! Interrupt disabled */
    35            UCALIE = 0x80           /*! Interrupt enabled */
    36        };
    37        
    38        /*! USCI_Bx I2C Interrupt Enable Register */
    39        struct UCBxI2CIE_t {
    40            UCNACKIE_t  UCNACKIE;   /*! Not-acknowledge interrupt enable
    41                                     *  0  Interrupt disabled
    42                                     *  1  Interrupt enabled */
    43            UCSTPIE_t   UCSTPIE;    /*! Stop condition interrupt enable
    44                                     *  0  Interrupt disabled
    45                                     *  1  Interrupt enabled */
    46            UCSTTIE_t   UCSTTIE;    /*! Start condition interrupt enable
    47                                     *  0  Interrupt disabled
    48                                     *  1  Interrupt enabled */
    49            UCALIE_t    UCALIE;    /*! Arbitration lost interrupt enable
    50                                     *  0  Interrupt disabled
    51                                     *  1  Interrupt enabled */
    52        }
    53        
    54    instance:    
    55        /*! @_nodoc */
    56        config IClock.Instance clock;
    57        /*! @_nodoc */
    58        config IE2.Instance interruptEnableRegister2;
    59        
    60        /*! USCI_Bx I2C Interrupt Enable Register */
    61        config UCBxI2CIE_t UCB0I2CIE = {
    62            UCNACKIE    : UCNACKIE_OFF,
    63            UCSTPIE     : UCSTPIE_OFF,
    64            UCSTTIE     : UCSTTIE_OFF,
    65            UCALIE      : UCALIE_OFF,
    66        };
    67        
    68       /*!
    69        *  ======== setUCNACKIE ========
    70        *  Sets UCNACKIE bit
    71        *
    72        *  @see #setUCNACKIE
    73        */
    74        Bool setUCNACKIE(Bool set);
    75    
    76       /*!
    77        *  ======== getUCNACKIE ========
    78        *  Gets UCNACKIE bit
    79        *
    80        *  @see #getUCNACKIE
    81        */
    82        Bool getUCNACKIE();
    83    
    84       /*!
    85        *  ======== setUCSTPIE ========
    86        *  Sets UCSTPIE bit
    87        *
    88        *  @see #setUCSTPIE
    89        */
    90        Bool setUCSTPIE(Bool set);
    91    
    92       /*!
    93        *  ======== getUCSTPIE ========
    94        *  Gets UCSTPIE bit
    95        *
    96        *  @see #getUCSTPIE
    97        */
    98        Bool getUCSTPIE();
    99    
   100       /*!
   101        *  ======== setUCSTTIE ========
   102        *  Sets UCSTTIE bit
   103        *
   104        *  @see #setUCSTTIE
   105        */
   106        Bool setUCSTTIE(Bool set);
   107    
   108       /*!
   109        *  ======== getUCSTTIE ========
   110        *  Gets UCSTTIE bit
   111        *
   112        *  @see #getUCSTTIE
   113        */
   114        Bool getUCSTTIE();
   115    
   116       /*!
   117        *  ======== setUCALIE ========
   118        *  Sets UCALIE bit
   119        *
   120        *  @see #setUCALIE
   121        */
   122        Bool setUCALIE(Bool set);
   123    
   124       /*!
   125        *  ======== getUCALIE ========
   126        *  Gets UCALIE bit
   127        *
   128        *  @see #getUCALIE
   129        */
   130        Bool getUCALIE();
   131    
   132        /*! Determine if each Register needs to be forced set or not */
   133        readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
   134        [
   135            { register : "UCB0CTL0"   , regForceSet : false },
   136            { register : "UCB0CTL1"   , regForceSet : false },
   137            { register : "UCB0BR0"    , regForceSet : false },
   138            { register : "UCB0BR1"    , regForceSet : false },
   139            { register : "UCB0STAT"   , regForceSet : false },
   140            { register : "UCB0RXBUF"  , regForceSet : false },
   141            { register : "UCB0TXBUF"  , regForceSet : false },
   142            { register : "UCB0I2COA"  , regForceSet : false },
   143            { register : "UCB0I2CSA"  , regForceSet : false },
   144            { register : "UCB0I2CIE"  , regForceSet : false }
   145        ];
   146    }