From: smckown Date: Thu, 11 Sep 2008 22:40:16 +0000 (+0000) Subject: For tmicore platform, remove unused pin defs in hardware.h and add PxREN X-Git-Tag: release/2.1.0-1~52 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=713c0186d2ad44b60a98abba805b96f32fef125b For tmicore platform, remove unused pin defs in hardware.h and add PxREN initialization to MotePlatformC. Set unused pins to be input with pull-up. This should be far safer in terms of possible short events that setting unused pins to outputs, since tmicore has an expansion header. --- diff --git a/tos/platforms/tmicore/MotePlatformC.nc b/tos/platforms/tmicore/MotePlatformC.nc index 7477a562..bdf8d366 100644 --- a/tos/platforms/tmicore/MotePlatformC.nc +++ b/tos/platforms/tmicore/MotePlatformC.nc @@ -47,32 +47,40 @@ implementation { /* Port 1: 7:BQSTAT2, 6:BQSTAT1, 5:-, 4:-, 3:CP_CTS, 2:CP_RTS, 1:BSL_TX, 0:- */ P1SEL = 0; /* 0 0 0 0 0 0 0 0 */ P1OUT = 0x39; /* 0 0 1 1 1 0 0 1 */ - P1DIR = 0x39; /* 0 0 1 1 1 0 0 1 */ + P1DIR = 0x08; /* 0 0 0 0 1 0 0 0 */ + P1REN = 0x31; /* 0 0 1 1 0 0 0 1 */ - /* Port 2: 7:-, 6:-, 5:nBUTTON, 4:nUSB_SUSPEND, 3:-, 2:BSL_RX, 1:nUSBPG, 0:nSOLARPG */ + /* Port 2: + * 7:-, 6:-, 5:BUTTONn, 4:USB_SUSPENDn, 3:-, 2:BSL_RX, 1:USBPGn, 0:SOLARPGn + */ P2SEL = 0; /* 0 0 0 0 0 0 0 0 */ P2OUT = 0xc8; /* 1 1 0 0 1 0 0 0 */ - P2DIR = 0xc8; /* 1 1 0 0 1 0 0 0 */ + P2DIR = 0x00; /* 0 0 0 0 0 0 0 0 */ + P2REN = 0xc8; /* 1 1 0 0 1 0 0 0 */ /* Port 3: 7:UC_RX, 6:UC_TX, 5:-, 4:-, 3:UC_SCK, 2:UC_SOMI, 1:UC_SIMO, 0:- */ - P3SEL = 0xc7; /* 1 1 0 0 1 1 1 0 */ + P3SEL = 0xce; /* 1 1 0 0 1 1 1 0 */ P3OUT = 0x7b; /* 0 1 1 1 1 0 1 1 */ - P3DIR = 0x7b; /* 0 1 1 1 1 0 1 1 */ + P3DIR = 0x4a; /* 0 1 0 0 1 0 1 0 */ + P3REN = 0x31; /* 0 0 1 1 0 0 0 1 */ - /* Port 4: 7:-, 6:nLED2, 5:nLED1, 4:nFLH_CS, 3:-, 2:-, 1:-, 0:- */ + /* Port 4: 7:-, 6:LED2n, 5:LED1n, 4:-, 3:-, 2:-, 1:-, 0:- */ P4SEL = 0; /* 0 0 0 0 0 0 0 0 */ P4OUT = 0xff; /* 1 1 1 1 1 1 1 1 */ - P4DIR = 0xff; /* 1 1 1 1 1 1 1 1 */ + P4DIR = 0x60; /* 0 1 1 0 0 0 0 0 */ + P4REN = 0x9f; /* 1 0 0 1 1 1 1 1 */ /* Port 5: 7:-, 6:-, 5:-, 4:-, 3:-, 2:-, 1:-, 0:- */ P5SEL = 0; /* 0 0 0 0 0 0 0 0 */ P5OUT = 0xff; /* 1 1 1 1 1 1 1 1 */ - P5DIR = 0xff; /* 1 1 1 1 1 1 1 1 */ + P5DIR = 0; /* 0 0 0 0 0 0 0 0 */ + P5REN = 0xff; /* 1 1 1 1 1 1 1 1 */ /* Port 6: 7:-, 6:-, 5:-, 4:-, 3:-, 2:-, 1:-, 0:ADC_VBATT */ P6SEL = 0x01; /* 0 0 0 0 0 0 0 1 */ P6OUT = 0; /* 0 0 0 0 0 0 0 0 */ P6DIR = 0; /* 0 0 0 0 0 0 0 0 */ + P6REN = 0xff; /* 1 1 1 1 1 1 1 1 */ P1IE = 0; P2IE = 0; diff --git a/tos/platforms/tmicore/hardware.h b/tos/platforms/tmicore/hardware.h index 54f87e17..c556ef08 100755 --- a/tos/platforms/tmicore/hardware.h +++ b/tos/platforms/tmicore/hardware.h @@ -6,28 +6,6 @@ //#include "CC2420Const.h" //#include "AM.h" -// LEDs -TOSH_ASSIGN_PIN(nLED1, 4, 5); -TOSH_ASSIGN_PIN(nLED2, 4, 6); - -// UART pins -TOSH_ASSIGN_PIN(UC_SOMI, 3, 2); -TOSH_ASSIGN_PIN(UC_SIMO, 3, 1); -TOSH_ASSIGN_PIN(UC_SCK, 3, 3); -TOSH_ASSIGN_PIN(UC_TX, 3, 6); -TOSH_ASSIGN_PIN(UC_RX, 3, 7); - -// ADC -TOSH_ASSIGN_PIN(ADC_VBATT, 6, 0); - -// FLASH -TOSH_ASSIGN_PIN(nFLH_CS, 4, 4); - -// PROGRAMMING PINS (tri-state) -//TOSH_ASSIGN_PIN(TCK, ); -TOSH_ASSIGN_PIN(PROG_RX, 1, 1); -TOSH_ASSIGN_PIN(PROG_TX, 2, 2); - // need to undef atomic inside header files or nesC ignores the directive #undef atomic