]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
cantransmit: Reindent and kill trailing whitespace
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 8 Sep 2014 14:55:51 +0000 (16:55 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 8 Sep 2014 14:55:51 +0000 (16:55 +0200)
rpp/blocks/tlc_c/sfunction_cantransmit.tlc

index e85a8b585d80fa0e76180ae6b0b86f7b75468af4..08dbf9be4bfc345c43f53759002811b4f796502d 100644 (file)
 %% Function: BlockTypeSetup ====================================================
 %function BlockTypeSetup(block, system) void
 
-    %% Ensure required header files are included
-    %<RppCommonBlockTypeSetup(block, system)>
+  %% Ensure required header files are included
+  %<RppCommonBlockTypeSetup(block, system)>
 
-       %<RppCANCommonBlockTypeSetup()>
+  %<RppCANCommonBlockTypeSetup()>
 
 %endfunction
 
 %% Function: BlockInstanceSetup ================================================
-%function BlockInstanceSetup(block, system) void              
-       %assign module_id_val = LibBlockParameterValue(module_id, 0)                 
-       %assign mailbox_id_val = LibBlockParameterValue(mailbox_id, 0)+1 %% +1 added because the RPP layer counts with mailbox indexing 1-32
-       %assign message_type_val = LibBlockParameterValue(message_type, 0)
-       %assign message_id_val = LibBlockParameterValue(message_id, 0)  
-       %assign mailbox_auto_val = LibBlockParameterValue(mailbox_auto, 0)
-
-       %if RppMailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
-               %<LibBlockReportError(block, "Duplicit mailbox number found!")>
-       %endif
-       
-       %if %<mailbox_auto_val>==1
-               %% Place new buffer for automaticaly numbered mailbox.
-               %<RppPlaceAutomaticMailboxNumber(::_RPP_MAX_MAILBOX_CNT, module_id_val, message_type_val, 0, 0, "t")>
-       %else
-               %% Place new buffer for manualy numbered mailbox, replace the automaticaly numbered one, if needed.
-               %<RppPlaceManualMailboxNumber(::_RPP_MAX_MAILBOX_CNT, mailbox_id_val, module_id_val, message_type_val, 0, 0, "t")>
-       %endif
-
-       %assign ::rpp_can_tx_cnt = %<::rpp_can_tx_cnt> + 1
-       
+%function BlockInstanceSetup(block, system) void
+  %assign module_id_val = LibBlockParameterValue(module_id, 0)
+  %assign mailbox_id_val = LibBlockParameterValue(mailbox_id, 0)+1 %% +1 added because the RPP layer counts with mailbox indexing 1-32
+  %assign message_type_val = LibBlockParameterValue(message_type, 0)
+  %assign message_id_val = LibBlockParameterValue(message_id, 0)
+  %assign mailbox_auto_val = LibBlockParameterValue(mailbox_auto, 0)
+
+  %if RppMailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
+    %<LibBlockReportError(block, "Duplicit mailbox number found!")>
+  %endif
+
+  %if %<mailbox_auto_val>==1
+    %% Place new buffer for automaticaly numbered mailbox.
+    %<RppPlaceAutomaticMailboxNumber(::_RPP_MAX_MAILBOX_CNT, module_id_val, message_type_val, 0, 0, "t")>
+  %else
+    %% Place new buffer for manualy numbered mailbox, replace the automaticaly numbered one, if needed.
+    %<RppPlaceManualMailboxNumber(::_RPP_MAX_MAILBOX_CNT, mailbox_id_val, module_id_val, message_type_val, 0, 0, "t")>
+  %endif
+
+  %assign ::rpp_can_tx_cnt = %<::rpp_can_tx_cnt> + 1
+
 %endfunction
 
 %% Function: Start =============================================================
 %function Start(block, system) Output
 
-    %if !SLibCodeGenForSim()
-
-         %if EXISTS(::rpp_can_config_present) == 0
-               %<LibBlockReportError(block, "CAN bus configuration block not present!")>
-         %endif
+  %if !SLibCodeGenForSim()
+    %if EXISTS(::rpp_can_config_present) == 0
+      %<LibBlockReportError(block, "CAN bus configuration block not present!")>
     %endif
+  %endif
 
 
 %endfunction
 
 %% Function: Outputs ===========================================================
 %function Outputs(block, system) Output
-    %if !SLibCodeGenForSim()
-               %% Get parameters
-               %assign module_id_val = LibBlockParameterValue(module_id, 0)                 
-               %assign message_id_val = LibBlockParameterValue(message_id, 0)  
-               %assign mailbox_id_val = LibBlockParameterValue(mailbox_id, 0)+1 %% +1 added because the RPP layer counts with mailbox indexing 1-32        %% Get IO signals 
-        %assign message = LibBlockInputSignal(0, "", "", 0)
-               %assign msginput_data_type = LibBlockInputSignalDataTypeId(0)
-               %assign dlc_val = 8
-
-               {
-                       %%int i;
-                       struct rpp_can_pdu pdu;
-
-                       %if %<msginput_data_type>==3
-                       // Transmit uint8
-                       pdu.dlc = 1,                    
-                       pdu.data[0]= %<message>,
-
-                       %elseif %<msginput_data_type>==5
-                       // Transmit uint16
-                       pdu.dlc = 2,                    
-                       pdu.data[0]= (%<message>&0xFF),
-                       pdu.data[1]= (%<message>&0xFF00)>>8,
-                       %elseif %<msginput_data_type>==7
-                       // Transmit uint32
-                       pdu.dlc = 4,                    
-                       pdu.data[0]= (%<message>&0xFF),
-                       pdu.data[1]= (%<message>&0xFF00)>>8,
-                       pdu.data[2]= (%<message>&0xFF0000)>>16,
-                       pdu.data[3]= (%<message>&0xFF000000)>>24,
-                       %else
-                       // Transmit CAN_MESSAGE
-                       pdu.dlc = %<message>.Length,                    
-                       %foreach msg_index = dlc_val
-                       pdu.data[%<msg_index>]= %<message>.Data[%<msg_index>];
-                       %endforeach
-                       %endif
-                       pdu.id=%<message_id_val>;
-
-               
-                       %%rpp_sci_printf("CAN%d (hw_obj: %d): Sending message id 0x%X from mailbox %d. Data: ", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
-                       %%for (i = 0; i < pdu.dlc; i++ ) {
-                       %%      rpp_sci_printf("%X ", pdu.data[i]);
-                       %%}
-                       %%rpp_sci_printf("\n");
-                       if (rpp_can_write(%<::rpp_can_tx_hw_obj_cnt>, &pdu) != SUCCESS) {
-                               rpp_sci_printf("CAN%d (hw_obj: %d): Sending a message id 0x%X from mailbox %d failed.\n", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
-                       }
-                       %assign ::rpp_can_tx_hw_obj_cnt = %<::rpp_can_tx_hw_obj_cnt> + 1
-               }
+  %if !SLibCodeGenForSim()
+    %% Get parameters
+    %assign module_id_val = LibBlockParameterValue(module_id, 0)
+    %assign message_id_val = LibBlockParameterValue(message_id, 0)
+    %assign mailbox_id_val = LibBlockParameterValue(mailbox_id, 0)+1 %% +1 added because the RPP layer counts with mailbox indexing 1-32        %% Get IO signals
+    %assign message = LibBlockInputSignal(0, "", "", 0)
+    %assign msginput_data_type = LibBlockInputSignalDataTypeId(0)
+    %assign dlc_val = 8
+
+    {
+      %%int i;
+      struct rpp_can_pdu pdu;
+
+      %if %<msginput_data_type>==3
+       // Transmit uint8
+       pdu.dlc = 1,
+       pdu.data[0]= %<message>,
+
+      %elseif %<msginput_data_type>==5
+       // Transmit uint16
+       pdu.dlc = 2,
+       pdu.data[0]= (%<message>&0xFF),
+       pdu.data[1]= (%<message>&0xFF00)>>8,
+      %elseif %<msginput_data_type>==7
+       // Transmit uint32
+       pdu.dlc = 4,
+       pdu.data[0]= (%<message>&0xFF),
+       pdu.data[1]= (%<message>&0xFF00)>>8,
+       pdu.data[2]= (%<message>&0xFF0000)>>16,
+       pdu.data[3]= (%<message>&0xFF000000)>>24,
+      %else
+       // Transmit CAN_MESSAGE
+       pdu.dlc = %<message>.Length,
+       %foreach msg_index = dlc_val
+         pdu.data[%<msg_index>]= %<message>.Data[%<msg_index>];
+       %endforeach
+      %endif
+      pdu.id=%<message_id_val>;
+
+
+      %%rpp_sci_printf("CAN%d (hw_obj: %d): Sending message id 0x%X from mailbox %d. Data: ", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
+      %%for (i = 0; i < pdu.dlc; i++ ) {
+       %%      rpp_sci_printf("%X ", pdu.data[i]);
+       %%}
+       %%rpp_sci_printf("\n");
+       if (rpp_can_write(%<::rpp_can_tx_hw_obj_cnt>, &pdu) != SUCCESS) {
+         rpp_sci_printf("CAN%d (hw_obj: %d): Sending a message id 0x%X from mailbox %d failed.\n", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
+       }
+       %assign ::rpp_can_tx_hw_obj_cnt = %<::rpp_can_tx_hw_obj_cnt> + 1
+      }
     %endif
-%endfunction
+  %endfunction
 
-%% [EOF]
+  %% [EOF]