One Pin Comms Link 1.0
One Pin Serial comms link layer implemented in software only
MD_OnePin Class Reference

#include <MD_OnePin.h>

Public Types

typedef opPriPacket_t packet_t
 The Primary side comms packet. Defined as max size to fit all supported types.
 

Public Member Functions

Class constructor and destructor.
 MD_OnePin (uint8_t pin, uint8_t bppPri=BPP_PRI, uint8_t bppSec=BPP_SEC)
 
 ~MD_OnePin ()
 
Methods for core object control.
void begin (void)
 
bool write (packet_t data, bool noReset=false)
 
packet_t read (bool noReset=false)
 
bool isPresent (void)
 

Detailed Description

Core object for the MD_OnePin library

Constructor & Destructor Documentation

◆ MD_OnePin()

MD_OnePin::MD_OnePin ( uint8_t  pin,
uint8_t  bppPri = BPP_PRI,
uint8_t  bppSec = BPP_SEC 
)

Class Constructor

Instantiate a new instance of the class.

The main function for the core object is to set the internal shared variables to default or passed values.

Parameters
pinpin used for OnePin comms.
bppPrithe number of bits per packet (bpp) sent by PRI
bppSecthe number of bits per packet (bpp) received from SEC

◆ ~MD_OnePin()

MD_OnePin::~MD_OnePin ( )

Class Destructor.

Release any allocated memory and clean up anything else.

Member Function Documentation

◆ begin()

void MD_OnePin::begin ( void  )

Initialize the object.

Initialize the object data. This needs to be called during setup() to set items that cannot be done during object creation.

◆ isPresent()

bool MD_OnePin::isPresent ( void  )

Secondary device presence status.

Every time a comms packet is sent to the secondary device the library determines whether the secondary device is 'present'. This method returns the status of the last write().

Note the status is never re-evaluated until another call to write(), so this method should not be used to wait for a device to 'come online'.

See also
read(), write(), Link Signaling Protocol
Returns
true if the SEC was present at the last attempted comms.

◆ read()

MD_OnePin::packet_t MD_OnePin::read ( bool  noReset = false)

Request a SEC data packet.

The PRI initiates a Reset/Presence signal with SEC and then sequentially requests (Read Signal) as many bits as are configured for the SEC packet size.

See also
MD_OnePin(), Link Signaling Protocol, Library Implementation Overview
Parameters
noResetset true to omit the Comms Reset signal before reading data. Defaults to false (ie, reset).
Returns
Data packet received from the SEC. Only the configured number of bits will be valid.

◆ write()

bool MD_OnePin::write ( packet_t  data,
bool  noReset = false 
)

Write a PRI data packet.

The PRI initiates a Reset/Presence signal with SEC and then sequentially writes (Write 0/1 Signals) as many bits as are configured for the PRI packet size.

See also
MD_OnePin(), Link Signaling Protocol, Library Implementation Overview
Parameters
datathe data to sent to the SEC. Only the configured number of bits will be transmitted.
noResetset true to omit the Comms Reset signal before sending data. Defaults to false (ie, reset).
Returns
true if the SEC device was present.

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