Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version: 1.0 Release Release License GPLv3

hal-avr-adc - AVR ADC Hardware Abstraction

Ask DeepWiki

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.

Features

  • ADC configuration for AVR devices.
  • ADC conversions for AVR devices.
  • Encapsulation of low-level register access.
  • Compact and reusable API for embedded projects.
  • Foundation for layered HAL architectures.

The hal-avr-adc library 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.

File Structure

File Structure

hal/
└── avr/
    └── adc/
        ├── adc.c
        └── adc.h

Downloads

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

Using with git clone

mkdir -p ./hal/avr
git clone https://github.com/0x007E/hal-avr-adc.git ./hal/avr
mv ./hal/avr/hal-avr-adc ./hal/avr/adc

Using as git submodule

git submodule add https://github.com/0x007E/hal-avr-adc.git ./hal/avr/adc

Programming

Additional 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) { }
}

Additional Information

Type Link Description
AVR-Series pdf Understanding ADC Parameters

R. GAECHTER