|
HWA
Bare metal programming with style
|
This class is used by:
adc0(adc0,irq): conversion completed
hwa( configure, ... ) configures the ADC.
Single-end mode:
The differential mode allows the use of the 20x gain stage:
acmp0 can not use the analog multiplexer output. Use hw(disable,adc0) to disable the ADC and let acmp0 use the analog multiplexer output.
hw( enable, ... ) / hwa( enable, ... ) enables the ADC.
hw( disable, ... ) / hwa( disable, ... ) disables the ADC.
hw( trigger, ... ) / hwa( trigger, ... ) starts a conversion.
hw( read, ... ) returns the result of the conversion.
hw( read_atomic, ... ) returns the result of the conversion after having cleared the I bit of the status register and set it again as soon as possible.
hw( stat, ... ) returns the status of the ADC, that contains a single 'busy' bit.
You'll use the IRQ flag to test whether a conversion is completed:
Hardware registers:
admux: analog multiplexer and voltage referencesra: control/status register asrb: control/status register badc: conversion resultLogical registers:
refs: voltage referencemux: analog multiplexeren: enablesc: start conversionate: auto trigger enableps: clock prescalerbin: bipolar input modelar: left-aligned resultts: trigger sourceie: conversion done IRQ maskif: conversion done IRQ flag