Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MBED_LIN_RGB_Master_Example
Diff: LinMaster.h
- Revision:
- 2:6d4c7f841a5d
- Parent:
- 1:58b5d1e8fae3
- Child:
- 3:3656b0de0e43
--- a/LinMaster.h Tue May 06 20:17:35 2014 +0000 +++ b/LinMaster.h Sun May 11 13:14:16 2014 +0000 @@ -82,6 +82,39 @@ */ uint16_t Baudrate(void); + /** Bus status */ + enum DriverStatus { + INIT, /**< initializing */ + IDLE, /**< idle */ + WAKEUP, /**< busy sending a wake up pulse */ + TRANSMIT, /**< busy sending a frame */ + RECEIVE /**< busy receiving data */ + }; + + /** Get the current LIN driver status + * + * @return + * The current LIN driver status + */ + DriverStatus GetDriverStatus(void) {return ( DriverStat );}; + + /** Frame status */ + enum FrameStatus { + READY, /**< the frame is ready */ + BREAK, /**< break is being sent */ + DELIMITER, /**< delimiter is being sent */ + SYNC, /**< sync field is being sent */ + ID, /**< Frame ID byte is being sent */ + DATA /**< Data bytes are being sent */ + }; + + /** Get the current frame status + * + * @return + * The current frame status + */ + FrameStatus GetFrameStatus(void) {return ( FrameStat );}; + /** Send frame direction */ enum FrameDir { M2S, /**< Master to Slave */ @@ -99,12 +132,25 @@ * false on fail */ bool SendFrame(FrameDir Dir, uint8_t u8ID, uint8_t* ptrData, uint8_t u8Len); - + + void TickEventHndl(void); + private: + DriverStatus DriverStat; + FrameStatus FrameStat; uint16_t u16BitPeriod; uint8_t u8BreakLen; uint8_t u8DelimLen; + uint8_t u8TickCnt; + uint8_t u8NextBusLvl; + uint8_t u8FrameID; + FrameDir Direction; + uint8_t u8FrameData[8]; + uint8_t u8FrameLen; + uint8_t u8Byte; + uint8_t u8ByteOnLin; PinName MyPin; + Ticker MyTicker; }; #endif /* MBED_LIN_MASTER_H */