git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2527 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2010-12-24 20:49:28 +00:00
parent ebf1e0a604
commit ea76e46321
4 changed files with 11 additions and 16 deletions

View File

@ -56,12 +56,6 @@ static const ADCConversionGroup adcgrpcfg = {
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ0_N(ADC_CHANNEL_SENSOR) ADC_SQR3_SQ1_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ0_N(ADC_CHANNEL_SENSOR)
}; };
/*
* ADC configuration structure, empty for STM32, there is nothing to configure.
*/
static const ADCConfig adccfg = {
};
/* /*
* PWM configuration structure. * PWM configuration structure.
* Cyclic callback enabled, channels 3 and 4 enabled without callbacks, * Cyclic callback enabled, channels 3 and 4 enabled without callbacks,
@ -217,7 +211,7 @@ int main(void) {
* Initializes the ADC driver 1 and performs a conversion. * Initializes the ADC driver 1 and performs a conversion.
* The pin PC0 on the port GPIOC is programmed as analog input. * The pin PC0 on the port GPIOC is programmed as analog input.
*/ */
adcStart(&ADCD1, &adccfg); adcStart(&ADCD1, NULL);
palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG); palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG);
adcConvert(&ADCD1, &adcgrpcfg, samples, ADC_GRP1_BUF_DEPTH); adcConvert(&ADCD1, &adcgrpcfg, samples, ADC_GRP1_BUF_DEPTH);
@ -237,5 +231,4 @@ int main(void) {
TestThread(&SD1); TestThread(&SD1);
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
} }
return 0;
} }

View File

@ -211,6 +211,7 @@ typedef struct {
* @note It could be empty on some architectures. * @note It could be empty on some architectures.
*/ */
typedef struct { typedef struct {
uint32_t dummy;
} ADCConfig; } ADCConfig;
/** /**

View File

@ -105,7 +105,8 @@ PWMDriver PWMD5;
static void serve_interrupt(PWMDriver *pwmp) { static void serve_interrupt(PWMDriver *pwmp) {
uint16_t sr; uint16_t sr;
sr = pwmp->pd_tim->SR & pwmp->pd_tim->DIER; sr = pwmp->pd_tim->SR;
sr &= pwmp->pd_tim->DIER;
pwmp->pd_tim->SR = ~(TIM_SR_CC1IF | TIM_SR_CC2IF | TIM_SR_CC3IF | pwmp->pd_tim->SR = ~(TIM_SR_CC1IF | TIM_SR_CC2IF | TIM_SR_CC3IF |
TIM_SR_CC4IF | TIM_SR_UIF); TIM_SR_CC4IF | TIM_SR_UIF);
if ((sr & TIM_SR_CC1IF) != 0) if ((sr & TIM_SR_CC1IF) != 0)