diff --git a/hardware/sam/variants/sam3s-ek/pins_arduino.h b/hardware/sam/variants/sam3s-ek/pins_arduino.h index 29a1379ef..8e49617b1 100644 --- a/hardware/sam/variants/sam3s-ek/pins_arduino.h +++ b/hardware/sam/variants/sam3s-ek/pins_arduino.h @@ -8,6 +8,8 @@ #define PIN_LED_RED (2u) #define PIN_LED PIN_LED_BLUE +#define PIN_DAC0 (u) + const static uint8_t SS = 34 ; const static uint8_t MOSI = 32 ; const static uint8_t MISO = 31 ; @@ -15,14 +17,37 @@ const static uint8_t SCK = 33 ; #define PINS_UART (16u) +typedef enum _EAnalogChannel +{ + ADC0, + ADC1, + ADC2, + ADC3, + ADC4, + ADC5, + ADC6, + ADC7, + ADC8, + ADC9, + ADC10, + ADC11, + ADC12, + ADC13, + ADC14, + ADC15, + DAC0, + DAC1 +} EAnalogChannel ; + /* Types used for the tables below */ typedef struct _PinDescription { - Pio* pPort ; - uint32_t dwPin ; - uint32_t dwPeripheralId ; - EPioType dwPinType ; - uint32_t dwPinAttribute ; + Pio* pPort ; + uint32_t dwPin ; + uint32_t dwPeripheralId ; + EPioType dwPinType ; + uint32_t dwPinAttribute ; + EAnalogChannel dwAnalogChannel ; } PinDescription ; static const PinDescription APinDescription[]= diff --git a/hardware/sam/variants/sam3s-ek/variant.cpp b/hardware/sam/variants/sam3s-ek/variant.cpp index 5107af281..a819744ac 100644 --- a/hardware/sam/variants/sam3s-ek/variant.cpp +++ b/hardware/sam/variants/sam3s-ek/variant.cpp @@ -2,23 +2,23 @@ /* * UART objects */ -ring_buffer rx_buffer0 = { { 0 }, 0, 0 } ; -ring_buffer tx_buffer0 = { { 0 }, 0, 0 } ; ring_buffer rx_buffer1 = { { 0 }, 0, 0 } ; ring_buffer tx_buffer1 = { { 0 }, 0, 0 } ; +ring_buffer rx_buffer2 = { { 0 }, 0, 0 } ; +ring_buffer tx_buffer2 = { { 0 }, 0, 0 } ; -UARTClass Serial( &rx_buffer0, &tx_buffer0, UART0, UART0_IRQn, ID_UART0 ) ; -UARTClass UART1( &rx_buffer1, &tx_buffer1, UART1, UART1_IRQn, ID_UART1 ) ; +UARTClass Serial1( &rx_buffer1, &tx_buffer1, UART0, UART0_IRQn, ID_UART0 ) ; +UARTClass Serial2( &rx_buffer2, &tx_buffer2, UART1, UART1_IRQn, ID_UART1 ) ; // IT handlers extern void UART0_IrqHandler( void ) { - Serial.IrqHandler() ; + Serial1.IrqHandler() ; } extern void UART1_IrqHandler( void ) { - UART1.IrqHandler() ; + Serial2.IrqHandler() ; } @@ -28,23 +28,23 @@ extern void UART1_IrqHandler( void ) /* * USART objects */ -ring_buffer rx_buffer2 = { { 0 }, 0, 0 } ; -ring_buffer tx_buffer2 = { { 0 }, 0, 0 } ; ring_buffer rx_buffer3 = { { 0 }, 0, 0 } ; ring_buffer tx_buffer3 = { { 0 }, 0, 0 } ; +ring_buffer rx_buffer4 = { { 0 }, 0, 0 } ; +ring_buffer tx_buffer4 = { { 0 }, 0, 0 } ; -USARTClass USART1( &rx_buffer2, &tx_buffer2, USART0, USART0_IRQn, ID_USART0 ) ; -USARTClass USART2( &rx_buffer3, &tx_buffer3, USART1, USART1_IRQn, ID_USART1 ) ; +USARTClass Serial3( &rx_buffer3, &tx_buffer3, USART0, USART0_IRQn, ID_USART0 ) ; +USARTClass Serial4( &rx_buffer4, &tx_buffer4, USART1, USART1_IRQn, ID_USART1 ) ; // IT handlers extern void USART0_IrqHandler( void ) { - USART0.IrqHandler() ; + Serial3.IrqHandler() ; } extern void USART1_IrqHandler( void ) { - USART1.IrqHandler() ; + Serial4.IrqHandler() ; } // ---------------------------------------------------------------------------- diff --git a/hardware/sam/variants/sam3s-ek/variant.h b/hardware/sam/variants/sam3s-ek/variant.h index f879a32b2..b9413dcc6 100644 --- a/hardware/sam/variants/sam3s-ek/variant.h +++ b/hardware/sam/variants/sam3s-ek/variant.h @@ -1,13 +1,53 @@ +#ifndef _BOARD_ +#define _BOARD_ -#include "Arduino.h" +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ -extern UARTClass Serial ; -extern UARTClass UART2 ; +#include "libsam/chip.h" -extern USARTClass USART1 ; -extern USARTClass USART2 ; +#include "include/bitbanding.h" +#include "include/board_lowlevel.h" +#include "include/timetick.h" -#if defined(USBCON) - #include "usb_api.h" +/** + * Libc porting layers + */ +#if defined ( __GNUC__ ) /* GCC CS3 */ +# include "include/syscalls.h" /** RedHat Newlib minimal stub */ #endif +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ + +/** Name of the board */ +#define BOARD_NAME "SAM3S-EK" + +/* +#define BOARD_REV_A +*/ +#define BOARD_REV_B + +/** Frequency of the board main oscillator */ +#define BOARD_MAINOSC 12000000 + +/** Master clock frequency (when using board_lowlevel.c) */ +#define BOARD_MCK 64000000 + +/*---------------------------------------------------------------------------- + * Arduino objects + *----------------------------------------------------------------------------*/ + +extern UARTClass Serial1 ; +extern UARTClass Serial2 ; + +extern USARTClass Serial3 ; +extern USARTClass Serial4 ; + + +#endif /* #ifndef _BOARD_ */ +