mirror of https://github.com/ARMmbed/mbed-os.git
* updated port apis.
* added supprot for SAMD21J18A for mbed SDK tests.pull/1316/head
parent
9a503026cf
commit
4d5f7a3fa7
|
@ -22,10 +22,11 @@ extern "C" {
|
|||
|
||||
typedef enum {
|
||||
PortA = 0,
|
||||
PortB = 1,
|
||||
PortB,
|
||||
#if defined(TARGET_SAMR21G18A)
|
||||
PortC = 2
|
||||
PortC,
|
||||
#endif
|
||||
PortMax
|
||||
} PortName;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
uint32_t start_pin(PortName port)
|
||||
{
|
||||
if(port <= 2) { /* PortC value is 2*/
|
||||
if(port < PortMax) { /* PortC value is 2*/
|
||||
return port * 32;
|
||||
} else {
|
||||
return NC;
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
BusOut bus1(PA06, PA07, PA13, PA28, PA18, PA19, PA22, PA23, PA16, PA17, PA05, PA04);
|
||||
BusOut bus2(PB03, PB22, PB02, PB23);
|
||||
|
||||
#elif defined(TARGET_SAMD21J18A)
|
||||
BusOut bus1(PA06, PA07, PA13, PA28, PA18, PA19, PA22, PA23, PA16, PA17, PA05, PA04);
|
||||
BusOut bus2(PB03, PB22, PB02, PB23);
|
||||
|
||||
#else
|
||||
BusOut bus1(D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15);
|
||||
BusOut bus2(A5, A4, A3, A2, A1, A0);
|
||||
|
|
|
@ -58,7 +58,7 @@ DigitalIn in(PC1);
|
|||
DigitalOut out(PE10);
|
||||
DigitalIn in(PC1);
|
||||
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
DigitalOut out(PA06);
|
||||
DigitalIn in(PA07);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ DigitalInOut d2(PC1);
|
|||
DigitalInOut d1(PE10);
|
||||
DigitalInOut d2(PC1);
|
||||
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
DigitalInOut d1(PA06);
|
||||
DigitalInOut d2(PA07);
|
||||
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
#define FLOW_CONTROL_CTS PA07
|
||||
#define RTS_CHECK_PIN PB03
|
||||
|
||||
#elif defined(TARGET_SAMD21J18A)
|
||||
#define UART_TX PA22
|
||||
#define UART_RX PA23
|
||||
#define FLOW_CONTROL_RTS PA24
|
||||
#define FLOW_CONTROL_CTS PA25
|
||||
#define RTS_CHECK_PIN PB03
|
||||
|
||||
#else
|
||||
#error This test is not supported on this target
|
||||
#endif
|
||||
|
|
|
@ -87,7 +87,7 @@ void in_handler() {
|
|||
#define PIN_OUT PE10
|
||||
#define PIN_IN PC1
|
||||
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
#define PIN_OUT PA06
|
||||
#define PIN_IN PA07
|
||||
|
||||
|
|
|
@ -42,6 +42,20 @@ InterruptIn button9(PA15);
|
|||
DigitalOut led(LED1);
|
||||
DigitalOut flash(PA22); /*1 LED Available*/
|
||||
|
||||
#elif defined(TARGET_SAMD21J18A)
|
||||
InterruptIn button (PA15); /*SW0*/
|
||||
InterruptIn button1(PA16);
|
||||
InterruptIn button2(PB01);
|
||||
InterruptIn button3(PA18);
|
||||
InterruptIn button4(PA03);
|
||||
InterruptIn button5(PA04);
|
||||
InterruptIn button6(PA05);
|
||||
InterruptIn button7(PA06);
|
||||
InterruptIn button8(PA07);
|
||||
InterruptIn button9(PA28);
|
||||
DigitalOut led(LED1);
|
||||
DigitalOut flash(PA27); /*1 LED Available*/
|
||||
|
||||
#else
|
||||
InterruptIn button(p30);
|
||||
InterruptIn button1(p29);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "mbed.h"
|
||||
|
||||
#if defined(TARGET_SAMR21G18A)
|
||||
#if defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
DigitalOut out(PA06);
|
||||
#else
|
||||
DigitalOut out(p5);
|
||||
|
|
|
@ -129,13 +129,13 @@
|
|||
#define P2_2 (1 << 2) // PC2
|
||||
#define PORT_2 PortC
|
||||
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
#define P1_1 (1 << 6) /*PA06*/
|
||||
#define P1_2 (1 << 7) /*PA07*/
|
||||
#define PORT_1 PortA
|
||||
|
||||
#define P2_1 (1 << 2) /*PA02*/
|
||||
#define P2_2 (1 << 3) /*PA03*/
|
||||
#define P2_1 (1 << 2) /*PB02*/
|
||||
#define P2_2 (1 << 3) /*PB03*/
|
||||
#define PORT_2 PortB
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
# define LED2 0
|
||||
# define LED3 0
|
||||
# define LED4 0
|
||||
# elif defined(TARGET_SAMD21J18A)
|
||||
# define LED_PORT PortB
|
||||
# define LED1 (1 << 30) /*PB30*/
|
||||
# define LED2 0
|
||||
# define LED3 0
|
||||
# define LED4 0
|
||||
# endif
|
||||
|
||||
#define LED_MASK (LED1|LED2|LED3|LED4)
|
||||
|
|
|
@ -129,13 +129,13 @@
|
|||
#define P2_2 (1 << 2) // PC2
|
||||
#define PORT_2 PortC
|
||||
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
#define P1_1 (1 << 6) /*PA06*/
|
||||
#define P1_2 (1 << 7) /*PA07*/
|
||||
#define PORT_1 PortA
|
||||
|
||||
#define P2_1 (1 << 2) /*PA02*/
|
||||
#define P2_2 (1 << 3) /*PA03*/
|
||||
#define P2_1 (1 << 2) /*PB02*/
|
||||
#define P2_2 (1 << 3) /*PB03*/
|
||||
#define PORT_2 PortB
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@ Serial pc(USBTX, USBRX);
|
|||
Serial uart(P4_22, P4_23);
|
||||
#elif defined(TARGET_MAXWSNENV)
|
||||
Serial uart(P0_1, P0_0);
|
||||
#elif defined(TARGET_SAMR21G18A)
|
||||
#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
Serial uart(PA16, PA17);
|
||||
#else
|
||||
Serial uart(p9, p10);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "cmsis_nvic.h"
|
||||
#include <string.h>
|
||||
|
||||
#if defined(TARGET_SAMR21G18A)
|
||||
#if defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A)
|
||||
#define PIN_IN (PA06)
|
||||
#define PIN_OUT (PA07)
|
||||
#define NUM_VECTORS (16+28)
|
||||
|
|
Loading…
Reference in New Issue