git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2415 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
a15011815c
commit
2018975c3e
|
@ -46,7 +46,7 @@ static const ADCConversionGroup adcgrpcfg = {
|
||||||
ADC_GRP1_NUM_CHANNELS,
|
ADC_GRP1_NUM_CHANNELS,
|
||||||
adccb,
|
adccb,
|
||||||
0,
|
0,
|
||||||
ADC_CR2_EXTSEL_SWSTART | ADC_CR2_TSVREFE,
|
ADC_CR2_EXTSEL_SWSTART | ADC_CR2_TSVREFE | ADC_CR2_CONT,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
|
ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
|
||||||
|
@ -181,8 +181,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the ADC driver 1.
|
* Initializes the ADC driver 1.
|
||||||
|
* The pin PC0 on the port GPIOC is programmed as analog input.
|
||||||
*/
|
*/
|
||||||
adcStart(&ADCD1, &adccfg);
|
adcStart(&ADCD1, &adccfg);
|
||||||
|
palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the PWM driver 1, re-routes the TIM3 outputs, programs the
|
* Initializes the PWM driver 1, re-routes the TIM3 outputs, programs the
|
||||||
|
@ -206,7 +208,7 @@ int main(int argc, char **argv) {
|
||||||
* sleeping in a loop and check the button state.
|
* sleeping in a loop and check the button state.
|
||||||
*/
|
*/
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (palReadPad(IOPORT1, GPIOA_BUTTON))
|
if (palReadPad(GPIOA, GPIOA_BUTTON))
|
||||||
TestThread(&SD1);
|
TestThread(&SD1);
|
||||||
chThdSleepMilliseconds(500);
|
chThdSleepMilliseconds(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@ The demo runs on an ST STM32VL-Discovery board.
|
||||||
** The Demo **
|
** The Demo **
|
||||||
|
|
||||||
The demo shows how to use the ADC, PWM and SPI drivers using asynchronous
|
The demo shows how to use the ADC, PWM and SPI drivers using asynchronous
|
||||||
APIs. The ADC samples two channels and modulates the PWM using the sample
|
APIs. The ADC samples two channels (temperature sensor and PC0) and modulates
|
||||||
values. The sample data is also transmitted on the SPI port 1.
|
the PWM using the sampled values. The sample data is also transmitted on
|
||||||
|
the SPI port 1.
|
||||||
By pressing the button located on the board the test procedure is activated
|
By pressing the button located on the board the test procedure is activated
|
||||||
with output on the serial port COM1 (USART1).
|
with output on the serial port COM1 (USART1).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue