The hal-avr-adc is a lightweight hardware abstraction library for AVR microcontrollers. It provides a clean interface for adc initialization and conversions while hiding direct register-level interaction from higher software layers. The library is intended for projects that want to separate low-level device startup code from application logic and establish a small, reusable system layer for AVR targets.
ADCconfiguration for AVR devices.ADCconversions for AVR devices.- Encapsulation of low-level register access.
- Compact and reusable API for embedded projects.
- Foundation for layered HAL architectures.
The
hal-avr-adclibrary reduces coupling by providing a focused interface for essential system services. This improves portability inside a project, keeps startup code organized, and makes higher-level modules easier to maintain.
hal/
└── avr/
└── adc/
├── adc.c
└── adc.h
The library can be downloaded (zip or tar), cloned or used as submodule in a project.
| Type | File | Description |
|---|---|---|
| Library | zip / tar | AVR adc library |
mkdir -p ./hal/avr
git clone https://github.com/0x007E/hal-avr-adc.git ./hal/avr
mv ./hal/avr/hal-avr-adc ./hal/avr/adcgit submodule add https://github.com/0x007E/hal-avr-adc.git ./hal/avr/adcAdditional parameters like adc clock prescaler, sampling and many more can be setup in the header file. A user friendly description can be found here.
#include "../hal/avr/adc/adc.h"
int main(void)
{
adc_init();
adc_channel(ADC_CH0);
// Reading adc data
unsigned int data = adc_read();
// Reading adc data (with software sampling/accumulation)
unsigned int accu = adc_average(10);
while(1) { }
}| Type | Link | Description |
|---|---|---|
| AVR-Series | Understanding ADC Parameters |
R. GAECHTER
