Expand description
Syscall driver capsules for ADC sampling.
This module has two ADC syscall driver capsule implementations.
The first, called AdcDedicated, assumes that it has complete (dedicated) control of the kernel ADC. This capsule provides userspace with the ability to perform single, continuous, and high speed samples. However, using this capsule means that no other capsule or kernel service can use the ADC. It also allows only a single process to use the ADC: other processes will receive NOMEM errors.
The second, called AdcVirtualized, sits top of an ADC virtualizer. This capsule shares the ADC with the rest of the kernel through this virtualizer, so allows other kernel services and capsules to use the ADC. It also supports multiple processes requesting ADC samples concurrently. However, it only supports processes requesting single ADC samples: they cannot sample continuously or at high speed.
§Usage
let adc_channels = static_init!(
[&'static sam4l::adc::AdcChannel; 6],
[
&sam4l::adc::CHANNEL_AD0, // A0
&sam4l::adc::CHANNEL_AD1, // A1
&sam4l::adc::CHANNEL_AD3, // A2
&sam4l::adc::CHANNEL_AD4, // A3
&sam4l::adc::CHANNEL_AD5, // A4
&sam4l::adc::CHANNEL_AD6, // A5
]
);
let adc = static_init!(
capsules_core::adc::AdcDedicated<'static, sam4l::adc::Adc>,
capsules_core::adc::AdcDedicated::new(
&mut sam4l::adc::ADC0,
adc_channels,
&mut capsules_core::adc::ADC_BUFFER1,
&mut capsules_core::adc::ADC_BUFFER2,
&mut capsules_core::adc::ADC_BUFFER3
)
);
sam4l::adc::ADC0.set_client(adc);
Structs§
- ADC syscall driver, used by applications to interact with ADC.
- Multiplexed ADC syscall driver, used by applications and capsules.
- Holds buffers that the application has passed us
Constants§
- Buffers to use for DMA transfers.