![]() |
One Pin Comms Link 1.0
One Pin Serial comms link layer implemented in software only
|
#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) |
Core object for the MD_OnePin library
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.
| pin | pin used for OnePin comms. |
| bppPri | the number of bits per packet (bpp) sent by PRI |
| bppSec | the number of bits per packet (bpp) received from SEC |
| MD_OnePin::~MD_OnePin | ( | ) |
Class Destructor.
Release any allocated memory and clean up anything else.
| 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.
| 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'.
| 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.
| noReset | set true to omit the Comms Reset signal before reading data. Defaults to false (ie, reset). |
| 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.
| data | the data to sent to the SEC. Only the configured number of bits will be transmitted. |
| noReset | set true to omit the Comms Reset signal before sending data. Defaults to false (ie, reset). |