16.8.4.2.1 Code

Copy-paste the following code to your user application:
configure_usart_lin();

if (CONF_LIN_NODE_TYPE == LIN_MASTER_NODE) {
    printf("LIN Works in Master Mode\r\n");
    if (lin_master_transmission_status(&lin_instance)) {
        usart_enable_transceiver(&lin_instance,USART_TRANSCEIVER_TX);
        lin_master_send_cmd(&lin_instance,LIN_MASTER_AUTO_TRANSMIT_CMD);
        usart_write_wait(&lin_instance,LIN_ID_FIELD_VALUE);
        usart_enable_transceiver(&lin_instance,USART_TRANSCEIVER_RX);
        while(1) {
            usart_read_buffer_job(&lin_instance,
            (uint8_t *)rx_buffer, 5);
        }
    }
} else {
    printf("LIN Works in Slave Mode\r\n");
    usart_enable_transceiver(&lin_instance,USART_TRANSCEIVER_RX);
    while(1) {
        usart_read_buffer_job(&lin_instance,
        (uint8_t *)rx_buffer, 1);
    }
}