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
LinMaster Class Reference
A master device LIN communication library for mbed. More...
#include <LinMaster.h>
Data Structures | |
struct | Frame_t |
Frame. More... | |
Public Types | |
enum | DriverStatus_t { INIT, IDLE, RXWAKEUP, DOMINANT, TRANSMIT, RECEIVE, TXWAKEUP } |
Bus status. More... | |
enum | FrameError_t |
Error code type. More... | |
enum | FrameType_t |
Frame Direction Type. More... | |
enum | CrcType_t |
CRC Type. More... | |
enum | BrakeType_t |
Brake Type. More... | |
Public Member Functions | |
LinMaster (PinName InPin, PinName OutPin) | |
LIN master constructor. | |
~LinMaster () | |
LIN master destructor. | |
bool | init (void) |
Initialise the LIN module
| |
bool | baudrate (uint16_t uBaud) |
Set the LIN baudrate. | |
uint16_t | baudrate (void) |
Get the LIN baudrate. | |
DriverStatus_t | status (void) |
Get the current LIN driver status. | |
FrameError_t | last_error (void) |
Get the last error detected. | |
bool | send_frame (Frame_t *ptrFrame) |
Send a frame on the LIN bus. | |
bool | get_rx_data (Frame_t &ptrFrame) |
Receive a frame on the LIN bus. |
Detailed Description
A master device LIN communication library for mbed.
#include "mbed.h" #include "LinMaster.h" LinMaster lin(p10, p9); int main() { (void)lin.init(); (void)MyLinMaster.send_frame(&M2Sframe); while(MyLinMaster.status() != LinMaster::IDLE); (void)MyLinMaster.send_frame(&S2Mframe); while(MyLinMaster.status() != LinMaster::IDLE); if (MyLinMaster.get_rx_data(S2Mframe) == true) { } else { } }
Definition at line 54 of file LinMaster.h.
Member Enumeration Documentation
enum BrakeType_t |
Brake Type.
Definition at line 139 of file LinMaster.h.
enum CrcType_t |
CRC Type.
Definition at line 133 of file LinMaster.h.
enum DriverStatus_t |
Bus status.
- Enumerator:
Definition at line 93 of file LinMaster.h.
enum FrameError_t |
Error code type.
Definition at line 111 of file LinMaster.h.
enum FrameType_t |
Frame Direction Type.
Definition at line 127 of file LinMaster.h.
Constructor & Destructor Documentation
LinMaster | ( | PinName | InPin, |
PinName | OutPin | ||
) |
LIN master constructor.
- Parameters:
-
Pin The pinname to be used for LIN communication
Definition at line 31 of file LinMaster.cpp.
~LinMaster | ( | ) |
LIN master destructor.
Definition at line 46 of file LinMaster.cpp.
Member Function Documentation
bool baudrate | ( | uint16_t | uBaud ) |
Set the LIN baudrate.
- Parameters:
-
uBaud baudrate value in kbps (1..20000)
- Returns:
- true on succes, false on fail
Definition at line 66 of file LinMaster.cpp.
uint16_t baudrate | ( | void | ) |
Get the LIN baudrate.
- Returns:
- The current configured LIN baudrate
Definition at line 79 of file LinMaster.cpp.
bool get_rx_data | ( | Frame_t & | ptrFrame ) |
Receive a frame on the LIN bus.
- Parameters:
-
ptrFrame pointer to the frame to receive
- Returns:
- true on succes, false on fail
Definition at line 167 of file LinMaster.cpp.
bool init | ( | void | ) |
Initialise the LIN module
- configure IO
- configure Timer.
- Returns:
- true on succes, false on fail
Definition at line 54 of file LinMaster.cpp.
FrameError_t last_error | ( | void | ) |
Get the last error detected.
- Returns:
- The last error detected
Definition at line 124 of file LinMaster.h.
bool send_frame | ( | Frame_t * | ptrFrame ) |
Send a frame on the LIN bus.
- Parameters:
-
ptrFrame pointer to the frame to transmit
- Returns:
- true on succes, false on fail
Definition at line 84 of file LinMaster.cpp.
DriverStatus_t status | ( | void | ) |
Get the current LIN driver status.
- Returns:
- The current LIN driver status
Definition at line 108 of file LinMaster.h.
Generated on Tue Jul 12 2022 18:16:45 by
