Microchip® Advanced Software Framework

lin.h File Reference

LIN service for SAM.

This file contains basic functions for the SAM USART, with support for all modes, settings and clock speeds.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "usart.h"
#include "conf_lin.h"

Data Structures

struct  st_lin_message
 This structure allows to handle a LIN message and, at the end of the received/transmitted message, allows to call a function associated to this message, the update or the capture of "signals". More...
 

Macros

#define LIN_LAST_ERR_LENGHT   0x04
 Default lenght of the 'lin_last_error[]' array. More...
 
#define LIN_OVERLOAD_INT   ((uint16_t)0x00FF)
 Error report definitions. More...
 
#define US_CSR_LIN_ERROR
 LIN error type. More...
 
LIN Versions
#define LIN_2x   0
 LIN 2.x Version. More...
 
#define LIN_1x   1
 LIN 1.x Version. More...
 

Enumerations

enum  enum_lin_cmd {
  PUBLISH,
  SUBSCRIBE,
  IGNORE
}
 This enumeration is used to select an action for a specific message declared in st_lin_message structure. Note: XXX_STAND_BY keeps the direction (PUBLISH or SUBSCRIBE) for a message that will be IGNORE. When the 'stand_by' will be finished, PUBLISH_STAND_BY would become PUBLISH and SUBSCRIBE_STAND_BY would become SUBSCRIBE. An IGNORE message could become either PUBLISH or SUBSCRIBE. More...
 

Functions

uint8_t lin_init (Usart *usart_node, bool b_master, uint8_t uc_node, uint16_t us_rate, uint32_t ul_mck)
 This function initializes the LIN controller. More...
 
uint8_t lin_register_descriptor (uint8_t uc_node, uint8_t uc_frame_id, st_lin_message *lin_desc)
 This function initializes the LIN message descriptor. More...
 
uint8_t lin_send_cmd (uint8_t uc_node, uint8_t uc_id, uint8_t uc_len)
 This function commands the sending of the LIN header, MASTER task of MASTER node. More...
 
void usart_lin_handler (uint8_t uc_node)
 USART LIN interrupt handler: manage ID reception. More...
 

#define LIN_1x   1

LIN 1.x Version.

#define LIN_2x   0

LIN 2.x Version.

#define LIN_LAST_ERR_LENGHT   0x04

Default lenght of the 'lin_last_error[]' array.

Referenced by usart_lin_handler().

#define LIN_OVERLOAD_INT   ((uint16_t)0x00FF)

Error report definitions.

More than ONE interrupt in the same time !

#define US_CSR_LIN_ERROR
Value:
(US_CSR_LINBE | US_CSR_LINISFE | US_CSR_LINIPE | \
US_CSR_LINCE | US_CSR_LINSNRE)

LIN error type.

Referenced by usart_lin_handler().

This enumeration is used to select an action for a specific message declared in st_lin_message structure. Note: XXX_STAND_BY keeps the direction (PUBLISH or SUBSCRIBE) for a message that will be IGNORE. When the 'stand_by' will be finished, PUBLISH_STAND_BY would become PUBLISH and SUBSCRIBE_STAND_BY would become SUBSCRIBE. An IGNORE message could become either PUBLISH or SUBSCRIBE.

Enumerator
PUBLISH 

The node sends the response.

SUBSCRIBE 

The node receives the response.

IGNORE 

The node is not concerned by the response, it doesn't send or receive.