Example #1
0
/*
  initialise ADC capture
 */
void adc_init(void)
{
    adc_lld_init();
    rccEnableADC1(true);

    /* set channels 4 and 5 for 28.5us sample time */
    ADC1->SMPR2 = ADC_SMPR2_SMP_AN4(ADC_SAMPLE_28P5) | ADC_SMPR2_SMP_AN5(ADC_SAMPLE_28P5);

    /* capture a single sample at a time */
    ADC1->SQR1 = 0;
    ADC1->SQR2 = 0;
}
Example #2
0
/**
 * @brief   ADC Driver initialization.
 * @note    This function is implicitly invoked by @p halInit(), there is
 *          no need to explicitly initialize the driver.
 *
 * @init
 */
void adcInit(void) {

  adc_lld_init();
}