COSA
An Object-Oriented Platform for Arduino Programming
VWI::Transmitter Class Reference

#include <VWI.hh>

Inheritance diagram for VWI::Transmitter:
Inheritance graph
Collaboration diagram for VWI::Transmitter:
Collaboration graph

Public Member Functions

 Transmitter (Board::DigitalPin pin, Codec *codec)
 
void begin ()
 
void end ()
 
bool is_active () const
 
int send (uint8_t dest, uint8_t port, const iovec_t *vec)
 
int send (uint8_t dest, uint8_t port, const void *buf, size_t len)
 

Private Types

enum  Direction { MSB_FIRST = 0, LSB_FIRST = 1 }
 

Private Member Functions

void _set () const
 
void _set (int value) const
 
void set () const
 
void set (int value) const
 
void high () const
 
void on () const
 
void _clear () const
 
void clear () const
 
void low () const
 
void off () const
 
void _toggle () const
 
void toggle () const
 
void _write (int value) const
 
void write (int value) const
 
void write (uint8_t value, OutputPin &clk, Direction order=MSB_FIRST) const
 
void write (uint16_t value, uint8_t bits, uint16_t us) const
 
OutputPinoperator<< (int value)
 
void pulse (uint16_t us) const
 
volatile uint8_t * PIN () const
 
volatile uint8_t * DDR () const
 
volatile uint8_t * PORT () const
 
uint8_t pin () const
 
bool is_set () const
 
bool is_high () const
 
bool is_on () const
 
bool is_clear () const
 
bool is_low () const
 
bool is_off () const
 
bool read () const
 
uint8_t read (OutputPin &clk, Direction order=MSB_FIRST) const
 
 operator bool () const
 
Pinoperator>> (uint8_t &var)
 
volatile uint8_t * PCIMR () const
 

Static Private Member Functions

static void mode (Board::DigitalPin pin, uint8_t initial=0)
 
static void toggle (Board::DigitalPin pin)
 
static void _write (Board::DigitalPin pin, uint8_t value)
 
static void write (Board::DigitalPin pin, int value)
 
static uint8_t MASK (uint8_t pin)
 
static volatile uint8_t * PIN (uint8_t pin)
 
static volatile uint8_t * DDR (uint8_t pin)
 
static volatile uint8_t * PORT (uint8_t pin)
 
static bool read (Board::DigitalPin pin)
 

Private Attributes

volatile uint8_t *const m_sfr
 
const uint8_t m_mask
 
const uint8_t m_pin
 

Friends

class Codec
 
void TIMER1_COMPA_vect (void)
 

Detailed Description

Internal Virtual Wire Transmitter.

Definition at line 336 of file VWI.hh.

Constructor & Destructor Documentation

VWI::Transmitter::Transmitter ( Board::DigitalPin  pin,
Codec codec 
)
inline

Construct VWI Transmitter instance connected to the given pin. Use given codec for encoding data.

Parameters
[in]pintransmitter input pin.
[in]codecfor transmitter.

Definition at line 344 of file VWI.hh.

Member Function Documentation

void VWI::Transmitter::begin ( )
inline

Start transmitter.

Definition at line 354 of file VWI.hh.

void VWI::Transmitter::end ( )
inline

Stop transmitter.

Definition at line 366 of file VWI.hh.

bool VWI::Transmitter::is_active ( ) const
inline

Returns the state of the transmitter.

Returns
true if the transmitter is active else false

Definition at line 376 of file VWI.hh.

int VWI::Transmitter::send ( uint8_t  dest,
uint8_t  port,
const iovec_t vec 
)

Send message using a null terminated io vector message. Returns almost immediately, and message will be sent at the right timing by interrupts. Message is gathered from elements in io vector. The total size of the io vector buffers must be less than PAYLOAD_MAX. Returns number of bytes transmitted or negative error code; EINVAL if the vector is NULL, EMSGSIZE if the total io vector size is larger that max payload,

Parameters
[in]destdestination network address.
[in]portdevice port (or message type).
[in]vecnull terminated io vector.
Returns
number of bytes transmitted or negative error code.

Definition at line 27 of file VWI_Transmitter.cpp.

int VWI::Transmitter::send ( uint8_t  dest,
uint8_t  port,
const void *  buf,
size_t  len 
)

Send a message with the given length. Returns almost immediately, and message will be sent at the right timing by interrupts. A command may be given in enhanced mode with addressing to allow identification of the message type. The message length (len) must be less than PAYLOAD_MAX.

Parameters
[in]destdestination network address.
[in]portdevice port (or message type).
[in]bufpointer to the data to transmit.
[in]lennumber of bytes to transmit.
Returns
number of bytes transmitted or negative error code.

Definition at line 92 of file VWI_Transmitter.cpp.

Friends And Related Function Documentation

friend class Codec
friend

Allow access of codec.

Definition at line 439 of file VWI.hh.

void TIMER1_COMPA_vect ( void  )
friend

Interrupt Service Routine.

Interrupt Service Routines.


The documentation for this class was generated from the following files: