mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
[SAM] Test app working on SAM3X-EK
This commit is contained in:
parent
fc82f1e556
commit
1d99429752
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
See the GNU Lesser General Public License for more details.
|
See the GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
@ -175,8 +175,8 @@ typedef struct _PinDescription
|
|||||||
EPioType ulPinType ;
|
EPioType ulPinType ;
|
||||||
uint32_t ulPinConfiguration ;
|
uint32_t ulPinConfiguration ;
|
||||||
uint32_t ulPinAttribute ;
|
uint32_t ulPinAttribute ;
|
||||||
EAnalogChannel ulAnalogChannel ; /* Describe which Analog pin is linked to a MCU pin */
|
EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
|
||||||
EAnalogChannel ulADCChannelNumber ; /* We use the same enum than for ADC pins to describe the ADC channel in use on this pin */
|
EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
|
||||||
EPWMChannel ulPWMChannel ;
|
EPWMChannel ulPWMChannel ;
|
||||||
ETCChannel ulTCChannel ;
|
ETCChannel ulTCChannel ;
|
||||||
} PinDescription ;
|
} PinDescription ;
|
||||||
|
@ -85,7 +85,7 @@ void loop( void )
|
|||||||
// Serial1.write( "test1\n" ) ; // send a string
|
// Serial1.write( "test1\n" ) ; // send a string
|
||||||
// Serial1.write( "test2" ) ; // send another string
|
// Serial1.write( "test2" ) ; // send another string
|
||||||
|
|
||||||
Serial1.print("Analog ins: ");
|
Serial1.print("Analog pins: ");
|
||||||
for (int i=A0; i<=MAX_ANALOG; i++) {
|
for (int i=A0; i<=MAX_ANALOG; i++) {
|
||||||
int a = analogRead(i);
|
int a = analogRead(i);
|
||||||
Serial1.print(a, DEC);
|
Serial1.print(a, DEC);
|
||||||
|
@ -70,7 +70,7 @@ extern const PinDescription g_APinDescription[]=
|
|||||||
|
|
||||||
// 10 - Analog pins
|
// 10 - Analog pins
|
||||||
// ----------------------
|
// ----------------------
|
||||||
{ PIOA, PIO_PA3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NO_PWM, NO_TC }, // AD0
|
{ PIOA, PIO_PA3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC1, NO_PWM, NO_TC }, // AD0
|
||||||
|
|
||||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NO_PWM, NO_TC } // END
|
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NO_PWM, NO_TC } // END
|
||||||
} ;
|
} ;
|
||||||
@ -109,9 +109,6 @@ void USART0_Handler( void )
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Should be made in a better way...
|
|
||||||
extern void analogOutputInit(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -148,6 +145,18 @@ extern void init( void )
|
|||||||
g_APinDescription[PIN_LED_RED].ulPinConfiguration ) ;
|
g_APinDescription[PIN_LED_RED].ulPinConfiguration ) ;
|
||||||
|
|
||||||
PIO_Clear( g_APinDescription[PIN_LED_RED].pPort, g_APinDescription[PIN_LED_RED].ulPin ) ;
|
PIO_Clear( g_APinDescription[PIN_LED_RED].pPort, g_APinDescription[PIN_LED_RED].ulPin ) ;
|
||||||
|
|
||||||
|
// Initialize 10bit Analog Controller
|
||||||
|
pmc_enable_periph_clk( ID_ADC ) ;
|
||||||
|
adc_init( ADC, SystemCoreClock, ADC_FREQ_MAX, ADC_STARTUP_FAST ) ;
|
||||||
|
adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);
|
||||||
|
adc_configure_trigger(ADC, ADC_TRIG_SW, 0); // Disable hardware trigger.
|
||||||
|
adc_disable_interrupt( ADC, 0xFFFFFFFF ) ; // Disable all ADC interrupts.
|
||||||
|
adc_disable_all_channel( ADC ) ;
|
||||||
|
|
||||||
|
// Initialize analogOutput module
|
||||||
|
analogOutputInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user