]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/usci/Msp430Usci.h
Let's let the compiler type system work for us. Instead of having a single
[tinyos-2.x.git] / tos / chips / msp430 / usci / Msp430Usci.h
index 541311136479c9de31a9be20609d085bfc5966da..94ca476c05c433828c58f7ec43b76e183e0e01a5 100644 (file)
@@ -69,6 +69,18 @@ typedef enum {
   USCI_REN_TX_PULLDOWN = USCI_REN_TX + 0x20
 } msp430_ren_t;
 
+/* Baud rates for UART mode.  Only 32KHz modes work right now. */
+typedef enum {
+  /* UCOS16=0.  UMCTL = UCBRFx << 4 + UCBRSx << 1 + UCOS16.
+   * 1MHZ = 1,048576HZ, 1E6MHZ = 1,000,000HZ.
+   */
+  UBRX_32768HZ_9600=3, UMCTL_32768HZ_9600=(0 << 4) + (3 << 1) + 0,
+  UBRX_1MHZ_9600=109, UMCTL_1MHZ_9600=(0 << 4) + (2 << 1) + 0,
+  UBRX_1MHZ_115200=9, UMCTL_1MHZ_115200=(0 << 4) + (1 << 1) + 0,
+  UBRX_1E6MHZ_9600=104, UMCTL_1E6MHZ_9600=(0 << 4) + (1 << 1) + 0,
+  UBRX_1E6MHZ_115200=8, UMCTL_1E6MHZ_115200=(0 << 4) + (6 << 1) + 0,
+} msp430_usci_uart_rate_t;
+
 typedef struct {
   uint8_t ctl0;
   uint8_t ctl1;
@@ -88,21 +100,14 @@ typedef struct {
   msp430_ren_t ren;
 } __attribute__ ((packed)) msp430_usci_spi_t;
 
-/* Baud rates for UART mode.  Only 32KHz modes work right now. */
-typedef enum {
-  /* UCOS16=0.  UMCTL = UCBRFx << 4 + UCBRSx << 1 + UCOS16.
-   * 1MHZ = 1,048576HZ, 1E6MHZ = 1,000,000HZ.
-   */
-  UBRX_32768HZ_9600=3, UMCTL_32768HZ_9600=(0 << 4) + (3 << 1) + 0,
-  UBRX_1MHZ_9600=109, UMCTL_1MHZ_9600=(0 << 4) + (2 << 1) + 0,
-  UBRX_1MHZ_115200=9, UMCTL_1MHZ_115200=(0 << 4) + (1 << 1) + 0,
-  UBRX_1E6MHZ_9600=104, UMCTL_1E6MHZ_9600=(0 << 4) + (1 << 1) + 0,
-  UBRX_1E6MHZ_115200=8, UMCTL_1E6MHZ_115200=(0 << 4) + (6 << 1) + 0,
-} msp430_usci_uart_rate_t;
-
-typedef union {
-  msp430_usci_uart_t uart;
-  msp430_usci_spi_t spi;
-} __attribute__ ((packed)) msp430_usci_config_t;
+typedef struct {
+  uint8_t ctl0;
+  uint8_t ctl1;
+  uint16_t brx;
+  uint8_t i2cie;
+  uint8_t i2coa;
+  uint8_t i2csa;
+  msp430_ren_t ren;
+} __attribute__ ((packed)) msp430_usci_i2c_t;
 
 #endif