Commit 0454782c authored by Matthias Wenzl's avatar Matthias Wenzl
Browse files

created can template

parent 40c19fa1
......@@ -49,6 +49,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH.2111039568" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}/local_inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}/can_driver/include&quot;"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEBUGGING_MODEL.198683210" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING.1876329943" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING" valueType="stringList">
......@@ -155,6 +156,7 @@
<listOptionValue builtIn="false" value="&quot;${COM_TI_RTSC_TIRTOSTIVAC_INCLUDE_PATH}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}/can_driver/include&quot;"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN.291904552" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS.1719326651" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS"/>
......
[submodule "can_driver"]
path = can_driver
url = https://es.technikum-wien.at/ti-connected-launchpad/tirtos_CAN_driver_template.git
/*
* CAN_Task.c
*
* Created on: Aug 17, 2017
* Author: wenzl
*/
#include <stdbool.h>
#include <stdint.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Mailbox.h>
/*Board Header files */
#include <Board.h>
#include <EK_TM4C1294XL.h>
/* Application headers */
#include "CAN_Task.h"
#include <can_driver.h>
#include <canTiva.h>
#define CAN_TEST_RX
//#define CAN_TEST_TX
/*
* ======== CAN ========
* Define CAN_TEST_RX to test the receiver part
* Define CAN_TEST_TX to test the transmitter part
*/
void CANFxn(UArg arg0, UArg arg1)
{
if(CAN_Open(0) < CAN_SUCCESS)
System_abort("Cannot open CAN");
#ifdef CAN_TEST_RX
static CAN_Msg rxObj;
//will make a complete match on supplied message id
rxObj.ui32Flags = MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_USE_ID_FILTER;
rxObj.ui32MsgID = 0x450;
rxObj.ui32MsgIDMask = (0x7ff);//filter on complete id
rxObj.ui32MsgLen = 1;//expected length
rxObj.pui8MsgData = NULL;
(void)CAN_RegisterMsgObj(0, 2, &rxObj, MSG_OBJ_TYPE_RX);
Mailbox_Handle handle = NULL;
CAN_GetMbHandle(0,(void *)&handle);
CAN_RxMsg msg;
CAN_RxMsg *msg_ptr;
while(1) {
Mailbox_pend(handle,&msg,BIOS_WAIT_FOREVER);
msg_ptr = &msg;
}
#endif
#ifdef CAN_TEST_TX
static CAN_Msg msg;
static uint8_t txmsg[1] = {0x55};
msg.ui32MsgID = 0x450;
msg.ui32Flags = 0;
msg.ui32MsgIDMask = 0;
msg.ui32MsgLen = 1;
msg.pui8MsgData = txmsg;
while(1) {
CAN_RegisterMsgObj(0, 1, &msg, MSG_OBJ_TYPE_TX);
Task_sleep(1000);
}
#endif
}
/*
* Setup task function
*/
int setup_CAN_Task(void)
{
Task_Params taskCANParams;
Task_Handle taskCAN;
Error_Block eb;
Board_initCAN();
Error_init(&eb);
Task_Params_init(&taskCANParams);
taskCANParams.stackSize = 1024; /* stack in bytes */
taskCANParams.priority = 10; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskCAN = Task_create((Task_FuncPtr)CANFxn, &taskCANParams, &eb);
if (taskCAN == NULL) {
System_abort("TaskCAN create failed");
}
return (0);
}
Subproject commit ea91aff725b12a488ab9ba2200266c9c3f3437cb
/*
* CAN_Task.h
*
* Created on: Aug 17, 2017
* Author: wenzl
*/
#ifndef LOCAL_INC_CAN_TASK_H_
#define LOCAL_INC_CAN_TASK_H_
#include <stdbool.h>
#include <stdint.h>
#include <xdc/std.h>
void CANFxn(UArg arg0, UArg arg1);
int setup_CAN_Task(void);
#endif /* LOCAL_INC_CAN_TASK_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment