Struct capsules_core::adc::AdcDedicated

source ·
pub struct AdcDedicated<'a, A: Adc<'a> + AdcHighSpeed<'a>> { /* private fields */ }
Expand description

ADC syscall driver, used by applications to interact with ADC. Not currently virtualized: does not share the ADC with other capsules and only one application can use it at a time. Supports continuous and high speed sampling.

Implementations§

source§

impl<'a, A: Adc<'a> + AdcHighSpeed<'a>> AdcDedicated<'a, A>

source

pub fn new( adc: &'a A, grant: Grant<App, UpcallCount<1>, AllowRoCount<0>, AllowRwCount<2>>, channels: &'a [<A as Adc<'a>>::Channel], adc_buf1: &'static mut [u16; 128], adc_buf2: &'static mut [u16; 128], adc_buf3: &'static mut [u16; 128] ) -> AdcDedicated<'a, A>

Create a new Adc application interface.

  • adc - ADC driver to provide application access to
  • channels - list of ADC channels usable by applications
  • adc_buf1 - buffer used to hold ADC samples
  • adc_buf2 - second buffer used when continuously sampling ADC

Trait Implementations§

source§

impl<'a, A: Adc<'a> + AdcHighSpeed<'a>> Client for AdcDedicated<'a, A>

Callbacks from the ADC driver

source§

fn sample_ready(&self, sample: u16)

Single sample operation complete.

Collects the sample and provides a callback to the application.

  • sample - analog sample value
source§

impl<'a, A: Adc<'a> + AdcHighSpeed<'a>> HighSpeedClient for AdcDedicated<'a, A>

Callbacks from the High Speed ADC driver

source§

fn samples_ready(&self, buf: &'static mut [u16], length: usize)

Internal buffer has filled from a buffered sampling operation. Copies data over to application buffer, determines if more data is needed, and performs a callback to the application if ready. If continuously sampling, also swaps application buffers and continues sampling when necessary. If only filling a single buffer, stops sampling operation when the application buffer is full.

  • buf - internal buffer filled with analog samples
  • length - number of valid samples in the buffer, guaranteed to be less than or equal to buffer length
source§

impl<'a, A: Adc<'a> + AdcHighSpeed<'a>> SyscallDriver for AdcDedicated<'a, A>

Implementations of application syscalls

source§

fn command( &self, command_num: usize, channel: usize, frequency: usize, processid: ProcessId ) -> CommandReturn

Method for the application to command or query this driver.

  • command_num - which command call this is
  • data - value sent by the application, varying uses
  • _processid - application identifier, unused
source§

fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>

Request to allocate a capsule’s grant for a specific process. Read more
source§

fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>

System call for a process to pass a buffer (a UserspaceReadableProcessBuffer) to the kernel that the kernel can either read or write. The kernel calls this method only after it checks that the entire buffer is within memory the process can both read and write. Read more

Auto Trait Implementations§

§

impl<'a, A> !Freeze for AdcDedicated<'a, A>

§

impl<'a, A> !RefUnwindSafe for AdcDedicated<'a, A>

§

impl<'a, A> !Send for AdcDedicated<'a, A>

§

impl<'a, A> !Sync for AdcDedicated<'a, A>

§

impl<'a, A> Unpin for AdcDedicated<'a, A>

§

impl<'a, A> !UnwindSafe for AdcDedicated<'a, A>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.