1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

[sam] LED Blink test app working on Arduino Due

This commit is contained in:
Thibaut VIARD
2011-09-13 18:12:51 +02:00
parent 6f2d59ed2f
commit 80d5368b52
9 changed files with 61 additions and 34 deletions

View File

@ -152,9 +152,12 @@ RingBuffer rx_buffer2 ;
RingBuffer tx_buffer2 ;
RingBuffer rx_buffer3 ;
RingBuffer tx_buffer3 ;
RingBuffer rx_buffer4 ;
RingBuffer tx_buffer4 ;
USARTClass Serial2( USART0, USART0_IRQn, ID_USART0, &rx_buffer2, &tx_buffer2 ) ;
USARTClass Serial3( USART1, USART1_IRQn, ID_USART1, &rx_buffer3, &tx_buffer3 ) ;
USARTClass Serial4( USART2, USART2_IRQn, ID_USART2, &rx_buffer4, &tx_buffer4 ) ;
#ifdef __cplusplus
extern "C" {
@ -171,6 +174,11 @@ extern void USART1_IrqHandler( void )
Serial3.IrqHandler() ;
}
extern void USART2_IrqHandler( void )
{
Serial4.IrqHandler() ;
}
#ifdef __cplusplus
}
#endif
@ -198,14 +206,9 @@ extern void init( void )
/* Disable watchdog, common to all SAM variants */
WDT_Disable( WDT ) ;
// Initialize Serial port UART0, common to all SAM3 variants
// Initialize Serial port UART, common to all SAM3 variants
PIO_Configure( g_APinDescription[PINS_UART].pPort, g_APinDescription[PINS_UART].ulPinType,
g_APinDescription[PINS_UART].ulPin, g_APinDescription[PINS_UART].ulPinAttribute ) ;
// Switch off Power LED
PIO_Configure( g_APinDescription[PIN_LED_RED].pPort, g_APinDescription[PIN_LED_RED].ulPinType,
g_APinDescription[PIN_LED_RED].ulPin, g_APinDescription[PIN_LED_RED].ulPinAttribute ) ;
PIO_Clear( g_APinDescription[PIN_LED_RED].pPort, g_APinDescription[PIN_LED_RED].ulPin ) ;
}
#ifdef __cplusplus
}

View File

@ -48,17 +48,23 @@
* Pins
*----------------------------------------------------------------------------*/
#define PIN_LED_BLUE (0u)
#define PIN_LED_GREEN (1u)
#define PIN_LED_RED (2u)
#define PIN_LED PIN_LED_BLUE
#define PIN_LED_13 (0u)
#define PIN_LED_RXL (1u)
#define PIN_LED_TXL (2u)
#define PIN_LED PIN_LED_13
#define PIN_LED2 PIN_LED_RXL
#define PIN_LED3 PIN_LED_TXL
static const uint8_t SS = 23 ;
static const uint8_t MOSI = 21 ;
static const uint8_t MISO = 20 ;
static const uint8_t SCK = 22 ;
static const uint8_t SS = 15 ;
static const uint8_t MOSI = 13 ;
static const uint8_t MISO = 12 ;
static const uint8_t SCK = 14 ;
#define PINS_UART (6u)
#define PINS_UART (5u)
#define PINS_USART0 (5u)
#define PINS_USART1 (5u)
#define PINS_USART2 (5u)
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
@ -70,6 +76,7 @@ extern UARTClass Serial ;
extern USARTClass Serial2 ;
extern USARTClass Serial3 ;
extern USARTClass Serial4 ;
#endif