Skip to content

Commit 5f05a86

Browse files
committed
v1.0.0
1 parent 736c0f8 commit 5f05a86

File tree

1 file changed

+6
-39
lines changed

1 file changed

+6
-39
lines changed

README.md

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
1-
# LIN-Transceiver-Library (TJA1020)
1+
# HAL for TJA1020 LIN Transceiver
22

3-
Using a LIN Bus via TJA1020 Transceiver needs to handle the statemachine bevor you will be able to send or receive data from the bus. This is encapsulated within this class.
3+
Using a LIN Bus via TJA1020 Transceiver needs to handle the statemachine bevor you will be able to send or receive data from the bus.
4+
This is encapsulated within this class.
45

56
# dependencies
67

7-
This library extends the Lin-Interface Library:
8+
none.
9+
10+
But this was designed for use on the Lin Stack, my Lin-Interface Library:
811
https://github.com/mestrode/Lin-Interface-Library
912

1013
# example
1114
Take a look into the basic example.
1215

13-
Library should work like the Lin-Interface Library, but considers the statemachine in every readFrame and writeFrame method.
14-
You can also control the statemachine, eg. the default slope mode.
15-
16-
```cpp
17-
#include "TJA1020.hpp"
18-
19-
#define LIN_SERIAL_SPEED 19200
20-
#define lin_NSLP_Pin 32
21-
22-
// RX and TX Pin is defined per UART_nr
23-
TJA1020 LinBus(2, LIN_SERIAL_SPEED, lin_NSLP_Pin); // UART_nr, Baudrate, /SLP-Pin
24-
25-
void setup()
26-
{
27-
// use LowSlope mode all the time
28-
LinBus.Slope(LinBus.LowSlope);
29-
}
30-
31-
uint8_t getData()
32-
{
33-
uint8_t data = 0x00;
34-
35-
// Read Frame ID = 0x20
36-
if (LinBus.readFrame(0x20))
37-
{
38-
// Read succesfull
39-
data = LinBus.LinMessage[0]; // only consider byte 0 of the received data
40-
}
41-
42-
// let LIN-Tranceiver sleep --> changes also the INH Pin of the TJA1020
43-
LinBus.setMode(LinBus.Sleep);
44-
45-
return data;
46-
}
47-
```
48-
4916
# see also
5017

5118
* Datasheet of TJA1020 https://www.nxp.com/docs/en/data-sheet/TJA1020.pdf

0 commit comments

Comments
 (0)