Version: v0.0.0-...-f612f80 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2015 License: Apache-2.0 Imports: 2 Imported by: 0




View Source
const (
	/// Maximum number of bytes in a message, counting the byte count and FCS

	/// Number of samples per bit

	/// The maximum payload length

	/// The size of the receiver ramp. Ramp wraps modulo this number

	// Ramp adjustment parameters
	// Standard is if a transition occurs before VW_RAMP_TRANSITION (80) in the ramp,
	// the ramp is retarded by adding VW_RAMP_INC_RETARD (11)
	// else by adding VW_RAMP_INC_ADVANCE (29)
	// If there is no transition it is adjusted by VW_RAMP_INC (20)
	/// Internal ramp adjustment parameter
	/// Internal ramp adjustment parameter
	/// Internal ramp adjustment parameter
	/// Internal ramp adjustment parameter
	/// Internal ramp adjustment parameter

	/// Outgoing message bits grouped as 6-bit words
	/// 36 alternating 1/0 bits, followed by 12 bits of start symbol
	/// Followed immediately by the 4-6 bit encoded byte count,
	/// message buffer and 2 byte FCS
	/// Each byte from the byte count on is translated into 2x6-bit words
	/// Caution, each symbol is transmitted LSBit first,
	/// but each byte is transmitted high nybble first


This section is empty.


This section is empty.


type VirtualWire

type VirtualWire struct {
	// contains filtered or unexported fields

func NewVirtualWire

func NewVirtualWire(pins ...byte) *VirtualWire

func (*VirtualWire) ActiveTx

func (vw *VirtualWire) ActiveTx() bool

/ Returns the state of the / transmitter / \return true if the transmitter is active else false

func (*VirtualWire) GetMessage

func (vw *VirtualWire) GetMessage() ([]byte, error)

/ If a message is available (good checksum or not), copies / up to *len octets to buf.

func (*VirtualWire) GetRxBad

func (vw *VirtualWire) GetRxBad() byte

/ Returns the count of bad messages received, ie / messages with bogus lengths, indicating corruption / or lost octets. / Caution,: this is an 8 bit count and can easily overflow / \return Count of bad messages received

func (*VirtualWire) GetRxGood

func (vw *VirtualWire) GetRxGood() byte

/ Returns the count of good messages received / Caution,: this is an 8 bit count and can easily overflow / \return Count of good messages received

func (*VirtualWire) HaveMessage

func (vw *VirtualWire) HaveMessage() bool

/ Returns true if an unread message is available / \return true if a message is available to read

func (*VirtualWire) Send

func (vw *VirtualWire) Send(buf []byte) error

/ Send a message with the given length. Returns almost immediately, / and message will be sent at the right timing by interrupts / \param[in] buf slice of the data to transmit / \return true if the message was accepted for transmission, false if the message is too long (>VW_MAX_MESSAGE_LEN - 3)

func (*VirtualWire) SetPttInverted

func (vw *VirtualWire) SetPttInverted(inverted bool)

/ By default the PTT pin goes high when the transmitter is enabled. / This flag forces it low when the transmitter is enabled. / \param[in] inverted True to invert PTT

func (*VirtualWire) SetRxInverted

func (vw *VirtualWire) SetRxInverted(inverted bool)

/ By default the RX pin is expected to be low when idle, and to pulse high / for each data pulse. / This flag forces it to be inverted. This may be necessary if your transport medium / inverts the logic of your signal, such as happens with some types of A/V tramsmitter. / \param[in] inverted True to invert sense of receiver input

func (*VirtualWire) SetSpeed

func (vw *VirtualWire) SetSpeed(speed uint16)

/ Set vw to operate at speed bits per second / Must call StartRx() before you will get any messages / \param[in] speed Desired speed in bits per second

func (*VirtualWire) StartRx

func (vw *VirtualWire) StartRx()

/ Start the Phase Locked Loop listening to the receiver / Must do this before you can receive any messages / When a message is available (good checksum or not), HaveMessage() / will return true.

func (*VirtualWire) StartTx

func (vw *VirtualWire) StartTx()

func (*VirtualWire) StopRx

func (vw *VirtualWire) StopRx()

/ Stop the Phase Locked Loop listening to the receiver / No messages will be received until StartRx() is called again / Saves interrupt processing cycles

func (*VirtualWire) StopTx

func (vw *VirtualWire) StopTx()

func (*VirtualWire) WaitRx

func (vw *VirtualWire) WaitRx()

/ Block until a message is available / then returns

func (*VirtualWire) WaitRxMax

func (vw *VirtualWire) WaitRxMax(milliseconds int64) bool

/ Block until a message is available or for a max time / \param[in] milliseconds Maximum time to wait in milliseconds. / \return true if a message is available, false if the wait timed out.

func (*VirtualWire) WaitTx

func (vw *VirtualWire) WaitTx()

/ Block until the transmitter is idle / then returns

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL