Subversion Repositories HomeAutomation

Rev

Rev 851 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

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