-
-
Save helo9/b17b2a10b76d4bbca7645ae91a01f7c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* main.c | |
* | |
* Created on: 2022 Oct 23 14:56:06 | |
* Author: jonathanh | |
*/ | |
#include "DAVE.h" //Declarations from DAVE Code Generation (includes SFR declaration) | |
const uint8_t SWTxDataDLC = 8; | |
const uint8_t SW_TxData[8] = {0xAAU, 0xBBU, 0xCCU, 0xDDU, 0xEEU, 0xFFU, 0x66U, 0x77U}; | |
/** | |
* @brief main() - Application entry point | |
* | |
* <b>Details of function</b><br> | |
* This routine is the application entry point. It is invoked by the device startup code. It is responsible for | |
* invoking the APP initialization dispatcher routine - DAVE_Init() and hosting the place-holder for user application | |
* code. | |
*/ | |
int main(void) | |
{ | |
DAVE_STATUS_t status; | |
XMC_CAN_STATUS_t can_status; | |
status = DAVE_Init(); /* Initialization of DAVE APPs */ | |
if (status != DAVE_STATUS_SUCCESS) | |
{ | |
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */ | |
XMC_DEBUG("DAVE APPs initialization failed\n"); | |
while(1U) | |
{ | |
} | |
} | |
/* Placeholder for user application code. The while loop below can be replaced with user application code. */ | |
while(1U) | |
{ | |
MULTICAN_CONFIG_0.lmobj_ptr[0]->mo_ptr->can_data_length = 8; | |
for (int i = 0U; i < SWTxDataDLC; i++) | |
{ | |
MULTICAN_CONFIG_0.lmobj_ptr[0]->mo_ptr->can_data_byte[i] = SW_TxData[i]; | |
} | |
while ((XMC_CAN_MO_GetStatus(MULTICAN_CONFIG_0.lmobj_ptr[0]->mo_ptr) & (uint32_t)XMC_CAN_MO_STATUS_TX_REQUEST)) | |
{ | |
} | |
can_status = XMC_CAN_MO_UpdateData(MULTICAN_CONFIG_0.lmobj_ptr[0]->mo_ptr); | |
if (can_status != XMC_CAN_STATUS_SUCCESS) | |
{ | |
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */ | |
XMC_DEBUG("Transmission data has not been updated properly\n"); | |
while(1U) | |
{ | |
} | |
} | |
/* request transmission of M03 */ | |
can_status = XMC_CAN_MO_Transmit(MULTICAN_CONFIG_0.lmobj_ptr[0]->mo_ptr); | |
if (can_status != XMC_CAN_STATUS_SUCCESS) | |
{ | |
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */ | |
XMC_DEBUG("Transmission of M03 is not successful\n"); | |
while(1U) | |
{ | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment