Manchester
Diff: Manchester.h
- Revision:
- 2:de778df5892c
- Parent:
- 1:11292d238e50
- Child:
- 5:3b2c7e9fda3f
--- a/Manchester.h Wed May 17 08:17:13 2017 +0000
+++ b/Manchester.h Wed May 17 21:02:49 2017 +0000
@@ -2,7 +2,7 @@
******************************************************************************
* @file Manchester.h
* @author Zoltan Hudak
- * @version
+ * @version
* @date 16-May-2017
* @brief Manchester code for mbed
******************************************************************************
@@ -25,7 +25,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+
#ifndef MANCHESTER_H
#define MANCHESTER_H
@@ -47,35 +47,37 @@
DECODE,
ERROR
};
-
+
public:
Manchester
(
PinName txPin, /* transmitter pin name */
PinName rxPin, /* receiver pin name */
- uint32_t speed = 1200 /* speed in bits per second */,
- uint8_t tol = 20 /* pulse width tolerance (+/-) in % */
+ uint32_t speed = 1200 /* speed in bits per second */,
+ uint8_t tol = 20 /* pulse width tolerance (+/-) in % */
);
- ~Manchester(void) { };
+ ~Manchester(void) { }
void transmit(ManchesterMsg& msg);
bool receive(ManchesterMsg& msg);
-
+
private:
DigitalOut _tx; // transmitter line
InterruptIn _rx; // receiver line
Ticker _txTicker; // transmitter ticker
- Timeout _rxTimeout; // receiver timeout
+ Timeout _timeout; // timeout (watchdog)
uint32_t _midBitTime; // mid-bit time [us]
uint32_t _minPulseWidth; // minimum pulse width [us]
uint32_t _maxPulseWidth; // maximum pulse width [us]
State _state; // state
char* _data; // data array
- uint8_t _len; // data length in bytes
- uint8_t _maxLen; // maximum length
-
+ size_t _len; // data length in bytes
+ size_t _maxLen; // maximum length
+
void transmission(void);
void reception(void);
+ void txTimeout(void);
void rxTimeout(void);
};
#endif // MANCHESTER_H
+