Git Product home page Git Product logo

lin-transceiver-library's Introduction

LIN-Transceiver-Library (TJA1020)

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.

dependencies

This library extends the Lin-Interface Library: https://github.com/mestrode/Lin-Interface-Library

example

Take a look into the basic example.

Library should work like the Lin-Interface Library, but considers the statemachine in every readFrame and writeFrame method. You can also control the statemachine, eg. the default slope mode.

    #include "TJA1020.hpp"

    #define LIN_SERIAL_SPEED 19200
    #define lin_NSLP_Pin 32

    // RX and TX Pin is defined per UART_nr
    TJA1020 LinBus(2, LIN_SERIAL_SPEED, lin_NSLP_Pin); // UART_nr, Baudrate, /SLP-Pin

    void setup()
    {
        // use LowSlope mode all the time
        LinBus.Slope(LinBus.LowSlope);
    }

    uint8_t getData()
    {
        uint8_t data = 0x00;

        // Read Frame ID = 0x20
        if (LinBus.readFrame(0x20))
        {
            // Read succesfull
            data = LinBus.LinMessage[0]; // only consider byte 0 of the received data
        }

        // let LIN-Tranceiver sleep --> changes also the INH Pin of the TJA1020
        LinBus.setMode(LinBus.Sleep);

        return data;
    }

see also

lin-transceiver-library's People

Contributors

mestrode avatar olivluca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.