Subversion Repositories HomeAutomation

Rev

Rev 988 | Rev 1062 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 988 Rev 989
1
 
1
 
2
#include "<template>.h"
2
#include "<template>.h"
3
 
3
 
4
void <template>_Init(void)
4
void <template>_Init(void)
5
{
5
{
6
    ///TODO: Initialize hardware etc here
6
    ///TODO: Initialize hardware etc here
7
}
7
}
8
 
8
 
9
void <template>_Process(void)
9
void <template>_Process(void)
10
{
10
{
11
    ///TODO: Stuff that needs doing is done here
11
    ///TODO: Stuff that needs doing is done here
12
}
12
}
13
 
13
 
14
void <template>_HandleMessage(StdCan_Msg_t *rxMsg)
14
void <template>_HandleMessage(StdCan_Msg_t *rxMsg)
15
{
15
{
16
    if (    StdCan_Ret_class(rxMsg->Header) == CAN_CLASS_MODULE_DEF && ///TODO: Change this to the actual class type
16
    if (    StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_xyz && ///TODO: Change this to the actual class type
17
        StdCan_Ret_direction(rxMsg->Header) == DIR_TO_OWNER &&
17
        StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_FROM_OWNER &&
18
        rxMsg->Header.ModuleType == CAN_TYPE_MODULE_def_default && ///TODO: Change this to the actual module type
18
        rxMsg->Header.ModuleType == CAN_MODULE_TYPE_xyz && ///TODO: Change this to the actual module type
19
        rxMsg->Header.ModuleId == <template>_ID)
19
        rxMsg->Header.ModuleId == <template>_ID)
20
    {
20
    {
21
        switch (rxMsg->Header.Command)
21
        switch (rxMsg->Header.Command)
22
        {
22
        {
23
        case CAN_CMD_MODULE_DUMMY:
23
        case CAN_CMD_MODULE_DUMMY:
24
        ///TODO: Do something dummy
24
        ///TODO: Do something dummy
25
        break;
25
        break;
26
        }
26
        }
27
    }
27
    }
28
}
28
}
29
 
29
 
30
void <template>_List(uint8_t ModuleSequenceNumber)
30
void <template>_List(uint8_t ModuleSequenceNumber)
31
{
31
{
32
    StdCan_Msg_t txMsg;
32
    StdCan_Msg_t txMsg;
33
   
33
   
34
    StdCan_Set_class(txMsg.Header, CAN_CLASS_MODULE_DEF); ///TODO: Change this to the actual class type
34
    StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_xyz); ///TODO: Change this to the actual class type
35
    StdCan_Set_direction(txMsg.Header, DIR_FROM_OWNER);
35
    StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
36
    txMsg.Header.ModuleType = CAN_TYPE_MODULE_def_default; ///TODO: Change this to the actual module type
36
    txMsg.Header.ModuleType = CAN_MODULE_TYPE_xyz; ///TODO: Change this to the actual module type
37
    txMsg.Header.ModuleId = <template>_ID;
37
    txMsg.Header.ModuleId = <template>_ID;
38
    txMsg.Header.Command = CAN_MODULE_CMD_GLOBAL_LIST;
38
    txMsg.Header.Command = CAN_MODULE_CMD_GLOBAL_LIST;
39
    txMsg.Length = 6;
39
    txMsg.Length = 6;
40
 
40
 
41
    txMsg.Data[0] = NODE_HW_ID_BYTE0;
41
    txMsg.Data[0] = NODE_HW_ID_BYTE0;
42
    txMsg.Data[1] = NODE_HW_ID_BYTE1;
42
    txMsg.Data[1] = NODE_HW_ID_BYTE1;
43
    txMsg.Data[2] = NODE_HW_ID_BYTE2;
43
    txMsg.Data[2] = NODE_HW_ID_BYTE2;
44
    txMsg.Data[3] = NODE_HW_ID_BYTE3;
44
    txMsg.Data[3] = NODE_HW_ID_BYTE3;
45
   
45
   
46
    txMsg.Data[4] = NUMBER_OF_MODULES;
46
    txMsg.Data[4] = NUMBER_OF_MODULES;
47
    txMsg.Data[5] = ModuleSequenceNumber;
47
    txMsg.Data[5] = ModuleSequenceNumber;
48
   
48
   
49
    while (StdCan_Put(&txMsg) != StdCan_Ret_OK);
49
    while (StdCan_Put(&txMsg) != StdCan_Ret_OK);
50
}
50
}
51
 
51