class::hal::Adc

class hal::Adc
  : public hal::Periph< adc_info_t, adc_attr_t, AdcAttributes, ADC_IOC_IDENT_CHAR >

This class implements ADC device peripherals.

#include <sapi/hal.hpp>

int main(int argc, char * argv[]){
   Adc adc(0);  //create an instance of ADC to access port 0
   u32 samples[16];
   adc.init(); //initialize the ADC using the default configuration
   adc.read(0, samples, 16*sizeof(u32)); //read 16 samples from channel 0
   adc.read(1, samples, 16*sizeof(u32)); //read 16 samples from channel 1
   adc.close(); //close the ADC
}

Summary

Adc(

port_t port
)

AdcInfo get_info() const

enum adc_flags

Members

Adc(

port_t port
)

Initializes the object with port.


AdcInfo get_info() const

Returns an AdcInfo object associated with the ADC.


enum adc_flags
  • SET_CONVERTER See ADC_FLAG_SET_CONVERTER
  • IS_LEFT_JUSTIFIED See ADC_FLAG_IS_LEFT_JUSTIFIED
  • IS_RIGHT_JUSTIFIED Set to specify right justified data
  • SET_MASTER
  • SET_SLAVE
  • IS_TRIGGER_TMR
  • IS_TRIGGER_EINT
  • SET_CHANNELS
  • IS_SCAN_MODE
  • IS_TRIGGER_EINT_EDGE_RISING Trigger the sample on the rising edge
  • IS_TRIGGER_EINT_EDGE_FALLING Trigger the sample on the falling edge
  • IS_GROUP Set channel as part of a group
  • IS_CONTINOUS_CONVERSION Start the next conversion as soon as the previous conversion completes

X

Thanks for Coming!

Subscribe to news and updates