From e536878e3286071371a86dfe39282dd10185db12 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Fri, 20 Nov 2015 11:48:55 +0100 Subject: [PATCH 01/20] Added support for 28 pin versions msp430g2553 and several extra clock speeds Added support for 28 pin versions msp430g2553. See also new folder ../variants/launchpad_28pins for the new pin mappings. Added and 1mhz, 8mhz, and 12mhz msp430g2553 (20 pins) --- hardware/msp430/boards.txt | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/hardware/msp430/boards.txt b/hardware/msp430/boards.txt index f759e63eaaa..50218cbb2ae 100644 --- a/hardware/msp430/boards.txt +++ b/hardware/msp430/boards.txt @@ -28,6 +28,36 @@ lpmsp430g2452.build.core=msp430 lpmsp430g2452.build.variant=launchpad lpmsp430g2452.upload.maximum_ram_size=256 +############################################################## +lpmsp430g2553_1.name=LaunchPad w/ msp430g2553 (1MHz) +lpmsp430g2553_1.upload.protocol=rf2500 +lpmsp430g2553_1.upload.maximum_size=16384 +lpmsp430g2553_1.build.mcu=msp430g2553 +lpmsp430g2553_1.build.f_cpu=1000000L +lpmsp430g2553_1.build.core=msp430 +lpmsp430g2553_1.build.variant=launchpad +lpmsp430g2553_1.upload.maximum_ram_size=512 + +############################################################## +lpmsp430g2553_8.name=LaunchPad w/ msp430g2553 (8MHz) +lpmsp430g2553_8.upload.protocol=rf2500 +lpmsp430g2553_8.upload.maximum_size=16384 +lpmsp430g2553_8.build.mcu=msp430g2553 +lpmsp430g2553_8.build.f_cpu=8000000L +lpmsp430g2553_8.build.core=msp430 +lpmsp430g2553_8.build.variant=launchpad +lpmsp430g2553_8.upload.maximum_ram_size=512 + +############################################################## +lpmsp430g2553_12.name=LaunchPad w/ msp430g2553 (12MHz) +lpmsp430g2553_12.upload.protocol=rf2500 +lpmsp430g2553_12.upload.maximum_size=16384 +lpmsp430g2553_12.build.mcu=msp430g2553 +lpmsp430g2553_12.build.f_cpu=12000000L +lpmsp430g2553_12.build.core=msp430 +lpmsp430g2553_12.build.variant=launchpad +lpmsp430g2553_12.upload.maximum_ram_size=512 + ############################################################## lpmsp430g2553.name=LaunchPad w/ msp430g2553 (16MHz) lpmsp430g2553.upload.protocol=rf2500 @@ -38,6 +68,36 @@ lpmsp430g2553.build.core=msp430 lpmsp430g2553.build.variant=launchpad lpmsp430g2553.upload.maximum_ram_size=512 +############################################################## +lpmsp430g2553_28pins_1.name=LaunchPad w/ msp430g2553 28pins (1MHz) +lpmsp430g2553_28pins_1.upload.protocol=rf2500 +lpmsp430g2553_28pins_1.upload.maximum_size=16384 +lpmsp430g2553_28pins_1.build.mcu=msp430g2553 +lpmsp430g2553_28pins_1.build.f_cpu=1000000L +lpmsp430g2553_28pins_1.build.core=msp430 +lpmsp430g2553_28pins_1.build.variant=launchpad_28pins +lpmsp430g2553_28pins_1.upload.maximum_ram_size=512 + +############################################################## +lpmsp430g2553_28pins_8.name=LaunchPad w/ msp430g2553 28pins (8MHz) +lpmsp430g2553_28pins_8.upload.protocol=rf2500 +lpmsp430g2553_28pins_8.upload.maximum_size=16384 +lpmsp430g2553_28pins_8.build.mcu=msp430g2553 +lpmsp430g2553_28pins_8.build.f_cpu=8000000L +lpmsp430g2553_28pins_8.build.core=msp430 +lpmsp430g2553_28pins_8.build.variant=launchpad_28pins +lpmsp430g2553_28pins_8.upload.maximum_ram_size=512 + +############################################################## +lpmsp430g2553_28pins_16.name=LaunchPad w/ msp430g2553 28pins (16MHz) +lpmsp430g2553_28pins_16.upload.protocol=rf2500 +lpmsp430g2553_28pins_16.upload.maximum_size=16384 +lpmsp430g2553_28pins_16.build.mcu=msp430g2553 +lpmsp430g2553_28pins_16.build.f_cpu=16000000L +lpmsp430g2553_28pins_16.build.core=msp430 +lpmsp430g2553_28pins_16.build.variant=launchpad_28pins +lpmsp430g2553_28pins_16.upload.maximum_ram_size=512 + ############################################################## lpmsp430fr5739.name=FraunchPad w/ msp430fr5739 lpmsp430fr5739.upload.protocol=rf2500 From cbe93edf49eea80071d9fab4158dc50e78cfc411 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Fri, 20 Nov 2015 11:52:26 +0100 Subject: [PATCH 02/20] Added support for 28 pin versions msp430g2553 --- hardware/msp430/variants/launchpad_28pins/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins/Board.mk diff --git a/hardware/msp430/variants/launchpad_28pins/Board.mk b/hardware/msp430/variants/launchpad_28pins/Board.mk new file mode 100644 index 00000000000..f160f5a8c66 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 16000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From 92ce9f902d027cbc82cddc79401cac7813b0caa0 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Fri, 20 Nov 2015 11:53:18 +0100 Subject: [PATCH 03/20] Added support for 28 pin versions msp430g2553 --- .../variants/launchpad_28pins/pins_energia.h | 356 ++++++++++++++++++ 1 file changed, 356 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_28pins/pins_energia.h b/hardware/msp430/variants/launchpad_28pins/pins_energia.h new file mode 100644 index 00000000000..18fe97e8071 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins/pins_energia.h @@ -0,0 +1,356 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif +//#define __MSP430_HAS_PORT3_R__ +#if defined(__MSP430_HAS_USCI__) +static const uint8_t SS = 10; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 23; /* P1.7 */ +static const uint8_t MISO = 22; /* P1.6 */ +static const uint8_t TWISDA = 22; /* P1.6 */ +static const uint8_t TWISCL = 23; /* P1.7 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#if defined(__MSP430_HAS_USI__) +static const uint8_t SS = 10; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 22; /* P1.6 */ +static const uint8_t MISO = 23; /* P1.7 */ +static const uint8_t TWISDA = 23; /* P1.7 */ +static const uint8_t TWISCL = 22; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 4; /* Receive Data (RXD) at P1.2 */ +static const uint8_t DEBUG_UARTTXD = 3; /* Transmit Data (TXD) at P1.1 */ +#define TWISDA_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 22; +static const uint8_t A7 = 23; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |28 GND +// (A0) P1.0 2| |27 P2.6/XIN/TA0.1 +// (A1) P1.1/TA0.0 3| |26 P2.7/XOUT +// (A2) P1.2/TA0.1 4| |25 TEST +// (A3) P1.3 5| |24 RST# +// (A4) P1.4 6| |23 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5/TA0.0 7| |22 P1.6/TA0.1 (A6) (SDA) (MOSI) +// P3.1/TA1.0 8| |21 P3.7/TA1CLK/CAOUT +// P3.0/TA0.2 9| |20 P3.6/TA0.2 +// P2.0/TA1.0 10| |19 P3.5/TA0.1 +// P2.1/TA1.1 11| |18 P2.5/TA1.2 +// P2.2/TA1.1 12| |17 P2.4/TA1.2 +// P3.2/TA1.1 13| |16 P2.3/TA1.0 +// P3.3/TA1.2 14| |15 P3.4/TA0.0 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P3_1 = 8; +static const uint8_t P3_0 = 9; +static const uint8_t P2_0 = 10; +static const uint8_t P2_1 = 11; +static const uint8_t P2_2 = 12; +static const uint8_t P3_2 = 13; +static const uint8_t P3_3 = 14; + +static const uint8_t P3_4 = 15; +static const uint8_t P2_3 = 16; +static const uint8_t P2_4 = 17; +static const uint8_t P2_5 = 18; +static const uint8_t P3_5 = 19; +static const uint8_t P3_6 = 20; +static const uint8_t P3_7 = 21; +static const uint8_t P1_6 = 22; +static const uint8_t P1_7 = 23; +static const uint8_t P2_7 = 26; +static const uint8_t P2_6 = 27; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P3.1 */ + T0A2, /* 9 - P3.0 */ + T1A0, /* 10 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 11 - P2.1 */ + T1A1, /* 12 - P2.2 */ + T1A1, /* 13 - P3.2 */ + T1A2, /* 14 - P3.3 */ + T0A0, /* 15 - P3.4 note: A0 output cannot be used with analogWrite */ + T1A0, /* 16 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 17 - P2.4 */ + T1A2, /* 18 - P2.5 */ + T0A1, /* 19 - P3.5 */ + T0A2, /* 20 - P3.6 */ +#else + NOT_ON_TIMER, /* 8 - P3.1 */ + NOT_ON_TIMER, /* 9 - P3.0 */ + NOT_ON_TIMER, /* 10 - P2.0 */ + NOT_ON_TIMER, /* 11 - P2.1 */ + NOT_ON_TIMER, /* 12 - P2.2 */ + NOT_ON_TIMER, /* 13 - P3.2 */ + NOT_ON_TIMER, /* 14 - P3.3 */ + NOT_ON_TIMER, /* 15 - P3.4 */ + NOT_ON_TIMER, /* 16 - P2.3 */ + NOT_ON_TIMER, /* 17 - P2.4 */ + NOT_ON_TIMER, /* 18 - P2.5 */ + NOT_ON_TIMER, /* 19 - P3.5 */ + NOT_ON_TIMER, /* 20 - P3.6 */ +#endif + NOT_ON_TIMER, /* 21 - P3.7 */ + T0A1, /* 22 - P1.6 */ + NOT_ON_TIMER, /* 23 - P1.7 */ + NOT_ON_TIMER, /* 24 - /RESET */ + NOT_ON_TIMER, /* 25 - TEST */ + NOT_ON_TIMER, /* 26 - XOUT - P2.7 */ + T0A1, /* 27 - XIN - P2.6: */ + NOT_ON_TIMER, /* 28 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P3, /* 8 */ + P3, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P3, /* 13 */ + P3, /* 14 */ + P3, /* 15 */ + P2, /* 16 */ + P2, /* 17 */ + P2, /* 18 */ + P3, /* 19 */ + P3, /* 20 */ + P3, /* 21 */ + P1, /* 22 */ + P1, /* 23 */ + NOT_A_PIN, /* 24 */ + NOT_A_PIN, /* 25 */ + P2, /* 26 */ + P2, /* 27 */ + NOT_A_PIN, /* 28 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(1), /* 8, port P3.1 */ + BV(0), /* 9, port P3.0 */ + BV(0), /* 10, port P2.0 */ + BV(1), /* 11, port P2.1 */ + BV(2), /* 12, port P2.2 */ + BV(2), /* 13, port P3.2 */ + BV(3), /* 14, port P3.3 */ + BV(4), /* 15, port P3.4 */ + BV(3), /* 16, port P2.3 */ + BV(4), /* 17, port P2.4 */ + BV(5), /* 18, port P2.5 */ + BV(5), /* 19, port P3.5 */ + BV(6), /* 20, port P3.6 */ + BV(7), /* 21, port P3.7 */ + BV(6), /* 22, port P1.6 */ + BV(7), /* 23, port P1.7 */ + NOT_A_PIN, /* 24, RST */ + NOT_A_PIN, /* 25, TEST */ + BV(7), /* 26, XOUT */ + BV(6), /* 27, XIN */ + NOT_A_PIN, /* 28, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P3.1 */ + NOT_ON_ADC, /* 9 - P3.0 */ + NOT_ON_ADC, /* 10 - P2.0 */ + NOT_ON_ADC, /* 11 - P2.1 */ + NOT_ON_ADC, /* 12 - P2.2 */ + NOT_ON_ADC, /* 13 - P3.2 */ + NOT_ON_ADC, /* 14 - P3.3 */ + NOT_ON_ADC, /* 15 - P3.2 */ + NOT_ON_ADC, /* 16 - P2.3 */ + NOT_ON_ADC, /* 17 - P2.4 */ + NOT_ON_ADC, /* 18 - P2.5 */ + NOT_ON_ADC, /* 19 - P3.5 */ + NOT_ON_ADC, /* 20 - P3.6 */ + NOT_ON_ADC, /* 21 - P3.7 */ + 6, /* 22 - A6 */ + 7, /* 23 - A7 */ + NOT_ON_ADC, /* 24 - RST */ + NOT_ON_ADC, /* 25 - PF0 */ + NOT_ON_ADC, /* 26 - PE0 */ + NOT_ON_ADC, /* 27 - PB2 */ + NOT_ON_ADC /* 28 - GND */ +}; + +#endif +#endif From 672ff9d18b7a83c521d3f5a24fbb53ec58a7d505 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Wed, 25 Nov 2015 12:19:32 +0100 Subject: [PATCH 04/20] Updated code to match new definitions Definitions in github difer from those in the latest release (1010E0016) --- .../variants/launchpad_28pins/pins_energia.h | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/hardware/msp430/variants/launchpad_28pins/pins_energia.h b/hardware/msp430/variants/launchpad_28pins/pins_energia.h index 18fe97e8071..6057e2155bb 100644 --- a/hardware/msp430/variants/launchpad_28pins/pins_energia.h +++ b/hardware/msp430/variants/launchpad_28pins/pins_energia.h @@ -35,38 +35,32 @@ #ifndef BV #define BV(x) (1 << (x)) #endif -//#define __MSP430_HAS_PORT3_R__ -#if defined(__MSP430_HAS_USCI__) + + static const uint8_t SS = 10; /* P2.0 */ static const uint8_t SCK = 7; /* P1.5 */ static const uint8_t MOSI = 23; /* P1.7 */ static const uint8_t MISO = 22; /* P1.6 */ -static const uint8_t TWISDA = 22; /* P1.6 */ -static const uint8_t TWISCL = 23; /* P1.7 */ +static const uint8_t TWISCL1 = 11; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 12; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 23; /* P1.7 */ +static const uint8_t TWISCL0 = 22; /* P1.6 */ static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ -#define TWISDA_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ -#define TWISCL_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) #define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) #define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) #define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) #define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) #define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) #endif - -#define DEBUG_UART_MODULE_OFFSET 0x0 - #if defined(__MSP430_HAS_USI__) -static const uint8_t SS = 10; /* P2.0 */ -static const uint8_t SCK = 7; /* P1.5 */ -static const uint8_t MOSI = 22; /* P1.6 */ -static const uint8_t MISO = 23; /* P1.7 */ -static const uint8_t TWISDA = 23; /* P1.7 */ -static const uint8_t TWISCL = 22; /* P1.6 */ -static const uint8_t DEBUG_UARTRXD = 4; /* Receive Data (RXD) at P1.2 */ -static const uint8_t DEBUG_UARTTXD = 3; /* Transmit Data (TXD) at P1.1 */ -#define TWISDA_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) -#define TWISCL_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) #define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) #define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) #define SPISCK_SET_MODE (PORT_SELECTION0) @@ -74,6 +68,15 @@ static const uint8_t DEBUG_UARTTXD = 3; /* Transmit Data (TXD) at P1.1 */ #define SPIMISO_SET_MODE (PORT_SELECTION0) #endif +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + #define DEBUG_UART_MODULE 0x0 static const uint8_t A0 = 2; From 9e6cf236dbd35bb9ecb8a108f188c845696630f0 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:18:01 +0200 Subject: [PATCH 05/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_16/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_16/Board.mk diff --git a/hardware/msp430/variants/launchpad_16/Board.mk b/hardware/msp430/variants/launchpad_16/Board.mk new file mode 100644 index 00000000000..f160f5a8c66 --- /dev/null +++ b/hardware/msp430/variants/launchpad_16/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 16000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From c46f7851f0141c999cfdf6efe25da3d1dde2095f Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:18:40 +0200 Subject: [PATCH 06/20] Changes to enable several MHz options and 28 pins variants --- .../variants/launchpad_16/pins_energia.h | 306 ++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_16/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_16/pins_energia.h b/hardware/msp430/variants/launchpad_16/pins_energia.h new file mode 100644 index 00000000000..2a38b859524 --- /dev/null +++ b/hardware/msp430/variants/launchpad_16/pins_energia.h @@ -0,0 +1,306 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 8; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 15; /* P1.7 */ +static const uint8_t MISO = 14; /* P1.6 */ +static const uint8_t TWISCL1 = 9; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 10; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 15; /* P1.7 */ +static const uint8_t TWISCL0 = 14; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 14; +static const uint8_t A7 = 15; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P2_0 = 8; +static const uint8_t P2_1 = 9; +static const uint8_t P2_2 = 10; +static const uint8_t P2_3 = 11; +static const uint8_t P2_4 = 12; +static const uint8_t P2_5 = 13; +static const uint8_t P1_6 = 14; +static const uint8_t P1_7 = 15; +static const uint8_t P2_7 = 18; +static const uint8_t P2_6 = 19; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 9 - P2.1 */ + T1A1, /* 10 - P2.2 */ + T1A0, /* 11 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 12 - P2.4 */ + T1A2, /* 13 - P2.5 */ +#else + NOT_ON_TIMER, /* 8 - P2.0 */ + NOT_ON_TIMER, /* 9 - P2.1 */ + NOT_ON_TIMER, /* 10 - P2.3 */ + NOT_ON_TIMER, /* 11 - P2.4 */ + NOT_ON_TIMER, /* 12 - P2.5 */ + NOT_ON_TIMER, /* 13 - P2.6 */ +#endif + T0A1, /* 14 - P1.6 */ + NOT_ON_TIMER, /* 15 - P1.7 */ + NOT_ON_TIMER, /* 16 - /RESET */ + NOT_ON_TIMER, /* 17 - TEST */ + NOT_ON_TIMER, /* 18 - XOUT - P2.7 */ + T0A1, /* 19 - XIN - P2.6: */ + NOT_ON_TIMER, /* 20 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P2, /* 8 */ + P2, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P2, /* 13 */ + P1, /* 14 */ + P1, /* 15 */ + NOT_A_PIN, /* 16 */ + NOT_A_PIN, /* 17 */ + P2, /* 18 */ + P2, /* 19 */ + NOT_A_PIN, /* 20 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(0), /* 8, port P2.0 */ + BV(1), /* 9, port P2.1 */ + BV(2), /* 10, port P2.2 */ + BV(3), /* 11, port P2.3 */ + BV(4), /* 12, port P2.4 */ + BV(5), /* 13, port P2.5 */ + BV(6), /* 14, port P1.6 */ + BV(7), /* 15, port P1.7 */ + NOT_A_PIN, /* 16, RST */ + NOT_A_PIN, /* 17, TEST */ + BV(7), /* 18, XOUT */ + BV(6), /* 19, XIN */ + NOT_A_PIN, /* 20, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P2.0 */ + NOT_ON_ADC, /* 9 - P2.1 */ + NOT_ON_ADC, /* 10 - P2.2 */ + NOT_ON_ADC, /* 11 - P2.3 */ + NOT_ON_ADC, /* 12 - P2.4 */ + NOT_ON_ADC, /* 13 - P2.5 */ + 6, /* 14 - A6 */ + 7, /* 15 - A7 */ + NOT_ON_ADC, /* 16 - RST */ + NOT_ON_ADC, /* 17 - PF0 */ + NOT_ON_ADC, /* 18 - PE0 */ + NOT_ON_ADC, /* 19 - PB2 */ + NOT_ON_ADC /* 20 - GND */ +}; + +#endif +#endif From 0b81b37b09d933e5d6d4bcd52ac5a5eb737c86db Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:19:06 +0200 Subject: [PATCH 07/20] Delete pins_energia.h --- .../variants/launchpad_28pins/pins_energia.h | 359 ------------------ 1 file changed, 359 deletions(-) delete mode 100644 hardware/msp430/variants/launchpad_28pins/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_28pins/pins_energia.h b/hardware/msp430/variants/launchpad_28pins/pins_energia.h deleted file mode 100644 index 6057e2155bb..00000000000 --- a/hardware/msp430/variants/launchpad_28pins/pins_energia.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - ************************************************************************ - * pins_energia.h - * - * Energia core files for MSP430 - * Copyright (c) 2012 Robert Wessels. All right reserved. - * - * Contribution: Rei VILO - * - *********************************************************************** - Derived from: - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA -*/ - -#ifndef Pins_Energia_h -#define Pins_Energia_h -#ifndef BV -#define BV(x) (1 << (x)) -#endif - - -static const uint8_t SS = 10; /* P2.0 */ -static const uint8_t SCK = 7; /* P1.5 */ -static const uint8_t MOSI = 23; /* P1.7 */ -static const uint8_t MISO = 22; /* P1.6 */ -static const uint8_t TWISCL1 = 11; /* P2.1 SW I2C */ -static const uint8_t TWISDA1 = 12; /* P2.2 SW I2C */ -static const uint8_t TWISDA0 = 23; /* P1.7 */ -static const uint8_t TWISCL0 = 22; /* P1.6 */ -static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ -static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ -#define TWISDA1_SET_MODE (INPUT) -#define TWISCL1_SET_MODE (INPUT) -#if defined(__MSP430_HAS_USCI__) -#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ -#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) -#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) -#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) -#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) -#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) -#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) -#endif -#if defined(__MSP430_HAS_USI__) -#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) -#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) -#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) -#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) -#define SPISCK_SET_MODE (PORT_SELECTION0) -#define SPIMOSI_SET_MODE (PORT_SELECTION0) -#define SPIMISO_SET_MODE (PORT_SELECTION0) -#endif - -/* Define the default I2C settings */ -#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ -#define TWISDA TWISDA1 -#define TWISCL TWISCL1 -#define TWISDA_SET_MODE TWISDA1_SET_MODE -#define TWISCL_SET_MODE TWISCL1_SET_MODE - -#define DEBUG_UART_MODULE_OFFSET 0x0 - -#define DEBUG_UART_MODULE 0x0 - -static const uint8_t A0 = 2; -static const uint8_t A1 = 3; -static const uint8_t A2 = 4; -static const uint8_t A3 = 5; -static const uint8_t A4 = 6; -static const uint8_t A5 = 7; -static const uint8_t A6 = 22; -static const uint8_t A7 = 23; -static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor - -// +-\/-+ -// VCC 1| |28 GND -// (A0) P1.0 2| |27 P2.6/XIN/TA0.1 -// (A1) P1.1/TA0.0 3| |26 P2.7/XOUT -// (A2) P1.2/TA0.1 4| |25 TEST -// (A3) P1.3 5| |24 RST# -// (A4) P1.4 6| |23 P1.7 (A7) (SCL) (MISO) depends on chip -// (A5) P1.5/TA0.0 7| |22 P1.6/TA0.1 (A6) (SDA) (MOSI) -// P3.1/TA1.0 8| |21 P3.7/TA1CLK/CAOUT -// P3.0/TA0.2 9| |20 P3.6/TA0.2 -// P2.0/TA1.0 10| |19 P3.5/TA0.1 -// P2.1/TA1.1 11| |18 P2.5/TA1.2 -// P2.2/TA1.1 12| |17 P2.4/TA1.2 -// P3.2/TA1.1 13| |16 P2.3/TA1.0 -// P3.3/TA1.2 14| |15 P3.4/TA0.0 -// +----+ -// - -// Pin names based on the silkscreen -// -static const uint8_t P1_0 = 2; -static const uint8_t P1_1 = 3; -static const uint8_t P1_2 = 4; -static const uint8_t P1_3 = 5; -static const uint8_t P1_4 = 6; -static const uint8_t P1_5 = 7; -static const uint8_t P3_1 = 8; -static const uint8_t P3_0 = 9; -static const uint8_t P2_0 = 10; -static const uint8_t P2_1 = 11; -static const uint8_t P2_2 = 12; -static const uint8_t P3_2 = 13; -static const uint8_t P3_3 = 14; - -static const uint8_t P3_4 = 15; -static const uint8_t P2_3 = 16; -static const uint8_t P2_4 = 17; -static const uint8_t P2_5 = 18; -static const uint8_t P3_5 = 19; -static const uint8_t P3_6 = 20; -static const uint8_t P3_7 = 21; -static const uint8_t P1_6 = 22; -static const uint8_t P1_7 = 23; -static const uint8_t P2_7 = 26; -static const uint8_t P2_6 = 27; - -static const uint8_t RED_LED = 2; -static const uint8_t GREEN_LED = 14; -static const uint8_t PUSH2 = 5; -static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip - - -#ifdef ARDUINO_MAIN - -const uint16_t port_to_input[] = { - NOT_A_PORT, - (uint16_t) &P1IN, - (uint16_t) &P2IN, -#ifdef __MSP430_HAS_PORT3_R__ - (uint16_t) &P3IN, -#endif -}; - -const uint16_t port_to_output[] = { - NOT_A_PORT, - (uint16_t) &P1OUT, - (uint16_t) &P2OUT, -#ifdef __MSP430_HAS_PORT3_R__ - (uint16_t) &P3OUT, -#endif -}; - -const uint16_t port_to_dir[] = { - NOT_A_PORT, - (uint16_t) &P1DIR, - (uint16_t) &P2DIR, -#ifdef __MSP430_HAS_PORT3_R__ - (uint16_t) &P3DIR, -#endif -}; - -const uint16_t port_to_ren[] = { - NOT_A_PORT, - (uint16_t) &P1REN, - (uint16_t) &P2REN, -#ifdef __MSP430_HAS_PORT3_R__ - (uint16_t) &P3REN, -#endif -}; - -const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ - NOT_A_PORT, - (uint16_t) &P1SEL, - (uint16_t) &P2SEL, -#ifdef __MSP430_HAS_PORT3_R__ - (uint16_t) &P3SEL, -#endif -}; - -const uint16_t port_to_sel2[] = { - NOT_A_PORT, -#ifdef P1SEL2_ - (uint16_t) &P1SEL2, -#else - NOT_A_PORT, -#endif -#ifdef P2SEL2_ - (uint16_t) &P2SEL2, -#else - NOT_A_PORT, -#endif -#ifdef P3SEL2_ - (uint16_t) &P3SEL2, -#else - NOT_A_PORT, -#endif -}; - - -/* - * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available - * T0A1, T1A1 and T1A2 - */ -const uint8_t digital_pin_to_timer[] = { - NOT_ON_TIMER, /* dummy */ - NOT_ON_TIMER, /* 1 - VCC */ - NOT_ON_TIMER, /* 2 - P1.0 */ - T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ - T0A1, /* 4 - P1.2 */ - NOT_ON_TIMER, /* 5 - P1.3 */ - NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ - T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ -#if defined(__MSP430_HAS_T1A3__) - T1A0, /* 8 - P3.1 */ - T0A2, /* 9 - P3.0 */ - T1A0, /* 10 - P2.0 note: A0 output cannot be used with analogWrite */ - T1A1, /* 11 - P2.1 */ - T1A1, /* 12 - P2.2 */ - T1A1, /* 13 - P3.2 */ - T1A2, /* 14 - P3.3 */ - T0A0, /* 15 - P3.4 note: A0 output cannot be used with analogWrite */ - T1A0, /* 16 - P2.3 note: A0 output cannot be used with analogWrite */ - T1A2, /* 17 - P2.4 */ - T1A2, /* 18 - P2.5 */ - T0A1, /* 19 - P3.5 */ - T0A2, /* 20 - P3.6 */ -#else - NOT_ON_TIMER, /* 8 - P3.1 */ - NOT_ON_TIMER, /* 9 - P3.0 */ - NOT_ON_TIMER, /* 10 - P2.0 */ - NOT_ON_TIMER, /* 11 - P2.1 */ - NOT_ON_TIMER, /* 12 - P2.2 */ - NOT_ON_TIMER, /* 13 - P3.2 */ - NOT_ON_TIMER, /* 14 - P3.3 */ - NOT_ON_TIMER, /* 15 - P3.4 */ - NOT_ON_TIMER, /* 16 - P2.3 */ - NOT_ON_TIMER, /* 17 - P2.4 */ - NOT_ON_TIMER, /* 18 - P2.5 */ - NOT_ON_TIMER, /* 19 - P3.5 */ - NOT_ON_TIMER, /* 20 - P3.6 */ -#endif - NOT_ON_TIMER, /* 21 - P3.7 */ - T0A1, /* 22 - P1.6 */ - NOT_ON_TIMER, /* 23 - P1.7 */ - NOT_ON_TIMER, /* 24 - /RESET */ - NOT_ON_TIMER, /* 25 - TEST */ - NOT_ON_TIMER, /* 26 - XOUT - P2.7 */ - T0A1, /* 27 - XIN - P2.6: */ - NOT_ON_TIMER, /* 28 - GND */ -}; - -const uint8_t digital_pin_to_port[] = { - NOT_A_PIN, /* dummy */ - NOT_A_PIN, /* 1 */ - P1, /* 2 */ - P1, /* 3 */ - P1, /* 4 */ - P1, /* 5 */ - P1, /* 6 */ - P1, /* 7 */ - P3, /* 8 */ - P3, /* 9 */ - P2, /* 10 */ - P2, /* 11 */ - P2, /* 12 */ - P3, /* 13 */ - P3, /* 14 */ - P3, /* 15 */ - P2, /* 16 */ - P2, /* 17 */ - P2, /* 18 */ - P3, /* 19 */ - P3, /* 20 */ - P3, /* 21 */ - P1, /* 22 */ - P1, /* 23 */ - NOT_A_PIN, /* 24 */ - NOT_A_PIN, /* 25 */ - P2, /* 26 */ - P2, /* 27 */ - NOT_A_PIN, /* 28 */ -}; - -const uint8_t digital_pin_to_bit_mask[] = { - NOT_A_PIN, /* 0, pin count starts at 1 */ - NOT_A_PIN, /* 1, VCC */ - BV(0), /* 2, port P1.0 */ - BV(1), /* 3, port P1.1 */ - BV(2), /* 4, port P1.2 */ - BV(3), /* 5, port P1.3*/ - BV(4), /* 6, port P1.4 */ - BV(5), /* 7, port P1.5 */ - BV(1), /* 8, port P3.1 */ - BV(0), /* 9, port P3.0 */ - BV(0), /* 10, port P2.0 */ - BV(1), /* 11, port P2.1 */ - BV(2), /* 12, port P2.2 */ - BV(2), /* 13, port P3.2 */ - BV(3), /* 14, port P3.3 */ - BV(4), /* 15, port P3.4 */ - BV(3), /* 16, port P2.3 */ - BV(4), /* 17, port P2.4 */ - BV(5), /* 18, port P2.5 */ - BV(5), /* 19, port P3.5 */ - BV(6), /* 20, port P3.6 */ - BV(7), /* 21, port P3.7 */ - BV(6), /* 22, port P1.6 */ - BV(7), /* 23, port P1.7 */ - NOT_A_PIN, /* 24, RST */ - NOT_A_PIN, /* 25, TEST */ - BV(7), /* 26, XOUT */ - BV(6), /* 27, XIN */ - NOT_A_PIN, /* 28, GND */ -}; -const uint32_t digital_pin_to_analog_in[] = { - NOT_ON_ADC, /* dummy */ - NOT_ON_ADC, /* 1 - 3.3V*/ - 0, /* 2 - A0 */ - 1, /* 3 - A1 */ - 2, /* 4 - A2 */ - 3, /* 5 - A3 */ - 4, /* 6 - A4 */ - 5, /* 7 - A5 */ - NOT_ON_ADC, /* 8 - P3.1 */ - NOT_ON_ADC, /* 9 - P3.0 */ - NOT_ON_ADC, /* 10 - P2.0 */ - NOT_ON_ADC, /* 11 - P2.1 */ - NOT_ON_ADC, /* 12 - P2.2 */ - NOT_ON_ADC, /* 13 - P3.2 */ - NOT_ON_ADC, /* 14 - P3.3 */ - NOT_ON_ADC, /* 15 - P3.2 */ - NOT_ON_ADC, /* 16 - P2.3 */ - NOT_ON_ADC, /* 17 - P2.4 */ - NOT_ON_ADC, /* 18 - P2.5 */ - NOT_ON_ADC, /* 19 - P3.5 */ - NOT_ON_ADC, /* 20 - P3.6 */ - NOT_ON_ADC, /* 21 - P3.7 */ - 6, /* 22 - A6 */ - 7, /* 23 - A7 */ - NOT_ON_ADC, /* 24 - RST */ - NOT_ON_ADC, /* 25 - PF0 */ - NOT_ON_ADC, /* 26 - PE0 */ - NOT_ON_ADC, /* 27 - PB2 */ - NOT_ON_ADC /* 28 - GND */ -}; - -#endif -#endif From e5d67cc04b40e43c24ac6ed521148c10b7dacf59 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:19:13 +0200 Subject: [PATCH 08/20] Delete Board.mk --- hardware/msp430/variants/launchpad_28pins/Board.mk | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 hardware/msp430/variants/launchpad_28pins/Board.mk diff --git a/hardware/msp430/variants/launchpad_28pins/Board.mk b/hardware/msp430/variants/launchpad_28pins/Board.mk deleted file mode 100644 index f160f5a8c66..00000000000 --- a/hardware/msp430/variants/launchpad_28pins/Board.mk +++ /dev/null @@ -1,9 +0,0 @@ -###################################### -# Board specific -ARCH = msp430 -MCU = msp430g2553 -MCU_FLAG = -mmcu=$(MCU) -F_CPU = 16000000L -FLASH_SIZE = 16384 -UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" -###################################### From 59805392fd49ea3d61f3cf90e1e56f90fb0ea0d0 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:20:26 +0200 Subject: [PATCH 09/20] Changes to enable several MHz options and 28 pins variants --- .../variants/launchpad_8/pins_energia.h | 306 ++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_8/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_8/pins_energia.h b/hardware/msp430/variants/launchpad_8/pins_energia.h new file mode 100644 index 00000000000..2a38b859524 --- /dev/null +++ b/hardware/msp430/variants/launchpad_8/pins_energia.h @@ -0,0 +1,306 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 8; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 15; /* P1.7 */ +static const uint8_t MISO = 14; /* P1.6 */ +static const uint8_t TWISCL1 = 9; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 10; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 15; /* P1.7 */ +static const uint8_t TWISCL0 = 14; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 14; +static const uint8_t A7 = 15; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P2_0 = 8; +static const uint8_t P2_1 = 9; +static const uint8_t P2_2 = 10; +static const uint8_t P2_3 = 11; +static const uint8_t P2_4 = 12; +static const uint8_t P2_5 = 13; +static const uint8_t P1_6 = 14; +static const uint8_t P1_7 = 15; +static const uint8_t P2_7 = 18; +static const uint8_t P2_6 = 19; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 9 - P2.1 */ + T1A1, /* 10 - P2.2 */ + T1A0, /* 11 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 12 - P2.4 */ + T1A2, /* 13 - P2.5 */ +#else + NOT_ON_TIMER, /* 8 - P2.0 */ + NOT_ON_TIMER, /* 9 - P2.1 */ + NOT_ON_TIMER, /* 10 - P2.3 */ + NOT_ON_TIMER, /* 11 - P2.4 */ + NOT_ON_TIMER, /* 12 - P2.5 */ + NOT_ON_TIMER, /* 13 - P2.6 */ +#endif + T0A1, /* 14 - P1.6 */ + NOT_ON_TIMER, /* 15 - P1.7 */ + NOT_ON_TIMER, /* 16 - /RESET */ + NOT_ON_TIMER, /* 17 - TEST */ + NOT_ON_TIMER, /* 18 - XOUT - P2.7 */ + T0A1, /* 19 - XIN - P2.6: */ + NOT_ON_TIMER, /* 20 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P2, /* 8 */ + P2, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P2, /* 13 */ + P1, /* 14 */ + P1, /* 15 */ + NOT_A_PIN, /* 16 */ + NOT_A_PIN, /* 17 */ + P2, /* 18 */ + P2, /* 19 */ + NOT_A_PIN, /* 20 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(0), /* 8, port P2.0 */ + BV(1), /* 9, port P2.1 */ + BV(2), /* 10, port P2.2 */ + BV(3), /* 11, port P2.3 */ + BV(4), /* 12, port P2.4 */ + BV(5), /* 13, port P2.5 */ + BV(6), /* 14, port P1.6 */ + BV(7), /* 15, port P1.7 */ + NOT_A_PIN, /* 16, RST */ + NOT_A_PIN, /* 17, TEST */ + BV(7), /* 18, XOUT */ + BV(6), /* 19, XIN */ + NOT_A_PIN, /* 20, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P2.0 */ + NOT_ON_ADC, /* 9 - P2.1 */ + NOT_ON_ADC, /* 10 - P2.2 */ + NOT_ON_ADC, /* 11 - P2.3 */ + NOT_ON_ADC, /* 12 - P2.4 */ + NOT_ON_ADC, /* 13 - P2.5 */ + 6, /* 14 - A6 */ + 7, /* 15 - A7 */ + NOT_ON_ADC, /* 16 - RST */ + NOT_ON_ADC, /* 17 - PF0 */ + NOT_ON_ADC, /* 18 - PE0 */ + NOT_ON_ADC, /* 19 - PB2 */ + NOT_ON_ADC /* 20 - GND */ +}; + +#endif +#endif From 3958df3a5ef7c0f1a51ce89bf6d9270ba384df49 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:20:57 +0200 Subject: [PATCH 10/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_8/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_8/Board.mk diff --git a/hardware/msp430/variants/launchpad_8/Board.mk b/hardware/msp430/variants/launchpad_8/Board.mk new file mode 100644 index 00000000000..3f462e07b9b --- /dev/null +++ b/hardware/msp430/variants/launchpad_8/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 8000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From 6610ee2170ee4948262cc6462227d6e4750cba7d Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:21:45 +0200 Subject: [PATCH 11/20] Changes to enable several MHz options and 28 pins variants --- .../variants/launchpad_12/pins_energia.h | 306 ++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_12/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_12/pins_energia.h b/hardware/msp430/variants/launchpad_12/pins_energia.h new file mode 100644 index 00000000000..2a38b859524 --- /dev/null +++ b/hardware/msp430/variants/launchpad_12/pins_energia.h @@ -0,0 +1,306 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 8; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 15; /* P1.7 */ +static const uint8_t MISO = 14; /* P1.6 */ +static const uint8_t TWISCL1 = 9; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 10; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 15; /* P1.7 */ +static const uint8_t TWISCL0 = 14; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 14; +static const uint8_t A7 = 15; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P2_0 = 8; +static const uint8_t P2_1 = 9; +static const uint8_t P2_2 = 10; +static const uint8_t P2_3 = 11; +static const uint8_t P2_4 = 12; +static const uint8_t P2_5 = 13; +static const uint8_t P1_6 = 14; +static const uint8_t P1_7 = 15; +static const uint8_t P2_7 = 18; +static const uint8_t P2_6 = 19; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 9 - P2.1 */ + T1A1, /* 10 - P2.2 */ + T1A0, /* 11 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 12 - P2.4 */ + T1A2, /* 13 - P2.5 */ +#else + NOT_ON_TIMER, /* 8 - P2.0 */ + NOT_ON_TIMER, /* 9 - P2.1 */ + NOT_ON_TIMER, /* 10 - P2.3 */ + NOT_ON_TIMER, /* 11 - P2.4 */ + NOT_ON_TIMER, /* 12 - P2.5 */ + NOT_ON_TIMER, /* 13 - P2.6 */ +#endif + T0A1, /* 14 - P1.6 */ + NOT_ON_TIMER, /* 15 - P1.7 */ + NOT_ON_TIMER, /* 16 - /RESET */ + NOT_ON_TIMER, /* 17 - TEST */ + NOT_ON_TIMER, /* 18 - XOUT - P2.7 */ + T0A1, /* 19 - XIN - P2.6: */ + NOT_ON_TIMER, /* 20 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P2, /* 8 */ + P2, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P2, /* 13 */ + P1, /* 14 */ + P1, /* 15 */ + NOT_A_PIN, /* 16 */ + NOT_A_PIN, /* 17 */ + P2, /* 18 */ + P2, /* 19 */ + NOT_A_PIN, /* 20 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(0), /* 8, port P2.0 */ + BV(1), /* 9, port P2.1 */ + BV(2), /* 10, port P2.2 */ + BV(3), /* 11, port P2.3 */ + BV(4), /* 12, port P2.4 */ + BV(5), /* 13, port P2.5 */ + BV(6), /* 14, port P1.6 */ + BV(7), /* 15, port P1.7 */ + NOT_A_PIN, /* 16, RST */ + NOT_A_PIN, /* 17, TEST */ + BV(7), /* 18, XOUT */ + BV(6), /* 19, XIN */ + NOT_A_PIN, /* 20, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P2.0 */ + NOT_ON_ADC, /* 9 - P2.1 */ + NOT_ON_ADC, /* 10 - P2.2 */ + NOT_ON_ADC, /* 11 - P2.3 */ + NOT_ON_ADC, /* 12 - P2.4 */ + NOT_ON_ADC, /* 13 - P2.5 */ + 6, /* 14 - A6 */ + 7, /* 15 - A7 */ + NOT_ON_ADC, /* 16 - RST */ + NOT_ON_ADC, /* 17 - PF0 */ + NOT_ON_ADC, /* 18 - PE0 */ + NOT_ON_ADC, /* 19 - PB2 */ + NOT_ON_ADC /* 20 - GND */ +}; + +#endif +#endif From 3e4d85264fd6ea731a79eccdc4143e4de98b4385 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:22:28 +0200 Subject: [PATCH 12/20] Changes to enable several MHz options and 28 pins variants --- .../variants/launchpad_1/pins_energia.h | 306 ++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_1/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_1/pins_energia.h b/hardware/msp430/variants/launchpad_1/pins_energia.h new file mode 100644 index 00000000000..2a38b859524 --- /dev/null +++ b/hardware/msp430/variants/launchpad_1/pins_energia.h @@ -0,0 +1,306 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 8; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 15; /* P1.7 */ +static const uint8_t MISO = 14; /* P1.6 */ +static const uint8_t TWISCL1 = 9; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 10; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 15; /* P1.7 */ +static const uint8_t TWISCL0 = 14; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 14; +static const uint8_t A7 = 15; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P2_0 = 8; +static const uint8_t P2_1 = 9; +static const uint8_t P2_2 = 10; +static const uint8_t P2_3 = 11; +static const uint8_t P2_4 = 12; +static const uint8_t P2_5 = 13; +static const uint8_t P1_6 = 14; +static const uint8_t P1_7 = 15; +static const uint8_t P2_7 = 18; +static const uint8_t P2_6 = 19; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 9 - P2.1 */ + T1A1, /* 10 - P2.2 */ + T1A0, /* 11 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 12 - P2.4 */ + T1A2, /* 13 - P2.5 */ +#else + NOT_ON_TIMER, /* 8 - P2.0 */ + NOT_ON_TIMER, /* 9 - P2.1 */ + NOT_ON_TIMER, /* 10 - P2.3 */ + NOT_ON_TIMER, /* 11 - P2.4 */ + NOT_ON_TIMER, /* 12 - P2.5 */ + NOT_ON_TIMER, /* 13 - P2.6 */ +#endif + T0A1, /* 14 - P1.6 */ + NOT_ON_TIMER, /* 15 - P1.7 */ + NOT_ON_TIMER, /* 16 - /RESET */ + NOT_ON_TIMER, /* 17 - TEST */ + NOT_ON_TIMER, /* 18 - XOUT - P2.7 */ + T0A1, /* 19 - XIN - P2.6: */ + NOT_ON_TIMER, /* 20 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P2, /* 8 */ + P2, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P2, /* 13 */ + P1, /* 14 */ + P1, /* 15 */ + NOT_A_PIN, /* 16 */ + NOT_A_PIN, /* 17 */ + P2, /* 18 */ + P2, /* 19 */ + NOT_A_PIN, /* 20 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(0), /* 8, port P2.0 */ + BV(1), /* 9, port P2.1 */ + BV(2), /* 10, port P2.2 */ + BV(3), /* 11, port P2.3 */ + BV(4), /* 12, port P2.4 */ + BV(5), /* 13, port P2.5 */ + BV(6), /* 14, port P1.6 */ + BV(7), /* 15, port P1.7 */ + NOT_A_PIN, /* 16, RST */ + NOT_A_PIN, /* 17, TEST */ + BV(7), /* 18, XOUT */ + BV(6), /* 19, XIN */ + NOT_A_PIN, /* 20, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P2.0 */ + NOT_ON_ADC, /* 9 - P2.1 */ + NOT_ON_ADC, /* 10 - P2.2 */ + NOT_ON_ADC, /* 11 - P2.3 */ + NOT_ON_ADC, /* 12 - P2.4 */ + NOT_ON_ADC, /* 13 - P2.5 */ + 6, /* 14 - A6 */ + 7, /* 15 - A7 */ + NOT_ON_ADC, /* 16 - RST */ + NOT_ON_ADC, /* 17 - PF0 */ + NOT_ON_ADC, /* 18 - PE0 */ + NOT_ON_ADC, /* 19 - PB2 */ + NOT_ON_ADC /* 20 - GND */ +}; + +#endif +#endif From a089180146a6773d6cd6ee8cccc55a4e95681815 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:23:02 +0200 Subject: [PATCH 13/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_1/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_1/Board.mk diff --git a/hardware/msp430/variants/launchpad_1/Board.mk b/hardware/msp430/variants/launchpad_1/Board.mk new file mode 100644 index 00000000000..69431adef84 --- /dev/null +++ b/hardware/msp430/variants/launchpad_1/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 1000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From 5af7219b4f9866b0c29dfd09412b52f7dd79fa41 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:23:26 +0200 Subject: [PATCH 14/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_12/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_12/Board.mk diff --git a/hardware/msp430/variants/launchpad_12/Board.mk b/hardware/msp430/variants/launchpad_12/Board.mk new file mode 100644 index 00000000000..5f525be850e --- /dev/null +++ b/hardware/msp430/variants/launchpad_12/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 12000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From 13a9f526c69a62916aecf0de519e8c2c9a594994 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:25:00 +0200 Subject: [PATCH 15/20] Changes to enable several MHz options and 28 pins variants --- .../launchpad_28pins_16/pins_energia.h | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_16/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_28pins_16/pins_energia.h b/hardware/msp430/variants/launchpad_28pins_16/pins_energia.h new file mode 100644 index 00000000000..f8a41950f93 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_16/pins_energia.h @@ -0,0 +1,359 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + + Apr 2016 - Edited by David Sanz Kirbis to match 28 pins chip version + +*/ + +#define __MSP430_HAS_PORT3_R__ +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 10; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 23; /* P1.7 */ +static const uint8_t MISO = 22; /* P1.6 */ +static const uint8_t TWISCL1 = 11; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 12; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 23; /* P1.7 */ +static const uint8_t TWISCL0 = 22; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 22; +static const uint8_t A7 = 23; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P3_1 = 8; +static const uint8_t P3_0 = 9; +static const uint8_t P2_0 = 10; +static const uint8_t P2_1 = 11; +static const uint8_t P2_2 = 12; +static const uint8_t P3_2 = 13; +static const uint8_t P3_3 = 14; + +static const uint8_t P3_4 = 15; +static const uint8_t P2_3 = 16; +static const uint8_t P2_4 = 17; +static const uint8_t P2_5 = 18; +static const uint8_t P3_5 = 19; +static const uint8_t P3_6 = 20; +static const uint8_t P3_7 = 21; +static const uint8_t P1_6 = 22; +static const uint8_t P1_7 = 23; +static const uint8_t P2_7 = 26; +static const uint8_t P2_6 = 27; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P3.1 */ + T0A2, /* 9 - P3.0 */ + T1A0, /* 10 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 11 - P2.1 */ + T1A1, /* 12 - P2.2 */ + T1A1, /* 13 - P3.2 */ + T1A2, /* 14 - P3.3 */ + T0A0, /* 15 - P3.4 note: A0 output cannot be used with analogWrite */ + T1A0, /* 16 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 17 - P2.4 */ + T1A2, /* 18 - P2.5 */ + T0A1, /* 19 - P3.5 */ + T0A2, /* 20 - P3.6 */ +#else + NOT_ON_TIMER, /* 8 - P3.1 */ + NOT_ON_TIMER, /* 9 - P3.0 */ + NOT_ON_TIMER, /* 10 - P2.0 */ + NOT_ON_TIMER, /* 11 - P2.1 */ + NOT_ON_TIMER, /* 12 - P2.2 */ + NOT_ON_TIMER, /* 13 - P3.2 */ + NOT_ON_TIMER, /* 14 - P3.3 */ + NOT_ON_TIMER, /* 15 - P3.4 */ + NOT_ON_TIMER, /* 16 - P2.3 */ + NOT_ON_TIMER, /* 17 - P2.4 */ + NOT_ON_TIMER, /* 18 - P2.5 */ + NOT_ON_TIMER, /* 19 - P3.5 */ + NOT_ON_TIMER, /* 20 - P3.6 */ +#endif + NOT_ON_TIMER, /* 21 - P3.7 */ + T0A1, /* 22 - P1.6 */ + NOT_ON_TIMER, /* 23 - P1.7 */ + NOT_ON_TIMER, /* 24 - /RESET */ + NOT_ON_TIMER, /* 25 - TEST */ + NOT_ON_TIMER, /* 26 - XOUT - P2.7 */ + T0A1, /* 27 - XIN - P2.6: */ + NOT_ON_TIMER, /* 28 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P3, /* 8 */ + P3, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P3, /* 13 */ + P3, /* 14 */ + P3, /* 15 */ + P2, /* 16 */ + P2, /* 17 */ + P2, /* 18 */ + P3, /* 19 */ + P3, /* 20 */ + P3, /* 21 */ + P1, /* 22 */ + P1, /* 23 */ + NOT_A_PIN, /* 24 */ + NOT_A_PIN, /* 25 */ + P2, /* 26 */ + P2, /* 27 */ + NOT_A_PIN, /* 28 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(1), /* 8, port P3.1 */ + BV(0), /* 9, port P3.0 */ + BV(0), /* 10, port P2.0 */ + BV(1), /* 11, port P2.1 */ + BV(2), /* 12, port P2.2 */ + BV(2), /* 13, port P3.2 */ + BV(3), /* 14, port P3.3 */ + BV(4), /* 15, port P3.4 */ + BV(3), /* 16, port P2.3 */ + BV(4), /* 17, port P2.4 */ + BV(5), /* 18, port P2.5 */ + BV(5), /* 19, port P3.5 */ + BV(6), /* 20, port P3.6 */ + BV(7), /* 21, port P3.7 */ + BV(6), /* 22, port P1.6 */ + BV(7), /* 23, port P1.7 */ + NOT_A_PIN, /* 24, RST */ + NOT_A_PIN, /* 25, TEST */ + BV(7), /* 26, XOUT */ + BV(6), /* 27, XIN */ + NOT_A_PIN, /* 28, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P3.1 */ + NOT_ON_ADC, /* 9 - P3.0 */ + NOT_ON_ADC, /* 10 - P2.0 */ + NOT_ON_ADC, /* 11 - P2.1 */ + NOT_ON_ADC, /* 12 - P2.2 */ + NOT_ON_ADC, /* 13 - P3.2 */ + NOT_ON_ADC, /* 14 - P3.3 */ + NOT_ON_ADC, /* 15 - P3.2 */ + NOT_ON_ADC, /* 16 - P2.3 */ + NOT_ON_ADC, /* 17 - P2.4 */ + NOT_ON_ADC, /* 18 - P2.5 */ + NOT_ON_ADC, /* 19 - P3.5 */ + NOT_ON_ADC, /* 20 - P3.6 */ + NOT_ON_ADC, /* 21 - P3.7 */ + 6, /* 22 - A6 */ + 7, /* 23 - A7 */ + NOT_ON_ADC, /* 24 - RST */ + NOT_ON_ADC, /* 25 - PF0 */ + NOT_ON_ADC, /* 26 - PE0 */ + NOT_ON_ADC, /* 27 - PB2 */ + NOT_ON_ADC /* 28 - GND */ +}; + +#endif +#endif From aa38c3fb40ebc1fe31232ad8a5ac57a8ab910d54 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:25:13 +0200 Subject: [PATCH 16/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_28pins_16/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_16/Board.mk diff --git a/hardware/msp430/variants/launchpad_28pins_16/Board.mk b/hardware/msp430/variants/launchpad_28pins_16/Board.mk new file mode 100644 index 00000000000..f160f5a8c66 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_16/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 16000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From d67567e6504311be192d83dc8da3c34d77689939 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:25:55 +0200 Subject: [PATCH 17/20] Changes to enable several MHz options and 28 pins variants --- .../launchpad_28pins_8/pins_energia.h | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_8/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_28pins_8/pins_energia.h b/hardware/msp430/variants/launchpad_28pins_8/pins_energia.h new file mode 100644 index 00000000000..f8a41950f93 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_8/pins_energia.h @@ -0,0 +1,359 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + + Apr 2016 - Edited by David Sanz Kirbis to match 28 pins chip version + +*/ + +#define __MSP430_HAS_PORT3_R__ +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 10; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 23; /* P1.7 */ +static const uint8_t MISO = 22; /* P1.6 */ +static const uint8_t TWISCL1 = 11; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 12; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 23; /* P1.7 */ +static const uint8_t TWISCL0 = 22; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 22; +static const uint8_t A7 = 23; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P3_1 = 8; +static const uint8_t P3_0 = 9; +static const uint8_t P2_0 = 10; +static const uint8_t P2_1 = 11; +static const uint8_t P2_2 = 12; +static const uint8_t P3_2 = 13; +static const uint8_t P3_3 = 14; + +static const uint8_t P3_4 = 15; +static const uint8_t P2_3 = 16; +static const uint8_t P2_4 = 17; +static const uint8_t P2_5 = 18; +static const uint8_t P3_5 = 19; +static const uint8_t P3_6 = 20; +static const uint8_t P3_7 = 21; +static const uint8_t P1_6 = 22; +static const uint8_t P1_7 = 23; +static const uint8_t P2_7 = 26; +static const uint8_t P2_6 = 27; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P3.1 */ + T0A2, /* 9 - P3.0 */ + T1A0, /* 10 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 11 - P2.1 */ + T1A1, /* 12 - P2.2 */ + T1A1, /* 13 - P3.2 */ + T1A2, /* 14 - P3.3 */ + T0A0, /* 15 - P3.4 note: A0 output cannot be used with analogWrite */ + T1A0, /* 16 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 17 - P2.4 */ + T1A2, /* 18 - P2.5 */ + T0A1, /* 19 - P3.5 */ + T0A2, /* 20 - P3.6 */ +#else + NOT_ON_TIMER, /* 8 - P3.1 */ + NOT_ON_TIMER, /* 9 - P3.0 */ + NOT_ON_TIMER, /* 10 - P2.0 */ + NOT_ON_TIMER, /* 11 - P2.1 */ + NOT_ON_TIMER, /* 12 - P2.2 */ + NOT_ON_TIMER, /* 13 - P3.2 */ + NOT_ON_TIMER, /* 14 - P3.3 */ + NOT_ON_TIMER, /* 15 - P3.4 */ + NOT_ON_TIMER, /* 16 - P2.3 */ + NOT_ON_TIMER, /* 17 - P2.4 */ + NOT_ON_TIMER, /* 18 - P2.5 */ + NOT_ON_TIMER, /* 19 - P3.5 */ + NOT_ON_TIMER, /* 20 - P3.6 */ +#endif + NOT_ON_TIMER, /* 21 - P3.7 */ + T0A1, /* 22 - P1.6 */ + NOT_ON_TIMER, /* 23 - P1.7 */ + NOT_ON_TIMER, /* 24 - /RESET */ + NOT_ON_TIMER, /* 25 - TEST */ + NOT_ON_TIMER, /* 26 - XOUT - P2.7 */ + T0A1, /* 27 - XIN - P2.6: */ + NOT_ON_TIMER, /* 28 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P3, /* 8 */ + P3, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P3, /* 13 */ + P3, /* 14 */ + P3, /* 15 */ + P2, /* 16 */ + P2, /* 17 */ + P2, /* 18 */ + P3, /* 19 */ + P3, /* 20 */ + P3, /* 21 */ + P1, /* 22 */ + P1, /* 23 */ + NOT_A_PIN, /* 24 */ + NOT_A_PIN, /* 25 */ + P2, /* 26 */ + P2, /* 27 */ + NOT_A_PIN, /* 28 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(1), /* 8, port P3.1 */ + BV(0), /* 9, port P3.0 */ + BV(0), /* 10, port P2.0 */ + BV(1), /* 11, port P2.1 */ + BV(2), /* 12, port P2.2 */ + BV(2), /* 13, port P3.2 */ + BV(3), /* 14, port P3.3 */ + BV(4), /* 15, port P3.4 */ + BV(3), /* 16, port P2.3 */ + BV(4), /* 17, port P2.4 */ + BV(5), /* 18, port P2.5 */ + BV(5), /* 19, port P3.5 */ + BV(6), /* 20, port P3.6 */ + BV(7), /* 21, port P3.7 */ + BV(6), /* 22, port P1.6 */ + BV(7), /* 23, port P1.7 */ + NOT_A_PIN, /* 24, RST */ + NOT_A_PIN, /* 25, TEST */ + BV(7), /* 26, XOUT */ + BV(6), /* 27, XIN */ + NOT_A_PIN, /* 28, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P3.1 */ + NOT_ON_ADC, /* 9 - P3.0 */ + NOT_ON_ADC, /* 10 - P2.0 */ + NOT_ON_ADC, /* 11 - P2.1 */ + NOT_ON_ADC, /* 12 - P2.2 */ + NOT_ON_ADC, /* 13 - P3.2 */ + NOT_ON_ADC, /* 14 - P3.3 */ + NOT_ON_ADC, /* 15 - P3.2 */ + NOT_ON_ADC, /* 16 - P2.3 */ + NOT_ON_ADC, /* 17 - P2.4 */ + NOT_ON_ADC, /* 18 - P2.5 */ + NOT_ON_ADC, /* 19 - P3.5 */ + NOT_ON_ADC, /* 20 - P3.6 */ + NOT_ON_ADC, /* 21 - P3.7 */ + 6, /* 22 - A6 */ + 7, /* 23 - A7 */ + NOT_ON_ADC, /* 24 - RST */ + NOT_ON_ADC, /* 25 - PF0 */ + NOT_ON_ADC, /* 26 - PE0 */ + NOT_ON_ADC, /* 27 - PB2 */ + NOT_ON_ADC /* 28 - GND */ +}; + +#endif +#endif From de1f771dec43e9888c3a2a81b67c8edf0673ea61 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:26:17 +0200 Subject: [PATCH 18/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_28pins_8/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_8/Board.mk diff --git a/hardware/msp430/variants/launchpad_28pins_8/Board.mk b/hardware/msp430/variants/launchpad_28pins_8/Board.mk new file mode 100644 index 00000000000..3f462e07b9b --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_8/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 8000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +###################################### From 303c4abc9adcee1da73d4423c10f10aae5b350a7 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:28:14 +0200 Subject: [PATCH 19/20] Changes to enable several MHz options and 28 pins variants --- .../launchpad_28pins_1/pins_energia.h | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_1/pins_energia.h diff --git a/hardware/msp430/variants/launchpad_28pins_1/pins_energia.h b/hardware/msp430/variants/launchpad_28pins_1/pins_energia.h new file mode 100644 index 00000000000..f8a41950f93 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_1/pins_energia.h @@ -0,0 +1,359 @@ +/* + ************************************************************************ + * pins_energia.h + * + * Energia core files for MSP430 + * Copyright (c) 2012 Robert Wessels. All right reserved. + * + * Contribution: Rei VILO + * + *********************************************************************** + Derived from: + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + + Apr 2016 - Edited by David Sanz Kirbis to match 28 pins chip version + +*/ + +#define __MSP430_HAS_PORT3_R__ +#ifndef Pins_Energia_h +#define Pins_Energia_h +#ifndef BV +#define BV(x) (1 << (x)) +#endif + +static const uint8_t SS = 10; /* P2.0 */ +static const uint8_t SCK = 7; /* P1.5 */ +static const uint8_t MOSI = 23; /* P1.7 */ +static const uint8_t MISO = 22; /* P1.6 */ +static const uint8_t TWISCL1 = 11; /* P2.1 SW I2C */ +static const uint8_t TWISDA1 = 12; /* P2.2 SW I2C */ +static const uint8_t TWISDA0 = 23; /* P1.7 */ +static const uint8_t TWISCL0 = 22; /* P1.6 */ +static const uint8_t DEBUG_UARTRXD = 3; /* Receive Data (RXD) at P1.1 */ +static const uint8_t DEBUG_UARTTXD = 4; /* Transmit Data (TXD) at P1.2 */ +#define TWISDA1_SET_MODE (INPUT) +#define TWISCL1_SET_MODE (INPUT) +#if defined(__MSP430_HAS_USCI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) /* do not enable the pull ups for this device */ +#define TWISCL0_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 /* | INPUT_PULLUP*/) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMOSI_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#define SPIMISO_SET_MODE (PORT_SELECTION0 | PORT_SELECTION1) +#endif +#if defined(__MSP430_HAS_USI__) +#define TWISDA0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define TWISCL0_SET_MODE (PORT_SELECTION0 | INPUT_PULLUP) +#define DEBUG_UARTRXD_SET_MODE (PORT_SELECTION0 | INPUT) +#define DEBUG_UARTTXD_SET_MODE (PORT_SELECTION0 | OUTPUT) +#define SPISCK_SET_MODE (PORT_SELECTION0) +#define SPIMOSI_SET_MODE (PORT_SELECTION0) +#define SPIMISO_SET_MODE (PORT_SELECTION0) +#endif + +/* Define the default I2C settings */ +#define DEFAULT_I2C -1 /* indicates SW I2C on pseudo module 1 */ +#define TWISDA TWISDA1 +#define TWISCL TWISCL1 +#define TWISDA_SET_MODE TWISDA1_SET_MODE +#define TWISCL_SET_MODE TWISCL1_SET_MODE + +#define DEBUG_UART_MODULE_OFFSET 0x0 + +#define DEBUG_UART_MODULE 0x0 + +static const uint8_t A0 = 2; +static const uint8_t A1 = 3; +static const uint8_t A2 = 4; +static const uint8_t A3 = 5; +static const uint8_t A4 = 6; +static const uint8_t A5 = 7; +static const uint8_t A6 = 22; +static const uint8_t A7 = 23; +static const uint8_t A10 = 128 + 10; // special. This is the internal temp sensor + +// +-\/-+ +// VCC 1| |20 GND +// (A0) P1.0 2| |19 XIN +// (A1) P1.1 3| |18 XOUT +// (A2) P1.2 4| |17 TEST +// (A3) P1.3 5| |16 RST# +// (A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO) depends on chip +// (A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI) +// P2.0 8| |13 P2.5 +// P2.1 9| |12 P2.4 +// P2.2 10| |11 P2.3 +// +----+ +// + +// Pin names based on the silkscreen +// +static const uint8_t P1_0 = 2; +static const uint8_t P1_1 = 3; +static const uint8_t P1_2 = 4; +static const uint8_t P1_3 = 5; +static const uint8_t P1_4 = 6; +static const uint8_t P1_5 = 7; +static const uint8_t P3_1 = 8; +static const uint8_t P3_0 = 9; +static const uint8_t P2_0 = 10; +static const uint8_t P2_1 = 11; +static const uint8_t P2_2 = 12; +static const uint8_t P3_2 = 13; +static const uint8_t P3_3 = 14; + +static const uint8_t P3_4 = 15; +static const uint8_t P2_3 = 16; +static const uint8_t P2_4 = 17; +static const uint8_t P2_5 = 18; +static const uint8_t P3_5 = 19; +static const uint8_t P3_6 = 20; +static const uint8_t P3_7 = 21; +static const uint8_t P1_6 = 22; +static const uint8_t P1_7 = 23; +static const uint8_t P2_7 = 26; +static const uint8_t P2_6 = 27; + +static const uint8_t RED_LED = 2; +static const uint8_t GREEN_LED = 14; +static const uint8_t PUSH2 = 5; +static const uint8_t TEMPSENSOR = 128 + 10; // depends on chip + + +#ifdef ARDUINO_MAIN + +const uint16_t port_to_input[] = { + NOT_A_PORT, + (uint16_t) &P1IN, + (uint16_t) &P2IN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3IN, +#endif +}; + +const uint16_t port_to_output[] = { + NOT_A_PORT, + (uint16_t) &P1OUT, + (uint16_t) &P2OUT, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3OUT, +#endif +}; + +const uint16_t port_to_dir[] = { + NOT_A_PORT, + (uint16_t) &P1DIR, + (uint16_t) &P2DIR, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3DIR, +#endif +}; + +const uint16_t port_to_ren[] = { + NOT_A_PORT, + (uint16_t) &P1REN, + (uint16_t) &P2REN, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3REN, +#endif +}; + +const uint16_t port_to_sel0[] = { /* put this PxSEL register under the group of PxSEL0 */ + NOT_A_PORT, + (uint16_t) &P1SEL, + (uint16_t) &P2SEL, +#ifdef __MSP430_HAS_PORT3_R__ + (uint16_t) &P3SEL, +#endif +}; + +const uint16_t port_to_sel2[] = { + NOT_A_PORT, +#ifdef P1SEL2_ + (uint16_t) &P1SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P2SEL2_ + (uint16_t) &P2SEL2, +#else + NOT_A_PORT, +#endif +#ifdef P3SEL2_ + (uint16_t) &P3SEL2, +#else + NOT_A_PORT, +#endif +}; + + +/* + * Defines for devices with 2x TA3 timers (e.g. MSP430g2553). On the 20pin devices, upto 3 analog outputs are available + * T0A1, T1A1 and T1A2 + */ +const uint8_t digital_pin_to_timer[] = { + NOT_ON_TIMER, /* dummy */ + NOT_ON_TIMER, /* 1 - VCC */ + NOT_ON_TIMER, /* 2 - P1.0 */ + T0A0, /* 3 - P1.1, note: A0 output cannot be used with analogWrite */ + T0A1, /* 4 - P1.2 */ + NOT_ON_TIMER, /* 5 - P1.3 */ + NOT_ON_TIMER, /* 6 - P1.4 note: special case. Leaving as no timer due to difficulty determining if available */ + T0A0, /* 7 - P1.5 note: A0 output cannot be used with analogWrite */ +#if defined(__MSP430_HAS_T1A3__) + T1A0, /* 8 - P3.1 */ + T0A2, /* 9 - P3.0 */ + T1A0, /* 10 - P2.0 note: A0 output cannot be used with analogWrite */ + T1A1, /* 11 - P2.1 */ + T1A1, /* 12 - P2.2 */ + T1A1, /* 13 - P3.2 */ + T1A2, /* 14 - P3.3 */ + T0A0, /* 15 - P3.4 note: A0 output cannot be used with analogWrite */ + T1A0, /* 16 - P2.3 note: A0 output cannot be used with analogWrite */ + T1A2, /* 17 - P2.4 */ + T1A2, /* 18 - P2.5 */ + T0A1, /* 19 - P3.5 */ + T0A2, /* 20 - P3.6 */ +#else + NOT_ON_TIMER, /* 8 - P3.1 */ + NOT_ON_TIMER, /* 9 - P3.0 */ + NOT_ON_TIMER, /* 10 - P2.0 */ + NOT_ON_TIMER, /* 11 - P2.1 */ + NOT_ON_TIMER, /* 12 - P2.2 */ + NOT_ON_TIMER, /* 13 - P3.2 */ + NOT_ON_TIMER, /* 14 - P3.3 */ + NOT_ON_TIMER, /* 15 - P3.4 */ + NOT_ON_TIMER, /* 16 - P2.3 */ + NOT_ON_TIMER, /* 17 - P2.4 */ + NOT_ON_TIMER, /* 18 - P2.5 */ + NOT_ON_TIMER, /* 19 - P3.5 */ + NOT_ON_TIMER, /* 20 - P3.6 */ +#endif + NOT_ON_TIMER, /* 21 - P3.7 */ + T0A1, /* 22 - P1.6 */ + NOT_ON_TIMER, /* 23 - P1.7 */ + NOT_ON_TIMER, /* 24 - /RESET */ + NOT_ON_TIMER, /* 25 - TEST */ + NOT_ON_TIMER, /* 26 - XOUT - P2.7 */ + T0A1, /* 27 - XIN - P2.6: */ + NOT_ON_TIMER, /* 28 - GND */ +}; + +const uint8_t digital_pin_to_port[] = { + NOT_A_PIN, /* dummy */ + NOT_A_PIN, /* 1 */ + P1, /* 2 */ + P1, /* 3 */ + P1, /* 4 */ + P1, /* 5 */ + P1, /* 6 */ + P1, /* 7 */ + P3, /* 8 */ + P3, /* 9 */ + P2, /* 10 */ + P2, /* 11 */ + P2, /* 12 */ + P3, /* 13 */ + P3, /* 14 */ + P3, /* 15 */ + P2, /* 16 */ + P2, /* 17 */ + P2, /* 18 */ + P3, /* 19 */ + P3, /* 20 */ + P3, /* 21 */ + P1, /* 22 */ + P1, /* 23 */ + NOT_A_PIN, /* 24 */ + NOT_A_PIN, /* 25 */ + P2, /* 26 */ + P2, /* 27 */ + NOT_A_PIN, /* 28 */ +}; + +const uint8_t digital_pin_to_bit_mask[] = { + NOT_A_PIN, /* 0, pin count starts at 1 */ + NOT_A_PIN, /* 1, VCC */ + BV(0), /* 2, port P1.0 */ + BV(1), /* 3, port P1.1 */ + BV(2), /* 4, port P1.2 */ + BV(3), /* 5, port P1.3*/ + BV(4), /* 6, port P1.4 */ + BV(5), /* 7, port P1.5 */ + BV(1), /* 8, port P3.1 */ + BV(0), /* 9, port P3.0 */ + BV(0), /* 10, port P2.0 */ + BV(1), /* 11, port P2.1 */ + BV(2), /* 12, port P2.2 */ + BV(2), /* 13, port P3.2 */ + BV(3), /* 14, port P3.3 */ + BV(4), /* 15, port P3.4 */ + BV(3), /* 16, port P2.3 */ + BV(4), /* 17, port P2.4 */ + BV(5), /* 18, port P2.5 */ + BV(5), /* 19, port P3.5 */ + BV(6), /* 20, port P3.6 */ + BV(7), /* 21, port P3.7 */ + BV(6), /* 22, port P1.6 */ + BV(7), /* 23, port P1.7 */ + NOT_A_PIN, /* 24, RST */ + NOT_A_PIN, /* 25, TEST */ + BV(7), /* 26, XOUT */ + BV(6), /* 27, XIN */ + NOT_A_PIN, /* 28, GND */ +}; +const uint32_t digital_pin_to_analog_in[] = { + NOT_ON_ADC, /* dummy */ + NOT_ON_ADC, /* 1 - 3.3V*/ + 0, /* 2 - A0 */ + 1, /* 3 - A1 */ + 2, /* 4 - A2 */ + 3, /* 5 - A3 */ + 4, /* 6 - A4 */ + 5, /* 7 - A5 */ + NOT_ON_ADC, /* 8 - P3.1 */ + NOT_ON_ADC, /* 9 - P3.0 */ + NOT_ON_ADC, /* 10 - P2.0 */ + NOT_ON_ADC, /* 11 - P2.1 */ + NOT_ON_ADC, /* 12 - P2.2 */ + NOT_ON_ADC, /* 13 - P3.2 */ + NOT_ON_ADC, /* 14 - P3.3 */ + NOT_ON_ADC, /* 15 - P3.2 */ + NOT_ON_ADC, /* 16 - P2.3 */ + NOT_ON_ADC, /* 17 - P2.4 */ + NOT_ON_ADC, /* 18 - P2.5 */ + NOT_ON_ADC, /* 19 - P3.5 */ + NOT_ON_ADC, /* 20 - P3.6 */ + NOT_ON_ADC, /* 21 - P3.7 */ + 6, /* 22 - A6 */ + 7, /* 23 - A7 */ + NOT_ON_ADC, /* 24 - RST */ + NOT_ON_ADC, /* 25 - PF0 */ + NOT_ON_ADC, /* 26 - PE0 */ + NOT_ON_ADC, /* 27 - PB2 */ + NOT_ON_ADC /* 28 - GND */ +}; + +#endif +#endif From 739d6f949e38aa647decdfca4ec1968216da29a3 Mon Sep 17 00:00:00 2001 From: David Sanz Kirbis Date: Mon, 18 Apr 2016 10:28:34 +0200 Subject: [PATCH 20/20] Changes to enable several MHz options and 28 pins variants --- hardware/msp430/variants/launchpad_28pins_1/Board.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hardware/msp430/variants/launchpad_28pins_1/Board.mk diff --git a/hardware/msp430/variants/launchpad_28pins_1/Board.mk b/hardware/msp430/variants/launchpad_28pins_1/Board.mk new file mode 100644 index 00000000000..69431adef84 --- /dev/null +++ b/hardware/msp430/variants/launchpad_28pins_1/Board.mk @@ -0,0 +1,9 @@ +###################################### +# Board specific +ARCH = msp430 +MCU = msp430g2553 +MCU_FLAG = -mmcu=$(MCU) +F_CPU = 1000000L +FLASH_SIZE = 16384 +UPLOAD_COMMAND = $(MSPDEBUG) $(VERBOSE_UPLOAD) tilib --force-reset "prog build/$(SKETCH_NAME).bin" +######################################