diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 5f580b45ec816eb09bf917ad595d22b36a5d1b78..e1c15e1a69e9c0d6fa6313c9d0bd5bada28750ce 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -156,9 +156,10 @@ SercomParityMode Uart::extractParity(uint8_t config) void SERCOM0_Handler() { - Serial.IrqHandler(); + Serial1.IrqHandler(); } + void SERCOM5_Handler() { - Serial5.IrqHandler(); + Serial.IrqHandler(); } diff --git a/cores/arduino/Uart.h b/cores/arduino/Uart.h index 2d379faa0f304211823206542cb359dd6a521748..93e878035530daa1dae071878cc82df64d04a844 100644 --- a/cores/arduino/Uart.h +++ b/cores/arduino/Uart.h @@ -57,7 +57,7 @@ class Uart : public HardwareSerial }; extern Uart Serial; -extern Uart Serial5; +extern Uart Serial1; #endif diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index 612bb135d037f2d9ba7d6d73bbeef05e57727028..a1156fc3b84be66cf1eaeaacc847416a519a74d7 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -23,7 +23,7 @@ #include "sam.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus /* Definitions and types for pins */ @@ -62,10 +62,8 @@ typedef enum _ETCChannel TCC1_CH1 = (1<<8)|(1), TCC2_CH0 = (2<<8)|(0), TCC2_CH1 = (2<<8)|(1), - TC3_CH0 = (3<<8)|(0), - TC3_CH1 = (3<<8)|(1), - TC7_CH0 = (7<<8)|(0), - TC7_CH1 = (7<<8)|(1) + TC3_CH0 = (3<<8)|(0), + TC3_CH1 = (3<<8)|(1), } ETCChannel ; extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; @@ -92,8 +90,6 @@ typedef enum _EPWMChannel PWM2_CH1=TCC2_CH1, PWM3_CH0=TC3_CH0, PWM3_CH1=TC3_CH1, - PWM7_CH0=TC7_CH0, - PWM7_CH1=TC7_CH1 } EPWMChannel ; typedef enum _EPortType @@ -133,19 +129,19 @@ typedef enum _EExt_Interrupts typedef enum _EPioType { - PIO_NOT_A_PIN=-1, /* Not under control of a peripheral. */ - PIO_EXTINT, /* The pin is controlled by the associated signal of peripheral A. */ - PIO_ANALOG, /* The pin is controlled by the associated signal of peripheral B. */ - PIO_SERCOM, /* The pin is controlled by the associated signal of peripheral C. */ - PIO_SERCOM_ALT, /* The pin is controlled by the associated signal of peripheral D. */ - PIO_TIMER, /* The pin is controlled by the associated signal of peripheral E. */ - PIO_TIMER_ALT, /* The pin is controlled by the associated signal of peripheral F. */ - PIO_COM, /* The pin is controlled by the associated signal of peripheral G. */ - PIO_AC_CLK, /* The pin is controlled by the associated signal of peripheral H. */ - PIO_DIGITAL, /* The pin is controlled by PORT. */ - PIO_INPUT, /* The pin is controlled by PORT and is an input. */ - PIO_INPUT_PULLUP, /* The pin is controlled by PORT and is an input with internal pull-up resistor enabled. */ - PIO_OUTPUT, /* The pin is controlled by PORT and is an output. */ + PIO_NOT_A_PIN=-1, /* Not under control of a peripheral. */ + PIO_EXTINT=0, /* The pin is controlled by the associated signal of peripheral A. */ + PIO_ANALOG, /* The pin is controlled by the associated signal of peripheral B. */ + PIO_SERCOM, /* The pin is controlled by the associated signal of peripheral C. */ + PIO_SERCOM_ALT, /* The pin is controlled by the associated signal of peripheral D. */ + PIO_TIMER, /* The pin is controlled by the associated signal of peripheral E. */ + PIO_TIMER_ALT, /* The pin is controlled by the associated signal of peripheral F. */ + PIO_COM, /* The pin is controlled by the associated signal of peripheral G. */ + PIO_AC_CLK, /* The pin is controlled by the associated signal of peripheral H. */ + PIO_DIGITAL, /* The pin is controlled by PORT. */ + PIO_INPUT, /* The pin is controlled by PORT and is an input. */ + PIO_INPUT_PULLUP, /* The pin is controlled by PORT and is an input with internal pull-up resistor enabled. */ + PIO_OUTPUT, /* The pin is controlled by PORT and is an output. */ PIO_PWM=PIO_TIMER, PIO_PWM_ALT=PIO_TIMER_ALT, @@ -165,13 +161,13 @@ typedef enum _EPioType /* Types used for the table below */ typedef struct _PinDescription { - EPortType ulPort ; - uint32_t ulPin ; - EPioType ulPinType ; - uint32_t ulPinAttribute ; - EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */ - EPWMChannel ulPWMChannel ; - ETCChannel ulTCChannel ; + EPortType ulPort ; + uint32_t ulPin ; + EPioType ulPinType ; + uint32_t ulPinAttribute ; + EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */ + EPWMChannel ulPWMChannel ; + ETCChannel ulTCChannel ; EExt_Interrupts ulExtInt ; } PinDescription ; diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index c54a2cd2c39c0dccb7451ddd4e8d38546402f2f2..82e687fd4b795a0d3fc00b404e4f250633df7dc5 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -315,7 +315,7 @@ void SystemInit( void ) /* ---------------------------------------------------------------------------------------------- * 6) Modify PRESCaler value of OSC8M to have 8MHz */ - SYSCTRL->OSC8M.bit.PRESC = SYSCTRL_OSC8M_PRESC_0_Val ; + SYSCTRL->OSC8M.bit.PRESC = SYSCTRL_OSC8M_PRESC_1_Val ; SYSCTRL->OSC8M.bit.ONDEMAND = 0 ; /* ---------------------------------------------------------------------------------------------- diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index fb8ed238b2644a2f9b93cd6024165e65fb3ce4b7..2ef6630ed2d8e3b06d10d2e419bd47b780e7ff14 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -23,12 +23,41 @@ extern "C" { #endif -void analogReference( eAnalogReference ulMode ) +static int _readResolution = 10; +static int _writeResolution = 8; + +void analogReadResolution( int res ) { + _readResolution = res ; +} + +void analogWriteResolution( int res ) +{ + _writeResolution = res ; +} + +static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to ) +{ + if ( from == to ) + { + return value ; + } + + if ( from > to ) + { + return value >> (from-to) ; + } + else + { + return value << (to-from) ; + } +} - // ATTENTION : On this board the default is note 5volts or 3.3volts BUT 1volt +void analogReference( eAnalogReference ulMode ) +{ + // ATTENTION : On this board the default is not 5volts or 3.3volts BUT 1volt - switch(ulMode) + switch ( ulMode ) { case AR_DEFAULT: case AR_INTERNAL: @@ -41,6 +70,7 @@ void analogReference( eAnalogReference ulMode ) break; } } + uint32_t analogRead( uint32_t ulPin ) { uint32_t valueRead = 0; @@ -95,51 +125,6 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) } DAC->DATA.reg = ulValue & 0x3FF; // Dac on 10 bits. - - // EAnalogChannel channel = g_APinDescription[ulPin].ulADCChannelNumber; - // if (channel == DA0 || channel == DA1) { - // uint32_t chDACC = ((channel == DA0) ? 0 : 1); - // if (dacc_get_channel_status(DACC_INTERFACE) == 0) { - // /* Enable clock for DACC_INTERFACE */ - // pmc_enable_periph_clk(DACC_INTERFACE_ID); - - // /* Reset DACC registers */ - // dacc_reset(DACC_INTERFACE); - - // /* Half word transfer mode */ - // dacc_set_transfer_mode(DACC_INTERFACE, 0); - - // /* Power save: - // * sleep mode - 0 (disabled) - // * fast wakeup - 0 (disabled) - // */ - // dacc_set_power_save(DACC_INTERFACE, 0, 0); - // /* Timing: - // * refresh - 0x08 (1024*8 dacc clocks) - // * max speed mode - 0 (disabled) - // * startup time - 0x10 (1024 dacc clocks) - // */ - // dacc_set_timing(DACC_INTERFACE, 0x08, 0, 0x10); - - // /* Set up analog current */ - // dacc_set_analog_control(DACC_INTERFACE, DACC_ACR_IBCTLCH0(0x02) | - // DACC_ACR_IBCTLCH1(0x02) | - // DACC_ACR_IBCTLDACCORE(0x01)); - // } - - // /* Disable TAG and select output channel chDACC */ - // dacc_set_channel_selection(DACC_INTERFACE, chDACC); - - // if ((dacc_get_channel_status(DACC_INTERFACE) & (1 << chDACC)) == 0) { - // dacc_enable_channel(DACC_INTERFACE, chDACC); - // } - - // // Write user value - // ulValue = mapResolution(ulValue, _writeResolution, DACC_RESOLUTION); - // dacc_write_conversion_data(DACC_INTERFACE, ulValue); - // while ((dacc_get_interrupt_status(DACC_INTERFACE) & DACC_ISR_EOC) == 0); - // return; - // } } if ( (attr & PIN_ATTR_PWM) == PIN_ATTR_PWM ) @@ -150,7 +135,7 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) } Channelx = GetTCChannelNumber( g_APinDescription[ulPin].ulPWMChannel ) ; - if ( GetTCChannelNumber( g_APinDescription[ulPin].ulPWMChannel ) >= TCC_INST_NUM ) + if ( GetTCNumber( g_APinDescription[ulPin].ulPWMChannel ) >= TCC_INST_NUM ) { isTC = 1 ; TCx = (Tc*) GetTC( g_APinDescription[ulPin].ulPWMChannel ) ; @@ -161,77 +146,6 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) TCCx = (Tcc*) GetTC( g_APinDescription[ulPin].ulPWMChannel ) ; } -/* - switch ( g_APinDescription[ulPin].ulPWMChannel ) - { - case PWM3_CH0 : - TCx = TC3 ; - Channelx = 0 ; - isTC = 1 ; - break; - - case PWM3_CH1: - TCx = TC3 ; - Channelx = 1; - isTC = 1; - break; - - case PWM0_CH0 : - TCCx = TCC0; - Channelx = 0; - break; - - case PWM0_CH1 : - TCCx = TCC0; - Channelx = 1; - break; - - case PWM0_CH4 : - TCCx = TCC0; - //Channelx = 4; - Channelx = 0; - break; - - case PWM0_CH5 : - TCCx = TCC0; - //Channelx = 5; - Channelx = 1; - break; - - case PWM0_CH6 : - TCCx = TCC0; - //Channelx = 6; - Channelx = 2; - break; - - case PWM0_CH7 : - TCCx = TCC0; - //Channelx = 7; - Channelx = 3; - break; - - case PWM1_CH0 : - TCCx = TCC1; - Channelx = 0; - break; - - case PWM1_CH1 : - TCCx = TCC1; - Channelx = 1; - break; - - case PWM2_CH0 : - TCCx = TCC2; - Channelx = 0; - break; - - case PWM2_CH1 : - TCCx = TCC2; - Channelx = 1; - break; - } -*/ - // Enable clocks according to TCCx instance to use switch ( GetTCNumber( g_APinDescription[ulPin].ulPWMChannel ) ) { @@ -264,6 +178,16 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) //Enable GCLK for TC5 (timer counter input clock) GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC4_TC5 )) ; break ; + + case 6: // TC6 + //Enable GCLK for TC6 (timer counter input clock) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC6_TC7 )); + break ; + + case 7: // TC7 + //Enable GCLK for TC7 (timer counter input clock) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC6_TC7 )) ; + break ; } // Set PORT @@ -305,7 +229,7 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) // -- Defaults to digital write pinMode( ulPin, OUTPUT ) ; - //ulValue = mapResolution(ulValue, _writeResolution, 8); + ulValue = mapResolution(ulValue, _writeResolution, 8); if ( ulValue < 128 ) { diff --git a/cores/validation/validation_I2C_I01/test.cpp b/cores/validation/validation_I2C_I01/test.cpp index cbaab331ee595061fe1d2c5c5c06aa42c6e1c624..46b60848fe16605f85ebcfac62a5d96595e49f3f 100644 --- a/cores/validation/validation_I2C_I01/test.cpp +++ b/cores/validation/validation_I2C_I01/test.cpp @@ -25,8 +25,8 @@ uint8_t a, b; void setup() { - Serial5.begin( 115200 ); - Serial5.println("Wire init"); + SERIAL_PORT_MONITOR.begin( 115200 ); + SERIAL_PORT_MONITOR.println("Wire init"); Wire.begin(); } @@ -39,8 +39,8 @@ void loop() delay(100); Wire.requestFrom(addressTemp, 2); - Serial5.print((char)13); - Serial5.print("Temperature : "); + SERIAL_PORT_MONITOR.print((char)13); + SERIAL_PORT_MONITOR.print("Temperature : "); a = Wire.read(); b = Wire.read(); @@ -49,5 +49,5 @@ void loop() temp |= a; temp >>= 7; - Serial5.print(temp); + SERIAL_PORT_MONITOR.print(temp); } diff --git a/cores/validation/validation_I2C_LCD/test.cpp b/cores/validation/validation_I2C_LCD/test.cpp index 15462959d233686a75e5a0a365ef9b4f6505cd8c..46cc499f96b1690eeb9eaa2f5a0b29b94ad642f0 100644 --- a/cores/validation/validation_I2C_LCD/test.cpp +++ b/cores/validation/validation_I2C_LCD/test.cpp @@ -23,7 +23,7 @@ LiquidCrystal_I2C lcd(0x27, 16, 2); void setup() { - Serial5.begin( 9600 ) ; + SERIAL_PORT_MONITOR.begin( 9600 ) ; lcd.init(); diff --git a/cores/validation/validation_I2C_RTC/test.cpp b/cores/validation/validation_I2C_RTC/test.cpp index 26cb1892f5a5c305199adbbb7bc4c645658fd8c4..b04b9f656b7cfaa125a693b45f7ce15a1ed7cffa 100644 --- a/cores/validation/validation_I2C_RTC/test.cpp +++ b/cores/validation/validation_I2C_RTC/test.cpp @@ -34,8 +34,8 @@ uint8_t bcdToDec(byte val) void setup() { - Serial5.begin(9600); - Serial5.println("Wire init"); + SERIAL_PORT_MONITOR.begin(9600); + SERIAL_PORT_MONITOR.println("Wire init"); Wire.begin(); // Setting the date @@ -68,10 +68,10 @@ void loop() Wire.requestFrom(address, 7); /* while(Wire.available()) { - Serial5.print(bcdToDec(Wire.read())); - Serial5.print(" "); + SERIAL_PORT_MONITOR.print(bcdToDec(Wire.read())); + SERIAL_PORT_MONITOR.print(" "); } - Serial5.println();*/ + SERIAL_PORT_MONITOR.println();*/ int second = bcdToDec(Wire.read() & 0x7f); @@ -82,19 +82,19 @@ void loop() int month = bcdToDec(Wire.read()); int year = bcdToDec(Wire.read()); - Serial5.print(hour, DEC); - Serial5.print(":"); - Serial5.print(minute, DEC); - Serial5.print(":"); - Serial5.print(second, DEC); - Serial5.print(" "); - Serial5.print(month, DEC); - Serial5.print("/"); - Serial5.print(dayOfMonth, DEC); - Serial5.print("/"); - Serial5.print(year,DEC); - Serial5.print(" "); - Serial5.println(); + SERIAL_PORT_MONITOR.print(hour, DEC); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(minute, DEC); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(second, DEC); + SERIAL_PORT_MONITOR.print(" "); + SERIAL_PORT_MONITOR.print(month, DEC); + SERIAL_PORT_MONITOR.print("/"); + SERIAL_PORT_MONITOR.print(dayOfMonth, DEC); + SERIAL_PORT_MONITOR.print("/"); + SERIAL_PORT_MONITOR.print(year,DEC); + SERIAL_PORT_MONITOR.print(" "); + SERIAL_PORT_MONITOR.println(); delay(990); } diff --git a/cores/validation/validation_I2C_multi/test.cpp b/cores/validation/validation_I2C_multi/test.cpp index fbf120788c6bb5891005a9e5fc01cc51b5f8f8f4..25419a88c9b549ae2f122d477efc32ef5f0da3f6 100644 --- a/cores/validation/validation_I2C_multi/test.cpp +++ b/cores/validation/validation_I2C_multi/test.cpp @@ -76,8 +76,8 @@ void updateTime() void setup() { - Serial5.begin( 115200 ); - Serial5.println("Wire init"); + SERIAL_PORT_MONITOR.begin( 115200 ); + SERIAL_PORT_MONITOR.println("Wire init"); Wire.begin(); lcd.init(); @@ -106,8 +106,8 @@ void loop() delay(10); Wire.requestFrom(addressTemp, 2); - Serial5.print((char)13); // Erase current line - Serial5.print("Temperature : "); + SERIAL_PORT_MONITOR.print((char)13); // Erase current line + SERIAL_PORT_MONITOR.print("Temperature : "); a = Wire.read(); b = Wire.read(); @@ -116,9 +116,9 @@ void loop() valueTemp |= b; valueTemp >>= 7; - Serial5.print(a); - Serial5.print(" | "); - Serial5.print(b); + SERIAL_PORT_MONITOR.print(a); + SERIAL_PORT_MONITOR.print(" | "); + SERIAL_PORT_MONITOR.print(b); updateTime(); lcd.setCursor(0, 0); diff --git a/cores/validation/validation_PWM/build_as6/test.atsln b/cores/validation/validation_PWM/build_as6/test.atsln new file mode 100644 index 0000000000000000000000000000000000000000..749e8031642f7e15c4630fbe5342fce033772a6c --- /dev/null +++ b/cores/validation/validation_PWM/build_as6/test.atsln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Atmel Studio Solution File, Format Version 11.00 +Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "test", "test.cppproj", "{B3F859AD-E162-4C2F-9684-EAC6932FEC80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Release|ARM = Release|ARM + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Debug|ARM.ActiveCfg = Debug|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Debug|ARM.Build.0 = Debug|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Release|ARM.ActiveCfg = Release|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Release|ARM.Build.0 = Release|ARM + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/cores/validation/validation_PWM/build_as6/test.cppproj b/cores/validation/validation_PWM/build_as6/test.cppproj new file mode 100644 index 0000000000000000000000000000000000000000..9b7f439503a2060204f41696ce078cc27c346db1 --- /dev/null +++ b/cores/validation/validation_PWM/build_as6/test.cppproj @@ -0,0 +1,458 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <SchemaVersion>2.0</SchemaVersion> + <ProjectVersion>6.2</ProjectVersion> + <ToolchainName>com.Atmel.ARMGCC.CPP</ToolchainName> + <ProjectGuid>{b3f859ad-e162-4c2f-9684-eac6932fec80}</ProjectGuid> + <avrdevice>ATSAMD21G18A</avrdevice> + <avrdeviceseries>none</avrdeviceseries> + <OutputType>Executable</OutputType> + <Language>CPP</Language> + <OutputFileName>$(MSBuildProjectName)</OutputFileName> + <OutputFileExtension>.elf</OutputFileExtension> + <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> + <AssemblyName>test</AssemblyName> + <Name>test</Name> + <RootNamespace>test</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>false</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>1</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.17.0" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.edbg</avrtool> + <avrtoolinterface>SWD</avrtoolinterface> + <com_atmel_avrdbg_tool_samice> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>SWD</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.samice</ToolType> + <ToolNumber>28010306</ToolNumber> + <ToolName>SAM-ICE</ToolName> + </com_atmel_avrdbg_tool_samice> + <UseGdb>True</UseGdb> + <com_atmel_avrdbg_tool_edbg> + <ToolOptions> + <InterfaceProperties> + <SwdClock>4000000</SwdClock> + </InterfaceProperties> + <InterfaceName>SWD</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.edbg</ToolType> + <ToolNumber>ATML2320021800000009</ToolNumber> + <ToolName>EDBG</ToolName> + </com_atmel_avrdbg_tool_edbg> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> + <ToolchainSettings> + <ArmGccCpp> + <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex> + <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss> + <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep> + <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin> + <armgcc.common.outputfiles.srec>True</armgcc.common.outputfiles.srec> + <armgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </armgcc.compiler.symbols.DefSymbols> + <armgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcc.compiler.directories.IncludePaths> + <armgcc.compiler.optimization.level>Optimize for size (-Os)</armgcc.compiler.optimization.level> + <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings> + <armgcccpp.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </armgcccpp.compiler.symbols.DefSymbols> + <armgcccpp.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.compiler.directories.IncludePaths> + <armgcccpp.compiler.optimization.level>Optimize for size (-Os)</armgcccpp.compiler.optimization.level> + <armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcccpp.compiler.warnings.AllWarnings>True</armgcccpp.compiler.warnings.AllWarnings> + <armgcccpp.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </armgcccpp.linker.libraries.Libraries> + <armgcccpp.linker.libraries.LibrarySearchPaths> + <ListValues> + <Value>../cmsis/linkerScripts</Value> + </ListValues> + </armgcccpp.linker.libraries.LibrarySearchPaths> + <armgcccpp.linker.optimization.GarbageCollectUnusedSections>True</armgcccpp.linker.optimization.GarbageCollectUnusedSections> + <armgcccpp.linker.miscellaneous.LinkerFlags>-Tsamd21g18a_flash.ld</armgcccpp.linker.miscellaneous.LinkerFlags> + <armgcccpp.preprocessingassembler.general.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.preprocessingassembler.general.IncludePaths> + </ArmGccCpp> + </ToolchainSettings> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> + <ToolchainSettings> + <ArmGccCpp> + <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex> + <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss> + <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep> + <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin> + <armgcc.common.outputfiles.srec>True</armgcc.common.outputfiles.srec> + <armgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</armgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <armgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </armgcc.compiler.symbols.DefSymbols> + <armgcc.compiler.directories.DefaultIncludePath>False</armgcc.compiler.directories.DefaultIncludePath> + <armgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcc.compiler.directories.IncludePaths> + <armgcc.compiler.optimization.level>Optimize (-O1)</armgcc.compiler.optimization.level> + <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcc.compiler.optimization.PrepareDataForGarbageCollection>True</armgcc.compiler.optimization.PrepareDataForGarbageCollection> + <armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel> + <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings> + <armgcc.compiler.miscellaneous.OtherFlags>-std=c99</armgcc.compiler.miscellaneous.OtherFlags> + <armgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</armgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned> + <armgcccpp.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + <Value>USB_VID=0x2341</Value> + <Value>USB_PID=0x004d</Value> + </ListValues> + </armgcccpp.compiler.symbols.DefSymbols> + <armgcccpp.compiler.directories.DefaultIncludePath>False</armgcccpp.compiler.directories.DefaultIncludePath> + <armgcccpp.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.compiler.directories.IncludePaths> + <armgcccpp.compiler.optimization.level>Optimize (-O1)</armgcccpp.compiler.optimization.level> + <armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcccpp.compiler.optimization.PrepareDataForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareDataForGarbageCollection> + <armgcccpp.compiler.optimization.DebugLevel>Maximum (-g3)</armgcccpp.compiler.optimization.DebugLevel> + <armgcccpp.compiler.warnings.AllWarnings>True</armgcccpp.compiler.warnings.AllWarnings> + <armgcccpp.compiler.miscellaneous.OtherFlags>-std=c++98</armgcccpp.compiler.miscellaneous.OtherFlags> + <armgcccpp.linker.general.UseNewlibNano>True</armgcccpp.linker.general.UseNewlibNano> + <armgcccpp.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </armgcccpp.linker.libraries.Libraries> + <armgcccpp.linker.libraries.LibrarySearchPaths> + <ListValues> + <Value>../../../../../variants/arduino_zero/linker_scripts/gcc</Value> + </ListValues> + </armgcccpp.linker.libraries.LibrarySearchPaths> + <armgcccpp.linker.optimization.GarbageCollectUnusedSections>True</armgcccpp.linker.optimization.GarbageCollectUnusedSections> + <armgcccpp.linker.memorysettings.ExternalRAM /> + <armgcccpp.linker.miscellaneous.LinkerFlags>--specs=nosys.specs -Tflash_with_bootloader.ld</armgcccpp.linker.miscellaneous.LinkerFlags> + <armgcccpp.assembler.general.IncludePaths> + <ListValues> + <Value>../../../arduino</Value> + </ListValues> + </armgcccpp.assembler.general.IncludePaths> + <armgcccpp.assembler.debugging.DebugLevel>Default (-g)</armgcccpp.assembler.debugging.DebugLevel> + <armgcccpp.preprocessingassembler.general.DefaultIncludePath>False</armgcccpp.preprocessingassembler.general.DefaultIncludePath> + <armgcccpp.preprocessingassembler.general.IncludePaths> + <ListValues> + <Value>../../../arduino</Value> + </ListValues> + </armgcccpp.preprocessingassembler.general.IncludePaths> + <armgcccpp.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</armgcccpp.preprocessingassembler.debugging.DebugLevel> + </ArmGccCpp> + </ToolchainSettings> + </PropertyGroup> + <ItemGroup> + <Folder Include="core" /> + <Folder Include="Wire" /> + <Folder Include="SPI" /> + <Folder Include="variant" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\..\libraries\SPI\SPI.cpp"> + <SubType>compile</SubType> + <Link>SPI\SPI.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\SPI\SPI.h"> + <SubType>compile</SubType> + <Link>SPI\SPI.h</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\Wire\Wire.cpp"> + <SubType>compile</SubType> + <Link>Wire\Wire.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\Wire\Wire.h"> + <SubType>compile</SubType> + <Link>Wire\Wire.h</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\pins_arduino.h"> + <SubType>compile</SubType> + <Link>variant\pins_arduino.h</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\variant.cpp"> + <SubType>compile</SubType> + <Link>variant\variant.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\variant.h"> + <SubType>compile</SubType> + <Link>variant\variant.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Arduino.h"> + <SubType>compile</SubType> + <Link>core\Arduino.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\binary.h"> + <SubType>compile</SubType> + <Link>core\binary.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Client.h"> + <SubType>compile</SubType> + <Link>core\Client.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\delay.c"> + <SubType>compile</SubType> + <Link>core\delay.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\delay.h"> + <SubType>compile</SubType> + <Link>core\delay.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\HardwareSerial.h"> + <SubType>compile</SubType> + <Link>core\HardwareSerial.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\hooks.c"> + <SubType>compile</SubType> + <Link>core\hooks.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\IPAddress.cpp"> + <SubType>compile</SubType> + <Link>core\IPAddress.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\IPAddress.h"> + <SubType>compile</SubType> + <Link>core\IPAddress.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\itoa.c"> + <SubType>compile</SubType> + <Link>core\itoa.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\itoa.h"> + <SubType>compile</SubType> + <Link>core\itoa.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\main.cpp"> + <SubType>compile</SubType> + <Link>core\main.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Print.cpp"> + <SubType>compile</SubType> + <Link>core\Print.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Print.h"> + <SubType>compile</SubType> + <Link>core\Print.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Printable.h"> + <SubType>compile</SubType> + <Link>core\Printable.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Reset.cpp"> + <SubType>compile</SubType> + <Link>core\Reset.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Reset.h"> + <SubType>compile</SubType> + <Link>core\Reset.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\RingBuffer.cpp"> + <SubType>compile</SubType> + <Link>core\RingBuffer.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\RingBuffer.h"> + <SubType>compile</SubType> + <Link>core\RingBuffer.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\SERCOM.cpp"> + <SubType>compile</SubType> + <Link>core\SERCOM.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\SERCOM.h"> + <SubType>compile</SubType> + <Link>core\SERCOM.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Server.h"> + <SubType>compile</SubType> + <Link>core\Server.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\startup.c"> + <SubType>compile</SubType> + <Link>core\startup.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\Stream.cpp"> + <SubType>compile</SubType> + <Link>core\Stream.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Stream.h"> + <SubType>compile</SubType> + <Link>core\Stream.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Tone.h"> + <SubType>compile</SubType> + <Link>core\Tone.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Uart.cpp"> + <SubType>compile</SubType> + <Link>core\Uart.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Uart.h"> + <SubType>compile</SubType> + <Link>core\Uart.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Udp.h"> + <SubType>compile</SubType> + <Link>core\Udp.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WCharacter.h"> + <SubType>compile</SubType> + <Link>core\WCharacter.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WInterrupts.c"> + <SubType>compile</SubType> + <Link>core\WInterrupts.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\WInterrupts.h"> + <SubType>compile</SubType> + <Link>core\WInterrupts.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring.c"> + <SubType>compile</SubType> + <Link>core\wiring.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring.h"> + <SubType>compile</SubType> + <Link>core\wiring.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_analog.c"> + <SubType>compile</SubType> + <Link>core\wiring_analog.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_analog.h"> + <SubType>compile</SubType> + <Link>core\wiring_analog.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_constants.h"> + <SubType>compile</SubType> + <Link>core\wiring_constants.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_digital.c"> + <SubType>compile</SubType> + <Link>core\wiring_digital.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_digital.h"> + <SubType>compile</SubType> + <Link>core\wiring_digital.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_private.h"> + <SubType>compile</SubType> + <Link>core\wiring_private.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_pulse.h"> + <SubType>compile</SubType> + <Link>core\wiring_pulse.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_shift.c"> + <SubType>compile</SubType> + <Link>core\wiring_shift.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_shift.h"> + <SubType>compile</SubType> + <Link>core\wiring_shift.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WMath.cpp"> + <SubType>compile</SubType> + <Link>core\WMath.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\WMath.h"> + <SubType>compile</SubType> + <Link>core\WMath.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WString.cpp"> + <SubType>compile</SubType> + <Link>core\WString.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\WString.h"> + <SubType>compile</SubType> + <Link>core\WString.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WVariant.h"> + <SubType>compile</SubType> + <Link>core\WVariant.h</Link> + </Compile> + <Compile Include="..\test.cpp"> + <SubType>compile</SubType> + <Link>test.cpp</Link> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project> \ No newline at end of file diff --git a/cores/validation/validation_PWM/test.cpp b/cores/validation/validation_PWM/test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e11936229dbc284fa431b9b667dcf89ca3db934 --- /dev/null +++ b/cores/validation/validation_PWM/test.cpp @@ -0,0 +1,57 @@ +/* + Copyright (c) 2014 Arduino. All right reserved. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "Arduino.h" + +static uint8_t brightness = 0; // how bright the LED is +static int fadeAmount = 5; // how many points to fade the LED by + +void setup( void ) +{ + for ( int i=2 ; i < 14 ; i++ ) + { + pinMode( i, OUTPUT ) ; + } + + SERIAL_PORT_MONITOR.begin( 115200 ) ; // Output to EDBG Virtual COM Port + SERIAL_PORT_MONITOR.println( "test") ; + SERIAL_PORT_MONITOR.println( brightness ) ; +} + +void loop( void ) +{ + SERIAL_PORT_MONITOR.println( brightness ) ; + + for ( int i=2 ; i < 14 ; i++ ) + { + analogWrite( i, brightness ) ; + } + + // change the brightness for next time through the loop: + brightness = brightness + fadeAmount ; + + // reverse the direction of the fading at the ends of the fade: + if ( brightness == 0 || brightness == 255 ) + { + fadeAmount = -fadeAmount ; + } + + // wait for 30 milliseconds to see the dimming effect + delay( 30 ) ; +} + diff --git a/cores/validation/validation_chuck/test.cpp b/cores/validation/validation_chuck/test.cpp index 6327a84a29b4dae84a629ee32d25472d48e8a442..1f70241a1f3ee0c34068cbef54898af8a5565284 100644 --- a/cores/validation/validation_chuck/test.cpp +++ b/cores/validation/validation_chuck/test.cpp @@ -23,8 +23,8 @@ uint8_t accx,accy,zbut,cbut ; void setup() { - Serial5.begin( 115200 ) ; - Serial5.println("nunchuk init"); + SERIAL_PORT_MONITOR.begin( 115200 ) ; + SERIAL_PORT_MONITOR.println("nunchuk init"); Wire.begin(); // join i2c bus as master Wire.beginTransmission(0x52);// transmit to device 0x52 @@ -34,7 +34,7 @@ void setup() Wire.write((uint8_t)0x00);// sends sent a zero. Wire.endTransmission();// stop transmitting - Serial5.println( "WiiChukDemo ready" ) ; + SERIAL_PORT_MONITOR.println( "WiiChukDemo ready" ) ; delay(100); } @@ -49,39 +49,39 @@ void loop() uint8_t accZ = Wire.read(); uint8_t misc = Wire.read(); - Serial5.print("Joy : "); - Serial5.print(jX); - Serial5.print(", "); - Serial5.print(jY); + SERIAL_PORT_MONITOR.print("Joy : "); + SERIAL_PORT_MONITOR.print(jX); + SERIAL_PORT_MONITOR.print(", "); + SERIAL_PORT_MONITOR.print(jY); - Serial5.print("\tAcc : "); - Serial5.print(accX); - Serial5.print(", "); - Serial5.print(accY); - Serial5.print(", "); - Serial5.print(accZ); + SERIAL_PORT_MONITOR.print("\tAcc : "); + SERIAL_PORT_MONITOR.print(accX); + SERIAL_PORT_MONITOR.print(", "); + SERIAL_PORT_MONITOR.print(accY); + SERIAL_PORT_MONITOR.print(", "); + SERIAL_PORT_MONITOR.print(accZ); - Serial5.print("\tBtn : "); - Serial5.print(" ["); - Serial5.print(misc); - Serial5.print("] "); + SERIAL_PORT_MONITOR.print("\tBtn : "); + SERIAL_PORT_MONITOR.print(" ["); + SERIAL_PORT_MONITOR.print(misc); + SERIAL_PORT_MONITOR.print("] "); switch(misc & 0x3ul) { case 0x0ul: - Serial5.println("Z"); + SERIAL_PORT_MONITOR.println("Z"); break; case 0x1ul: - Serial5.println("C"); + SERIAL_PORT_MONITOR.println("C"); break; case 0x2ul: - Serial5.println("C + Z"); + SERIAL_PORT_MONITOR.println("C + Z"); break; case 0x3ul: - Serial5.println("No key"); + SERIAL_PORT_MONITOR.println("No key"); break; default: diff --git a/cores/validation/validation_core/test.cpp b/cores/validation/validation_core/test.cpp index fb3918c35b111e4b39f7a746a8dd448b7bf44a48..f62143f2f43ce3470e02bf6b301a27b038217527 100644 --- a/cores/validation/validation_core/test.cpp +++ b/cores/validation/validation_core/test.cpp @@ -63,7 +63,7 @@ void setup( void ) pinPeripheral( 13, PIO_AC_CLK ) ; // Clock Gen 3*/ //********************************************** - Serial5.begin( 115200 ) ; // Output to EDBG Virtual COM Port + SERIAL_PORT_MONITOR.begin( 115200 ) ; // Output to EDBG Virtual COM Port // Test External Interrupt attachInterrupt( 3, Interrupt_Pin3, LOW ) ; @@ -73,11 +73,11 @@ void setup( void ) attachInterrupt( 7, Interrupt_Pin7, CHANGE) ; pcBuff = (char *)malloc(50); - + strcpy(pcBuff, "CIAO"); - Serial.println("----"); - Serial.println(pcBuff); // Outputs garbage instead of "CIAO" - Serial.println("----"); + SERIAL_PORT_MONITOR.println("----"); + SERIAL_PORT_MONITOR.println(pcBuff); // Outputs garbage instead of "CIAO" + SERIAL_PORT_MONITOR.println("----"); } static void led_step1( void ) @@ -106,15 +106,15 @@ void loop( void ) led_step2() ; delay( 500 ) ; // wait for a second - // Test Serial output - Serial5.write( '-' ) ; // send a char - Serial5.write( "test1\n" ) ; // send a string - Serial5.write( "test2" ) ; // send another string + // Test SERIAL_PORT_MONITOR output + SERIAL_PORT_MONITOR.write( '-' ) ; // send a char + SERIAL_PORT_MONITOR.write( "test1\n" ) ; // send a string + SERIAL_PORT_MONITOR.write( "test2" ) ; // send another string // Test digitalRead: connect pin 2 to either GND or 3.3V. !!!! NOT on 5V pin !!!! pin_value=digitalRead( 2 ) ; - Serial5.write( "pin 2 value is " ) ; - Serial5.write( (pin_value == LOW)?"LOW\n":"HIGH\n" ) ; + SERIAL_PORT_MONITOR.write( "pin 2 value is " ) ; + SERIAL_PORT_MONITOR.write( (pin_value == LOW)?"LOW\n":"HIGH\n" ) ; duty_cycle+=8 ;//=(uint8_t)(millis() & 0xff) ; analogWrite( 13, duty_cycle ) ; @@ -127,48 +127,46 @@ void loop( void ) dac_value += 64; analogWrite(A0, dac_value); - - - Serial5.print("\r\nAnalog pins: "); + SERIAL_PORT_MONITOR.print("\r\nAnalog pins: "); for ( uint32_t i = A0 ; i <= A0+NUM_ANALOG_INPUTS ; i++ ) { int a = analogRead(i); - Serial5.print(a, DEC); - Serial5.print(" "); + SERIAL_PORT_MONITOR.print(a, DEC); + SERIAL_PORT_MONITOR.print(" "); } - Serial5.println(); + SERIAL_PORT_MONITOR.println(); - Serial5.println("External interrupt pins:"); + SERIAL_PORT_MONITOR.println("External interrupt pins:"); if ( ul_Interrupt_Pin3 == 1 ) { - Serial5.println( "Pin 3 triggered (LOW)" ) ; + SERIAL_PORT_MONITOR.println( "Pin 3 triggered (LOW)" ) ; ul_Interrupt_Pin3 = 0 ; } if ( ul_Interrupt_Pin4 == 1 ) { - Serial5.println( "Pin 4 triggered (HIGH)" ) ; + SERIAL_PORT_MONITOR.println( "Pin 4 triggered (HIGH)" ) ; ul_Interrupt_Pin4 = 0 ; } if ( ul_Interrupt_Pin5 == 1 ) { - Serial5.println( "Pin 5 triggered (FALLING)" ) ; + SERIAL_PORT_MONITOR.println( "Pin 5 triggered (FALLING)" ) ; ul_Interrupt_Pin5 = 0 ; } if ( ul_Interrupt_Pin6 == 1 ) { - Serial5.println( "Pin 6 triggered (RISING)" ) ; + SERIAL_PORT_MONITOR.println( "Pin 6 triggered (RISING)" ) ; ul_Interrupt_Pin6 = 0 ; } if ( ul_Interrupt_Pin7 == 1 ) { - Serial5.println( "Pin 7 triggered (CHANGE)" ) ; + SERIAL_PORT_MONITOR.println( "Pin 7 triggered (CHANGE)" ) ; ul_Interrupt_Pin7 = 0 ; } } diff --git a/cores/validation/validation_new/build_as6/test.atsln b/cores/validation/validation_new/build_as6/test.atsln new file mode 100644 index 0000000000000000000000000000000000000000..749e8031642f7e15c4630fbe5342fce033772a6c --- /dev/null +++ b/cores/validation/validation_new/build_as6/test.atsln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Atmel Studio Solution File, Format Version 11.00 +Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "test", "test.cppproj", "{B3F859AD-E162-4C2F-9684-EAC6932FEC80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Release|ARM = Release|ARM + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Debug|ARM.ActiveCfg = Debug|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Debug|ARM.Build.0 = Debug|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Release|ARM.ActiveCfg = Release|ARM + {B3F859AD-E162-4C2F-9684-EAC6932FEC80}.Release|ARM.Build.0 = Release|ARM + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/cores/validation/validation_new/build_as6/test.cppproj b/cores/validation/validation_new/build_as6/test.cppproj new file mode 100644 index 0000000000000000000000000000000000000000..9b7f439503a2060204f41696ce078cc27c346db1 --- /dev/null +++ b/cores/validation/validation_new/build_as6/test.cppproj @@ -0,0 +1,458 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <SchemaVersion>2.0</SchemaVersion> + <ProjectVersion>6.2</ProjectVersion> + <ToolchainName>com.Atmel.ARMGCC.CPP</ToolchainName> + <ProjectGuid>{b3f859ad-e162-4c2f-9684-eac6932fec80}</ProjectGuid> + <avrdevice>ATSAMD21G18A</avrdevice> + <avrdeviceseries>none</avrdeviceseries> + <OutputType>Executable</OutputType> + <Language>CPP</Language> + <OutputFileName>$(MSBuildProjectName)</OutputFileName> + <OutputFileExtension>.elf</OutputFileExtension> + <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> + <AssemblyName>test</AssemblyName> + <Name>test</Name> + <RootNamespace>test</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>false</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>1</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.17.0" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.edbg</avrtool> + <avrtoolinterface>SWD</avrtoolinterface> + <com_atmel_avrdbg_tool_samice> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>SWD</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.samice</ToolType> + <ToolNumber>28010306</ToolNumber> + <ToolName>SAM-ICE</ToolName> + </com_atmel_avrdbg_tool_samice> + <UseGdb>True</UseGdb> + <com_atmel_avrdbg_tool_edbg> + <ToolOptions> + <InterfaceProperties> + <SwdClock>4000000</SwdClock> + </InterfaceProperties> + <InterfaceName>SWD</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.edbg</ToolType> + <ToolNumber>ATML2320021800000009</ToolNumber> + <ToolName>EDBG</ToolName> + </com_atmel_avrdbg_tool_edbg> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> + <ToolchainSettings> + <ArmGccCpp> + <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex> + <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss> + <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep> + <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin> + <armgcc.common.outputfiles.srec>True</armgcc.common.outputfiles.srec> + <armgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </armgcc.compiler.symbols.DefSymbols> + <armgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcc.compiler.directories.IncludePaths> + <armgcc.compiler.optimization.level>Optimize for size (-Os)</armgcc.compiler.optimization.level> + <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings> + <armgcccpp.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </armgcccpp.compiler.symbols.DefSymbols> + <armgcccpp.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.compiler.directories.IncludePaths> + <armgcccpp.compiler.optimization.level>Optimize for size (-Os)</armgcccpp.compiler.optimization.level> + <armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcccpp.compiler.warnings.AllWarnings>True</armgcccpp.compiler.warnings.AllWarnings> + <armgcccpp.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </armgcccpp.linker.libraries.Libraries> + <armgcccpp.linker.libraries.LibrarySearchPaths> + <ListValues> + <Value>../cmsis/linkerScripts</Value> + </ListValues> + </armgcccpp.linker.libraries.LibrarySearchPaths> + <armgcccpp.linker.optimization.GarbageCollectUnusedSections>True</armgcccpp.linker.optimization.GarbageCollectUnusedSections> + <armgcccpp.linker.miscellaneous.LinkerFlags>-Tsamd21g18a_flash.ld</armgcccpp.linker.miscellaneous.LinkerFlags> + <armgcccpp.preprocessingassembler.general.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.preprocessingassembler.general.IncludePaths> + </ArmGccCpp> + </ToolchainSettings> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> + <ToolchainSettings> + <ArmGccCpp> + <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex> + <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss> + <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep> + <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin> + <armgcc.common.outputfiles.srec>True</armgcc.common.outputfiles.srec> + <armgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</armgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <armgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </armgcc.compiler.symbols.DefSymbols> + <armgcc.compiler.directories.DefaultIncludePath>False</armgcc.compiler.directories.DefaultIncludePath> + <armgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcc.compiler.directories.IncludePaths> + <armgcc.compiler.optimization.level>Optimize (-O1)</armgcc.compiler.optimization.level> + <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcc.compiler.optimization.PrepareDataForGarbageCollection>True</armgcc.compiler.optimization.PrepareDataForGarbageCollection> + <armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel> + <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings> + <armgcc.compiler.miscellaneous.OtherFlags>-std=c99</armgcc.compiler.miscellaneous.OtherFlags> + <armgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</armgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned> + <armgcccpp.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + <Value>USB_VID=0x2341</Value> + <Value>USB_PID=0x004d</Value> + </ListValues> + </armgcccpp.compiler.symbols.DefSymbols> + <armgcccpp.compiler.directories.DefaultIncludePath>False</armgcccpp.compiler.directories.DefaultIncludePath> + <armgcccpp.compiler.directories.IncludePaths> + <ListValues> + <Value>../../../../../../../tools/CMSIS/Device/ATMEL</Value> + <Value>../../../../../../../tools/CMSIS/CMSIS/Include</Value> + <Value>../../../../arduino</Value> + <Value>../../../../arduino/USB</Value> + <Value>../../../../../variants/arduino_zero</Value> + <Value>../../../../../libraries/SPI</Value> + <Value>../../../../../libraries/Wire</Value> + </ListValues> + </armgcccpp.compiler.directories.IncludePaths> + <armgcccpp.compiler.optimization.level>Optimize (-O1)</armgcccpp.compiler.optimization.level> + <armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareFunctionsForGarbageCollection> + <armgcccpp.compiler.optimization.PrepareDataForGarbageCollection>True</armgcccpp.compiler.optimization.PrepareDataForGarbageCollection> + <armgcccpp.compiler.optimization.DebugLevel>Maximum (-g3)</armgcccpp.compiler.optimization.DebugLevel> + <armgcccpp.compiler.warnings.AllWarnings>True</armgcccpp.compiler.warnings.AllWarnings> + <armgcccpp.compiler.miscellaneous.OtherFlags>-std=c++98</armgcccpp.compiler.miscellaneous.OtherFlags> + <armgcccpp.linker.general.UseNewlibNano>True</armgcccpp.linker.general.UseNewlibNano> + <armgcccpp.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </armgcccpp.linker.libraries.Libraries> + <armgcccpp.linker.libraries.LibrarySearchPaths> + <ListValues> + <Value>../../../../../variants/arduino_zero/linker_scripts/gcc</Value> + </ListValues> + </armgcccpp.linker.libraries.LibrarySearchPaths> + <armgcccpp.linker.optimization.GarbageCollectUnusedSections>True</armgcccpp.linker.optimization.GarbageCollectUnusedSections> + <armgcccpp.linker.memorysettings.ExternalRAM /> + <armgcccpp.linker.miscellaneous.LinkerFlags>--specs=nosys.specs -Tflash_with_bootloader.ld</armgcccpp.linker.miscellaneous.LinkerFlags> + <armgcccpp.assembler.general.IncludePaths> + <ListValues> + <Value>../../../arduino</Value> + </ListValues> + </armgcccpp.assembler.general.IncludePaths> + <armgcccpp.assembler.debugging.DebugLevel>Default (-g)</armgcccpp.assembler.debugging.DebugLevel> + <armgcccpp.preprocessingassembler.general.DefaultIncludePath>False</armgcccpp.preprocessingassembler.general.DefaultIncludePath> + <armgcccpp.preprocessingassembler.general.IncludePaths> + <ListValues> + <Value>../../../arduino</Value> + </ListValues> + </armgcccpp.preprocessingassembler.general.IncludePaths> + <armgcccpp.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</armgcccpp.preprocessingassembler.debugging.DebugLevel> + </ArmGccCpp> + </ToolchainSettings> + </PropertyGroup> + <ItemGroup> + <Folder Include="core" /> + <Folder Include="Wire" /> + <Folder Include="SPI" /> + <Folder Include="variant" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\..\libraries\SPI\SPI.cpp"> + <SubType>compile</SubType> + <Link>SPI\SPI.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\SPI\SPI.h"> + <SubType>compile</SubType> + <Link>SPI\SPI.h</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\Wire\Wire.cpp"> + <SubType>compile</SubType> + <Link>Wire\Wire.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\libraries\Wire\Wire.h"> + <SubType>compile</SubType> + <Link>Wire\Wire.h</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\pins_arduino.h"> + <SubType>compile</SubType> + <Link>variant\pins_arduino.h</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\variant.cpp"> + <SubType>compile</SubType> + <Link>variant\variant.cpp</Link> + </Compile> + <Compile Include="..\..\..\..\variants\arduino_zero\variant.h"> + <SubType>compile</SubType> + <Link>variant\variant.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Arduino.h"> + <SubType>compile</SubType> + <Link>core\Arduino.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\binary.h"> + <SubType>compile</SubType> + <Link>core\binary.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Client.h"> + <SubType>compile</SubType> + <Link>core\Client.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\delay.c"> + <SubType>compile</SubType> + <Link>core\delay.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\delay.h"> + <SubType>compile</SubType> + <Link>core\delay.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\HardwareSerial.h"> + <SubType>compile</SubType> + <Link>core\HardwareSerial.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\hooks.c"> + <SubType>compile</SubType> + <Link>core\hooks.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\IPAddress.cpp"> + <SubType>compile</SubType> + <Link>core\IPAddress.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\IPAddress.h"> + <SubType>compile</SubType> + <Link>core\IPAddress.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\itoa.c"> + <SubType>compile</SubType> + <Link>core\itoa.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\itoa.h"> + <SubType>compile</SubType> + <Link>core\itoa.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\main.cpp"> + <SubType>compile</SubType> + <Link>core\main.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Print.cpp"> + <SubType>compile</SubType> + <Link>core\Print.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Print.h"> + <SubType>compile</SubType> + <Link>core\Print.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Printable.h"> + <SubType>compile</SubType> + <Link>core\Printable.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Reset.cpp"> + <SubType>compile</SubType> + <Link>core\Reset.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Reset.h"> + <SubType>compile</SubType> + <Link>core\Reset.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\RingBuffer.cpp"> + <SubType>compile</SubType> + <Link>core\RingBuffer.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\RingBuffer.h"> + <SubType>compile</SubType> + <Link>core\RingBuffer.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\SERCOM.cpp"> + <SubType>compile</SubType> + <Link>core\SERCOM.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\SERCOM.h"> + <SubType>compile</SubType> + <Link>core\SERCOM.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Server.h"> + <SubType>compile</SubType> + <Link>core\Server.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\startup.c"> + <SubType>compile</SubType> + <Link>core\startup.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\Stream.cpp"> + <SubType>compile</SubType> + <Link>core\Stream.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Stream.h"> + <SubType>compile</SubType> + <Link>core\Stream.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Tone.h"> + <SubType>compile</SubType> + <Link>core\Tone.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Uart.cpp"> + <SubType>compile</SubType> + <Link>core\Uart.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\Uart.h"> + <SubType>compile</SubType> + <Link>core\Uart.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\Udp.h"> + <SubType>compile</SubType> + <Link>core\Udp.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WCharacter.h"> + <SubType>compile</SubType> + <Link>core\WCharacter.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WInterrupts.c"> + <SubType>compile</SubType> + <Link>core\WInterrupts.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\WInterrupts.h"> + <SubType>compile</SubType> + <Link>core\WInterrupts.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring.c"> + <SubType>compile</SubType> + <Link>core\wiring.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring.h"> + <SubType>compile</SubType> + <Link>core\wiring.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_analog.c"> + <SubType>compile</SubType> + <Link>core\wiring_analog.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_analog.h"> + <SubType>compile</SubType> + <Link>core\wiring_analog.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_constants.h"> + <SubType>compile</SubType> + <Link>core\wiring_constants.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_digital.c"> + <SubType>compile</SubType> + <Link>core\wiring_digital.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_digital.h"> + <SubType>compile</SubType> + <Link>core\wiring_digital.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_private.h"> + <SubType>compile</SubType> + <Link>core\wiring_private.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_pulse.h"> + <SubType>compile</SubType> + <Link>core\wiring_pulse.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_shift.c"> + <SubType>compile</SubType> + <Link>core\wiring_shift.c</Link> + </Compile> + <Compile Include="..\..\..\arduino\wiring_shift.h"> + <SubType>compile</SubType> + <Link>core\wiring_shift.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WMath.cpp"> + <SubType>compile</SubType> + <Link>core\WMath.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\WMath.h"> + <SubType>compile</SubType> + <Link>core\WMath.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WString.cpp"> + <SubType>compile</SubType> + <Link>core\WString.cpp</Link> + </Compile> + <Compile Include="..\..\..\arduino\WString.h"> + <SubType>compile</SubType> + <Link>core\WString.h</Link> + </Compile> + <Compile Include="..\..\..\arduino\WVariant.h"> + <SubType>compile</SubType> + <Link>core\WVariant.h</Link> + </Compile> + <Compile Include="..\test.cpp"> + <SubType>compile</SubType> + <Link>test.cpp</Link> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project> \ No newline at end of file diff --git a/cores/validation/validation_new/test.cpp b/cores/validation/validation_new/test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b0bfe90dd454855fa4a99dd27380e6c88ded1508 --- /dev/null +++ b/cores/validation/validation_new/test.cpp @@ -0,0 +1,58 @@ +/* + Copyright (c) 2014 Arduino. All right reserved. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "Arduino.h" + +class Base +{ + public: + virtual void f() = 0; + virtual ~Base() {} +}; + +class Derived : public Base +{ + public: + virtual void f() {}; + virtual ~Derived() {} +}; + + +void setup() { + // This will cause "pure virtual function call" error + // __cxa_pure_virtual + Derived *a = new Derived(); + a->f(); +} + +struct X { + X() { + Serial.print("Hello!"); + }; +}; + +void foo() { + // This will cause delayed static member initialization + // __cxa_guard_acquire + // __cxa_guard_release + static X a; +} + +void loop() { + foo(); +} diff --git a/cores/validation/validation_shield_wifi/test.cpp b/cores/validation/validation_shield_wifi/test.cpp index 7d1b5343df54d9fa3d4c76004c94a19b6bafda68..593ab283d40ebfda92ee2238075b5aa891df6eb6 100644 --- a/cores/validation/validation_shield_wifi/test.cpp +++ b/cores/validation/validation_shield_wifi/test.cpp @@ -38,8 +38,8 @@ void printCurrentNet(); void printWifiData(); void httpRequest(); -char ssid[] = "AVRGUEST"; // your network SSID (name) -char pass[] = "MicroController"; // your network password +char ssid[] = ""; // your network SSID (name) +char pass[] = ""; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status WiFiClient client; @@ -51,23 +51,23 @@ void setup() { delay(500); // Waiting for initialization // SPI.begin(); - //Initialize Serial5 and wait for port to open: - Serial5.begin(9600); - while (!Serial5) { - ; // wait for Serial5 port to connect. Needed for Leonardo only + //Initialize SERIAL_PORT_MONITOR and wait for port to open: + SERIAL_PORT_MONITOR.begin(9600); + while (!SERIAL_PORT_MONITOR) { + ; // wait for SERIAL_PORT_MONITOR port to connect. Needed for Leonardo only } // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - Serial5.println("WiFi shield not present"); + SERIAL_PORT_MONITOR.println("WiFi shield not present"); // don't continue: while(true); } // attempt to connect to Wifi network: while ( status != WL_CONNECTED) { - Serial5.print("Attempting to connect to WPA SSID: "); - Serial5.println(ssid); + SERIAL_PORT_MONITOR.print("Attempting to connect to WPA SSID: "); + SERIAL_PORT_MONITOR.println(ssid); // Connect to WPA/WPA2 network: status = WiFi.begin(ssid, pass); @@ -76,7 +76,7 @@ void setup() { } // you're connected now, so print out the data: - Serial5.print("You're connected to the network"); + SERIAL_PORT_MONITOR.print("You're connected to the network"); printCurrentNet(); printWifiData(); @@ -88,71 +88,71 @@ void loop() { printCurrentNet(); // Trying to connect to http://hasthelargehadroncolliderdestroyedtheworldyet.com/ - Serial5.println("Trying to connect to : www.hasthelargehadroncolliderdestroyedtheworldyet.com :"); + SERIAL_PORT_MONITOR.println("Trying to connect to : www.hasthelargehadroncolliderdestroyedtheworldyet.com :"); httpRequest(); while( client.available() ) { - Serial5.print((char)(client.read())); + SERIAL_PORT_MONITOR.print((char)(client.read())); } - Serial5.println("END"); + SERIAL_PORT_MONITOR.println("END"); } void printWifiData() { // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); - Serial5.print("IP Address: "); - Serial5.println(ip); - Serial5.println(ip); + SERIAL_PORT_MONITOR.print("IP Address: "); + SERIAL_PORT_MONITOR.println(ip); + SERIAL_PORT_MONITOR.println(ip); // print your MAC address: byte mac[6]; WiFi.macAddress(mac); - Serial5.print("MAC address: "); - Serial5.print(mac[5],HEX); - Serial5.print(":"); - Serial5.print(mac[4],HEX); - Serial5.print(":"); - Serial5.print(mac[3],HEX); - Serial5.print(":"); - Serial5.print(mac[2],HEX); - Serial5.print(":"); - Serial5.print(mac[1],HEX); - Serial5.print(":"); - Serial5.println(mac[0],HEX); + SERIAL_PORT_MONITOR.print("MAC address: "); + SERIAL_PORT_MONITOR.print(mac[5],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(mac[4],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(mac[3],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(mac[2],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(mac[1],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.println(mac[0],HEX); } void printCurrentNet() { // print the SSID of the network you're attached to: - Serial5.print("SSID: "); - Serial5.println(WiFi.SSID()); + SERIAL_PORT_MONITOR.print("SSID: "); + SERIAL_PORT_MONITOR.println(WiFi.SSID()); // print the MAC address of the router you're attached to: byte bssid[6]; WiFi.BSSID(bssid); - Serial5.print("BSSID: "); - Serial5.print(bssid[5],HEX); - Serial5.print(":"); - Serial5.print(bssid[4],HEX); - Serial5.print(":"); - Serial5.print(bssid[3],HEX); - Serial5.print(":"); - Serial5.print(bssid[2],HEX); - Serial5.print(":"); - Serial5.print(bssid[1],HEX); - Serial5.print(":"); - Serial5.println(bssid[0],HEX); + SERIAL_PORT_MONITOR.print("BSSID: "); + SERIAL_PORT_MONITOR.print(bssid[5],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(bssid[4],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(bssid[3],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(bssid[2],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.print(bssid[1],HEX); + SERIAL_PORT_MONITOR.print(":"); + SERIAL_PORT_MONITOR.println(bssid[0],HEX); // print the received signal strength: long rssi = WiFi.RSSI(); - Serial5.print("signal strength (RSSI):"); - Serial5.println(rssi); + SERIAL_PORT_MONITOR.print("signal strength (RSSI):"); + SERIAL_PORT_MONITOR.println(rssi); // print the encryption type: byte encryption = WiFi.encryptionType(); - Serial5.print("Encryption Type:"); - Serial5.println(encryption,HEX); - Serial5.println(); + SERIAL_PORT_MONITOR.print("Encryption Type:"); + SERIAL_PORT_MONITOR.println(encryption,HEX); + SERIAL_PORT_MONITOR.println(); } void httpRequest() { @@ -162,7 +162,7 @@ void httpRequest() { // if there's a successful connection: if (client.connect("www.hasthelargehadroncolliderdestroyedtheworldyet.com", 80)) { - Serial5.println("connecting..."); + SERIAL_PORT_MONITOR.println("connecting..."); // send the HTTP PUT request: client.println("GET / HTTP/1.1"); client.println("Host: www.hasthelargehadroncolliderdestroyedtheworldyet.com"); @@ -172,25 +172,25 @@ void httpRequest() { if( client.connected() ) { - Serial5.println("\tClient connected"); + SERIAL_PORT_MONITOR.println("\tClient connected"); while( client.available() == 0 ) { //Waiting for data if( !client.connected() ) { - Serial5.println("\tClient disconnected !"); + SERIAL_PORT_MONITOR.println("\tClient disconnected !"); break; } } } else { - Serial5.println("\tClient not connected"); + SERIAL_PORT_MONITOR.println("\tClient not connected"); } } else { // if you couldn't make a connection: - Serial5.println("\tconnection failed"); + SERIAL_PORT_MONITOR.println("\tconnection failed"); } } diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index 4b2a7dfddf778949970fd4e0a75efab5f7732a39..e17c8b4f877716426f5861988d3da4ebfa26464c 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -26,10 +26,10 @@ * | 1 | 1 <- TX | PA11 | | EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC1/WO[1] TCC0/WO[3] * | 2 | ~2 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2] * | 3 | ~3 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3] - * | 4 | ~4 | PA14 | | EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] *TCC0/WO[4] - * | 5 | ~5 | PA15 | | EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] TC3/WO[1] *TCC0/WO[5] - * | 6 | ~6 | PA20 | | EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TC7/WO[0] TCC0/WO[6] - * | 7 | ~7 | PA21 | | EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] *TC7/WO[1] TCC0/WO[7] + * | 4 | ~4 | PA14 | | EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] *TC3/WO[0] TCC0/WO[4] + * | 5 | ~5 | PA15 | | EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5] + * | 6 | ~6 | PA20 | | EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6] + * | 7 | ~7 | PA21 | | EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] *TCC0/WO[7] * +------------+------------------+--------+-----------------+------------------------------ * | | Digital High | | | * +------------+------------------+--------+-----------------+------------------------------ @@ -39,8 +39,14 @@ * | 11 | ~11 | PA16 | | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6] * | 12 | ~12 | PA19 | | EIC/EXTINT[3] PTC/X[7] SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3] * | 13 | ~13 | PA17 | LED | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7] + * +------------+------------------+--------+-----------------+------------------------------ + * | |Wire | | | + * +------------+------------------+--------+-----------------+------------------------------ * | 14 | GND | | | * | 15 | AREF | PA03 | | *DAC/VREFP PTC/Y[1] + * +------------+------------------+--------+-----------------+------------------------------ + * | | Wire | | | + * +------------+------------------+--------+-----------------+------------------------------ * | 16 | SDA | PA22 | | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] TC4/WO[0] TCC0/WO[4] * | 17 | SCL | PA23 | | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] TC4/WO[1] TCC0/WO[5] * +------------+------------------+--------+-----------------+------------------------------ @@ -60,7 +66,7 @@ * | 26 | A2 | PB09 | | EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1] * | 27 | A3 | PA04 | | EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0] * | 28 | A4 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1] - * | 29 | A5 | PB02 | | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] TC6/WO[0] + * | 29 | A5 | PB02 | | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] * +------------+------------------+--------+-----------------+------------------------------ * | | LEDs | | | * +------------+------------------+--------+-----------------+------------------------------ @@ -105,92 +111,89 @@ */ const PinDescription g_APinDescription[]= { - // 0 .. 19 - Digital pins + // 0..13 - Digital pins // ---------------------- // 0/1 - SERCOM/UART (Serial1) { PORTA, 10, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // RX: SERCOM0/PAD[2] { PORTA, 11, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // TX: SERCOM0/PAD[3] // 2..12 + // Digital Low { PORTA, 8, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI }, // TCC0/WO[0] { PORTA, 9, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // TCC0/WO[1] - { PORTA, 14, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH4, TCC0_CH4, EXTERNAL_INT_14 }, // TCC0/WO[4] - { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH5, TCC0_CH5, EXTERNAL_INT_15 }, // TCC0/WO[5] - { PORTA, 20, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM7_CH0, TC7_CH0, EXTERNAL_INT_4 }, // TC7/WO[0] - { PORTA, 21, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM7_CH1, TC7_CH1, EXTERNAL_INT_5 }, // TC7/WO[1] - { PORTA, 6, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_4 }, // TCC1/WO[0] - { PORTA, 7, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_5 }, // TCC1/WO[1] - { PORTA, 18, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_2 }, // TCC0/WO[2] + { PORTA, 14, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_14 }, // TC3/WO[0] + { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_15 }, // TC3/WO[1] + { PORTA, 20, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH6, TCC0_CH6, EXTERNAL_INT_4 }, // TC7/WO[0] + { PORTA, 21, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH7, TCC0_CH7, EXTERNAL_INT_5 }, // TC7/WO[1] + + // Digital High + { PORTA, 6, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_4 }, // TCC1/WO[0] + { PORTA, 7, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_5 }, // TCC1/WO[1] + { PORTA, 18, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_2 }, // TCC0/WO[2] { PORTA, 16, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // TCC2/WO[0] - { PORTA, 19, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_3 }, // TCC0/WO[3] + { PORTA, 19, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_3 }, // TCC0/WO[3] // 13 (LED) { PORTA, 17, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM2_CH1, NOT_ON_TIMER, EXTERNAL_INT_1 }, // TCC2/WO[1] - // 14 (GND) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, - - // 15 (AREF) - { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VREFP + // 14..19 - Analog pins + // -------------------- + { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[0] + { PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // ADC/AIN[2] + { PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // ADC/AIN[3] + { PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] + { PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] + { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel10, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[10] - // 16..17 I2C pins (SDA/SCL and also EDBG:SDA/SCL) + // 20..21 I2C pins (SDA/SCL and also EDBG:SDA/SCL) // ---------------------- { PORTA, 22, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] { PORTA, 23, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] - // 18..23 - SPI pins (ICSP:MISO,SCK,MOSI) + // 22..24 - SPI pins (ICSP:MISO,SCK,MOSI) // ---------------------- { PORTA, 12, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 }, // MISO: SERCOM4/PAD[0] - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // 5V0 - { PORTB, 11, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // SCK: SERCOM4/PAD[3] { PORTB, 10, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // MOSI: SERCOM4/PAD[2] - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RESET - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // GND - - // 24..29 - Analog pins - // -------------------- - { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[0] - { PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // ADC/AIN[2] - { PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // ADC/AIN[3] - { PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] - { PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] - { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel10, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[10] + { PORTB, 11, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // SCK: SERCOM4/PAD[3] - // 30..31 - RX/TX LEDS (PB03/PA27) + // 25..26 - RX/TX LEDS (PB03/PA27) // -------------------- { PORTB, 3, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as output only - { PORTA, 27, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as pure only + { PORTA, 27, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as output only - // 32..33 - USB + // 27..29 - USB // -------------------- { PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/SOF { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP - // 35 .. 46 - EDBG + // 30..41 - EDBG // ---------------------- - // 35/36 - EDBG/UART + // 30/31 - EDBG/UART { PORTB, 22, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2] { PORTB, 23, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3] - // 37/38 I2C (SDA/SCL and also EDBG:SDA/SCL) + // 32/33 I2C (SDA/SCL and also EDBG:SDA/SCL) { PORTA, 22, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDA: SERCOM3/PAD[0] { PORTA, 23, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCL: SERCOM3/PAD[1] - // 39 .. 42 - EDBG/SPI + // 34..37 - EDBG/SPI { PORTA, 19, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM1/PAD[3] { PORTA, 16, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MOSI: SERCOM1/PAD[0] { PORTA, 18, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: SERCOM1/PAD[2] { PORTA, 17, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCK: SERCOM1/PAD[1] - // 43 .. 46 - EDBG/Digital + // 38..41 - EDBG/Digital { PORTA, 13, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH5, NOT_ON_TIMER, EXTERNAL_INT_13 }, // EIC/EXTINT[13] *TCC2/WO[1] TCC0/WO[7] { PORTA, 21, PIO_PWM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH7, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 7 { PORTA, 6, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM1_CH0, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 8 { PORTA, 7, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM1_CH1, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 9 - // ---------------------- - // 47 - Alternate use of A0 (DAC output) + // 42 (AREF) + { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VREFP + + // ---------------------- + // 43 - Alternate use of A0 (DAC output) { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // DAC/VOUT } ; @@ -204,5 +207,5 @@ SERCOM sercom3( SERCOM3 ) ; SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; -Uart Serial( &sercom0, 0, 1 ) ; -Uart Serial5( &sercom5, 36, 35 ) ; +Uart Serial1( &sercom0, 0, 1 ) ; +Uart Serial( &sercom5, 36, 35 ) ; diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 2853525d0bf8a473435af0191bf2048b417b5f76..1466d2b643195bf529d512da58c18acba7f1ec24 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -41,7 +41,8 @@ #endif // __cplusplus #ifdef __cplusplus -extern "C"{ +extern "C" +{ #endif // __cplusplus /*---------------------------------------------------------------------------- @@ -50,8 +51,8 @@ extern "C"{ // Number of pins defined in PinDescription array #define PINS_COUNT (34u) -#define NUM_DIGITAL_PINS (19u) -#define NUM_ANALOG_INPUTS (5u) +#define NUM_DIGITAL_PINS (14u) +#define NUM_ANALOG_INPUTS (6u) #define NUM_ANALOG_OUTPUTS (1u) #define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) @@ -68,98 +69,65 @@ extern "C"{ // LEDs #define PIN_LED_13 (13u) -#define PIN_LED_RXL (30u) -#define PIN_LED_TXL (31u) +#define PIN_LED_RXL (25u) +#define PIN_LED_TXL (26u) #define PIN_LED PIN_LED_13 #define PIN_LED2 PIN_LED_RXL #define PIN_LED3 PIN_LED_TXL #define LED_BUILTIN PIN_LED_13 +/* + * Analog pins + */ +#define PIN_A0 (14ul) +#define PIN_A1 (15ul) +#define PIN_A2 (16ul) +#define PIN_A3 (17ul) +#define PIN_A4 (18ul) +#define PIN_A5 (19ul) + +static const uint8_t A0 = PIN_A0 ; +static const uint8_t A1 = PIN_A1 ; +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +#define ADC_RESOLUTION 12 + /* * SPI Interfaces */ #define SPI_INTERFACES_COUNT 1 -/* -#define SPI_INTERFACE SPI0 -#define SPI_INTERFACE_ID ID_SPI0 -#define SPI_CHANNELS_NUM 4 -#define PIN_SPI_SS0 (77u) -#define PIN_SPI_SS1 (87u) -#define PIN_SPI_SS2 (86u) -#define PIN_SPI_SS3 (78u) -*/ -#define PIN_SPI_MOSI (21u) -#define PIN_SPI_MISO (18u) -#define PIN_SPI_SCK (20u) -/* -#define BOARD_SPI_SS0 (10u) -#define BOARD_SPI_SS1 (4u) -#define BOARD_SPI_SS2 (52u) -#define BOARD_SPI_SS3 PIN_SPI_SS3 - -#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS3 - -#define BOARD_PIN_TO_SPI_PIN(x) \ - (x==BOARD_SPI_SS0 ? PIN_SPI_SS0 : \ - (x==BOARD_SPI_SS1 ? PIN_SPI_SS1 : \ - (x==BOARD_SPI_SS2 ? PIN_SPI_SS2 : PIN_SPI_SS3 ))) -#define BOARD_PIN_TO_SPI_CHANNEL(x) \ - (x==BOARD_SPI_SS0 ? 0 : \ - (x==BOARD_SPI_SS1 ? 1 : \ - (x==BOARD_SPI_SS2 ? 2 : 3))) - -static const uint8_t SS1 = BOARD_SPI_SS1; -static const uint8_t SS2 = BOARD_SPI_SS2; -static const uint8_t SS3 = BOARD_SPI_SS3;*/ -static const uint8_t SS = 14; //GND -static const uint8_t MOSI = PIN_SPI_MOSI; -static const uint8_t MISO = PIN_SPI_MISO; -static const uint8_t SCK = PIN_SPI_SCK; +#define PIN_SPI_MISO (22u) +#define PIN_SPI_MOSI (23u) +#define PIN_SPI_SCK (24u) +static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; /* * Wire Interfaces */ #define WIRE_INTERFACES_COUNT 1 -#define PIN_WIRE_SDA (16u) -#define PIN_WIRE_SCL (17u) +#define PIN_WIRE_SDA (20u) +#define PIN_WIRE_SCL (21u) /* -#define WIRE_INTERFACE TWI1 -#define WIRE_INTERFACE_ID ID_TWI1 -#define WIRE_ISR_HANDLER TWI1_Handler -#define WIRE_ISR_ID TWI1_IRQn +#define WIRE_INTERFACE SERCOM3 +#define WIRE_INTERFACE_ID +#define WIRE_ISR_HANDLER SERCOM3_Handler +#define WIRE_ISR_ID SERCOM3_IRQn */ -/* - * UART/USART Interfaces - */ -// Serial -//#define PINS_UART (81u) - -/* - * USB Interfaces - */ -//#define PINS_USB (85u) - -/* - * Analog pins - */ -static const uint8_t A0 = 24 ; -static const uint8_t A1 = 25 ; -static const uint8_t A2 = 26 ; -static const uint8_t A3 = 27 ; -static const uint8_t A4 = 28 ; -static const uint8_t A5 = 29 ; -#define ADC_RESOLUTION 12 - /* * DAC */ /* #define DACC_INTERFACE DACC -#define DACC_INTERFACE_ID ID_DACC +#define DACC_INTERFACE_ID #define DACC_RESOLUTION 12 #define DACC_ISR_HANDLER DACC_Handler #define DACC_ISR_ID DACC_IRQn @@ -211,7 +179,7 @@ extern SERCOM sercom4; extern SERCOM sercom5; extern Uart Serial; -extern Uart Serial5; +extern Uart Serial1; #endif @@ -233,12 +201,8 @@ extern Uart Serial5; #define SERIAL_PORT_MONITOR Serial5 #define SERIAL_PORT_USBVIRTUAL SerialUSB #define SERIAL_PORT_HARDWARE_OPEN Serial1 -#define SERIAL_PORT_HARDWARE_OPEN1 Serial2 -#define SERIAL_PORT_HARDWARE_OPEN2 Serial3 #define SERIAL_PORT_HARDWARE Serial #define SERIAL_PORT_HARDWARE1 Serial1 -#define SERIAL_PORT_HARDWARE2 Serial2 -#define SERIAL_PORT_HARDWARE3 Serial3 #endif /* _VARIANT_ARDUINO_ZERO_ */