Skip to content

hugllc/samc21_adc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Main Page

Introduction

This library is for using the ADC and SDADC on the SAMC21 mpu using the Arduino or PlatformIO build environments.

Requirements

SAMC support is still not in the mainline samd (Arduino or platformio). SAMC support is available for Arduino here:

https://github.com/prices/ArduinoCore-samd

For platformio it is available here:

https://github.com/prices/platform-atmelsam

Using the Library

Platformio

Installing

platformio platform install https://github.com/prices/platform-atmelsam

platformio.ini Example

[platformio]
env_default = samc21

[env:samc21]
platform = atmelsam
framework = arduino
board = samc21_xpro

lib_deps = https://github.com/hugllc/samc21_adc.git

Code

This will print out new readings very fast:

#include <samc21_adc.h>

SAMC21_ADC adc(ADC0);

void setup()
{
    adc.begin();
    adc.freerun(SAMC21_ADC_MUXPOS_3);

}

void loop()
{
    int32_t adc_read;
    if (adc.newReading()) {
        adc_read = adc.value();
        Serial.print("ADC: ");
        Serial.print(adc_read);
        Serial.println();
    }
    
}

Acknowledgements

Little bits of code (generally single lines) here and there were copied from the Arduino core.

About

ADC class for dealing with the SAMC21.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages