1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-29 18:52:13 +01:00

Fixed pull-up.

This commit is contained in:
Cristian Maglie 2012-10-09 16:43:38 +02:00
parent 74c2705aff
commit b2f1bce2ac
3 changed files with 92 additions and 97 deletions

View File

@ -80,7 +80,7 @@ extern void digitalWrite( uint32_t ulPin, uint32_t ulVal )
if ( PIO_GetOutputDataStatus( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin ) == 0 ) if ( PIO_GetOutputDataStatus( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin ) == 0 )
{ {
PIO_PullUp( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, 1 ) ; PIO_PullUp( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal ) ;
} }
else else
{ {

View File

@ -19,106 +19,97 @@
#include "variant.h" #include "variant.h"
/* /*
* DUE Board pin | PORT * DUE Board pin | PORT | Label
* ----------------+-------- * ----------------+--------+-------
* 0 RX0 | PA8 * 0 | PA8 | "RX0"
* 1 TX0 | PA9 * 1 | PA9 | "TX0"
* 2 TIOA0 | PB25 * 2 TIOA0 | PB25 |
* 3 TIOA7 | PC28 * 3 TIOA7 | PC28 |
* 4 NPCS1 | PA29 * 4 NPCS1 | PA29 |
* TIOB6 | PC26 * TIOB6 | PC26 |
* 5 TIOA6 | PC25 * 5 TIOA6 | PC25 |
* 6 PWML7 | PC24 * 6 PWML7 | PC24 |
* 7 PWML6 | PC23 * 7 PWML6 | PC23 |
* 8 PWML5 | PC22 * 8 PWML5 | PC22 |
* 9 PWML4 | PC21 * 9 PWML4 | PC21 |
* 10 NPCS0 | PA28 * 10 NPCS0 | PA28 |
* TIOB7 | PC29 * TIOB7 | PC29 |
* 11 TIOA8 | PD7 * 11 TIOA8 | PD7 |
* 12 TIOB8 | PD8 * 12 TIOB8 | PD8 |
* 13 TIOB0 | PB27 * 13 TIOB0 | PB27 | LED AMBER "L"
* 14 TX3 TXD3 | PD4 * 14 TXD3 | PD4 | "TX3"
* 15 RX3 RXD3 | PD5 * 15 RXD3 | PD5 | "RX3"
* 16 TX2 TXD1 | PA13 * 16 TXD1 | PA13 | "TX2"
* 17 RX2 RXD1 | PA12 * 17 RXD1 | PA12 | "RX2"
* 18 TX1 TXD0 | PA11 * 18 TXD0 | PA11 | "TX1"
* 19 RX1 RXD0 | PA10 * 19 RXD0 | PA10 | "RX1"
* 20 SDA | PB12 (this pin is level adapted to 5V) * 20 | PB12 | "SDA"
* 21 SCL | PB13 (this pin is level adapted to 5V) * 21 | PB13 | "SCL"
* 22 | PB26 * 22 | PB26 |
* 23 | PA14 * 23 | PA14 |
* 24 | PA15 * 24 | PA15 |
* 25 | PD0 * 25 | PD0 |
* 26 | PD1 * 26 | PD1 |
* 27 | PD2 * 27 | PD2 |
* 28 | PD3 * 28 | PD3 |
* 29 | PD6 * 29 | PD6 |
* 30 | PD9 * 30 | PD9 |
* 31 | PA7 * 31 | PA7 |
* 32 | PD10 * 32 | PD10 |
* 33 | PC1 * 33 | PC1 |
* 34 | PC2 * 34 | PC2 |
* 35 | PC3 * 35 | PC3 |
* 36 | PC4 * 36 | PC4 |
* 37 | PC5 * 37 | PC5 |
* 38 | PC6 * 38 | PC6 |
* 39 | PC7 * 39 | PC7 |
* 40 | PC8 * 40 | PC8 |
* 41 | PC9 * 41 | PC9 |
* 42 | PA19 * 42 | PA19 |
* 43 | PA20 * 43 | PA20 |
* 44 | PC19 * 44 | PC19 |
* 45 | PC18 * 45 | PC18 |
* 46 | PC17 * 46 | PC17 |
* 47 | PC16 * 47 | PC16 |
* 48 | PC15 * 48 | PC15 |
* 49 | PC14 * 49 | PC14 |
* 50 | PC13 * 50 | PC13 |
* 51 | PC12 * 51 | PC12 |
* 52 NPCS2 | PB21 * 52 NPCS2 | PB21 |
* 53 | PB14 * 53 | PB14 |
* A0 | PA16 * 54 | PA16 | "A0"
* A1 | PA24 * 55 | PA24 | "A1"
* A2 | PA23 * 56 | PA23 | "A2"
* A3 | PA22 * 57 | PA22 | "A3"
* A4 TIOB2 | PA6 * 58 TIOB2 | PA6 | "A4"
* A5 | PA4 * 69 | PA4 | "A5"
* A6 TIOB1 | PA3 * 60 TIOB1 | PA3 | "A6"
* A7 TIOA1 | PA2 * 61 TIOA1 | PA2 | "A7"
* A8 | PB17 * 62 | PB17 | "A8"
* A9 | PB18 * 63 | PB18 | "A9"
* A10 | PB19 * 64 | PB19 | "A10"
* A11 | PB20 * 65 | PB20 | "A11"
* A12 | PB15 * 66 | PB15 | "DAC0"
* A13 | PB16 * 67 | PB16 | "DAC1"
* A14 | PA1 * 68 | PA1 | "CANRX"
* A15 | PA0 * 69 | PA0 | "CANTX"
* SDA1 | PA17 * 70 | PA17 | "SDA1"
* SCL1 | PA18 * 71 | PA18 | "SCL1"
* * 72 | PC30 | LED AMBER "RX"
* * 73 | PA21 | LED AMBER "TX"
* AT45DB021 pin | PORT * 74 MISO | PA25 |
* ----------------+-------- * 75 MOSI | PA26 |
* SO | PA25 * 76 SCLK | PA27 |
* SI | PA26 * 77 NPCS0 | PA28 |
* SCK | PA27 * 78 NPCS3 | PB23 | unconnected!
* #CS NPCS3 | PB23
*
* *
* USB pin | PORT * USB pin | PORT
* ----------------+-------- * ----------------+--------
* ID | PB11 * ID | PB11
* VBOF | PB10 * VBOF | PB10
* *
*
* LEDs | PORT
* ----------------+--------
* "TX" | PA21
* "RX" | PC30
* "L" | PB27
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -256,7 +247,7 @@ extern const PinDescription g_APinDescription[]=
// 77 - SPI CS0 // 77 - SPI CS0
{ PIOA, PIO_PA28A_SPI0_NPCS0,ID_PIOA,PIO_PERIPH_A,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS0 { PIOA, PIO_PA28A_SPI0_NPCS0,ID_PIOA,PIO_PERIPH_A,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS0
// 78 - SPI CS3 (chip select for onboard AT45DB021) // 78 - SPI CS3 (unconnected)
{ PIOB, PIO_PB23B_SPI0_NPCS3,ID_PIOB,PIO_PERIPH_B,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS3 { PIOB, PIO_PB23B_SPI0_NPCS3,ID_PIOB,PIO_PERIPH_B,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS3
// 79 .. 84 - "All pins" masks // 79 .. 84 - "All pins" masks
@ -357,6 +348,10 @@ void init( void )
// Initialize C library // Initialize C library
__libc_init_array(); __libc_init_array();
// Disable pull-up on every pin
for (int i = 0; i < PINS_COUNT; i++)
digitalWrite(i, LOW);
// Initialize Serial port UART, common to all SAM3 variants // Initialize Serial port UART, common to all SAM3 variants
PIO_Configure( PIO_Configure(
g_APinDescription[PINS_UART].pPort, g_APinDescription[PINS_UART].pPort,

View File

@ -62,7 +62,7 @@ extern "C"{
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
// Number of pins defined in PinDescription array // Number of pins defined in PinDescription array
#define PINS_COUNT (88u) #define PINS_COUNT (79u)
// LEDs // LEDs
#define PIN_LED_13 (13u) #define PIN_LED_13 (13u)
@ -158,8 +158,8 @@ static const uint8_t A10 = 64;
static const uint8_t A11 = 65; static const uint8_t A11 = 65;
static const uint8_t DAC0 = 66; static const uint8_t DAC0 = 66;
static const uint8_t DAC1 = 67; static const uint8_t DAC1 = 67;
static const uint8_t CANRX0 = 68; static const uint8_t CANRX = 68;
static const uint8_t CANTX0 = 69; static const uint8_t CANTX = 69;
#define ADC_RESOLUTION 12 #define ADC_RESOLUTION 12
/* /*