Mark Uckermann / NbAnalogIn
Embed: (wiki syntax)

« Back to documentation index

NbAnalogIn Class Reference

NbAnalogIn Class Reference

Library for non blocking ADC operation. More...

#include <NbAnalogIn.h>

Public Member Functions

 NbAnalogIn (PinName pin)
 Create a NbAnalogIn object, sets up ADC.
void setInterrupt (void(*irqfunc)()=0, int prio=-1)
 Set interrupt options.
int readBl ()
 does a single blocking read and returns a 12 bit output
void triggerConv (bool wait=false)
 starts a conversion and sets the interrupt to fire when ADC is finished the result will be put into the internal buffer
bool readable ()
 checks if the buffer has new results that can be read
int read ()
 returns the next value from the buffer
 operator int ()
 An operator shorthand for read()

Detailed Description

Library for non blocking ADC operation.

Definition at line 13 of file NbAnalogIn.h.


Constructor & Destructor Documentation

NbAnalogIn ( PinName  pin )

Create a NbAnalogIn object, sets up ADC.

Parameters:
pinAnalogIn pin to connect to

Definition at line 29 of file NbAnalogIn.cpp.


Member Function Documentation

operator int (  )

An operator shorthand for read()

Definition at line 58 of file NbAnalogIn.h.

int read (  )

returns the next value from the buffer

Definition at line 152 of file NbAnalogIn.cpp.

bool readable (  )

checks if the buffer has new results that can be read

Definition at line 148 of file NbAnalogIn.cpp.

int readBl (  )

does a single blocking read and returns a 12 bit output

Definition at line 76 of file NbAnalogIn.cpp.

void setInterrupt ( void(*)()  irqfunc = 0,
int  prio = -1 
)

Set interrupt options.

Parameters:
irqfunc- callback function executed at the end of interrupts
priority- set interrupt priority level. -1 (default) leaves them unchanged

Definition at line 68 of file NbAnalogIn.cpp.

void triggerConv ( bool  wait = false )

starts a conversion and sets the interrupt to fire when ADC is finished the result will be put into the internal buffer

Parameters:
wait- If true, wait for current adc conversion to finish, if false (default), stop the current conversion replace it

Definition at line 94 of file NbAnalogIn.cpp.