16.8.4.2.2 Workflow

  1. Set up USART LIN module.
    configure_usart_lin();
    
  2. For LIN master, sending LIN command. For LIN slaver, start reading data .
    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);
        }
    }