Subversion Repositories HomeAutomation

Rev

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

  1.  
  2. #include "tst_CoreLED.h"
  3.  
  4. void tst_CoreLED_Init(void)
  5. {
  6.     /// Initialize hardware etc here
  7.  
  8.     Timer_SetTimeout(tst_CoreLED_Blink_TIMER, tst_CoreLED_Blink_Interval , TimerTypeFreeRunning, 0);
  9.    
  10.     gpio_set_out(tst_CoreLED_PIN);
  11.    
  12. }
  13.  
  14. void tst_CoreLED_Process(void)
  15. {
  16.     /// Stuff that needs doing is done here
  17.    
  18.     if (Timer_Expired(tst_CoreLED_Blink_TIMER))
  19.     {
  20.         gpio_toggle_pin(tst_CoreLED_PIN);
  21.     }
  22. }
  23.  
  24. void tst_CoreLED_HandleMessage(StdCan_Msg_t *rxMsg)
  25. {
  26.     /*if (  StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_xyz && ///TODO: Change this to the actual class type
  27.         StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_FROM_OWNER &&
  28.         rxMsg->Header.ModuleType == CAN_MODULE_TYPE_xyz && ///TODO: Change this to the actual module type
  29.         rxMsg->Header.ModuleId == tst_CoreLED_ID)
  30.     {
  31.         switch (rxMsg->Header.Command)
  32.         {
  33.         case CAN_CMD_MODULE_DUMMY:
  34.         ///TODO: Do something dummy
  35.         break;
  36.         }
  37.     }*/
  38. }
  39.  
  40. void tst_CoreLED_List(uint8_t ModuleSequenceNumber)
  41. {
  42.     StdCan_Msg_t txMsg;
  43.    
  44.     StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_TST);
  45.     StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
  46.     txMsg.Header.ModuleType = CAN_MODULE_TYPE_TST_DEBUG;
  47.     txMsg.Header.ModuleId = tst_CoreLED_ID;
  48.     txMsg.Header.Command = CAN_MODULE_CMD_GLOBAL_LIST;
  49.     txMsg.Length = 6;
  50.  
  51.     uint32_t HwId=BIOS_GetHwId();
  52.     txMsg.Data[0] = HwId&0xff;
  53.     txMsg.Data[1] = (HwId>>8)&0xff;
  54.     txMsg.Data[2] = (HwId>>16)&0xff;
  55.     txMsg.Data[3] = (HwId>>24)&0xff;
  56.    
  57.     txMsg.Data[4] = NUMBER_OF_MODULES;
  58.     txMsg.Data[5] = ModuleSequenceNumber;
  59.    
  60.     while (StdCan_Put(&txMsg) != StdCan_Ret_OK);
  61. }
  62.