porklib: Simple library for programming Arduino in C
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#pragma once
|
|
|
|
|
|
|
|
//
|
|
|
|
// Utilities for build-in A/D converter
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/** Initialize the ADC */
|
|
|
|
void adc_init();
|
|
|
|
|
|
|
|
/** Disable AD (for power saving?) */
|
|
|
|
void adc_disable();
|
|
|
|
|
|
|
|
/** Sample analog pin with 8-bit precision */
|
|
|
|
uint8_t adc_read_byte(uint8_t channel);
|
|
|
|
|
|
|
|
/** Sample analog pin with 10-bit precision */
|
|
|
|
uint16_t adc_read_word(uint8_t channel);
|