libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_can.c
/**
  * @brief  Enables or disabes the CAN Time TriggerOperation communication mode.
  * @param  CANx:      where x can be 1 or 2 to to select the CAN peripheral.
  * @param  NewState : Mode new state , can be one of @ref FunctionalState.
  * @note   when enabled, Time stamp (TIME[15:0]) value is sent in the last 
  *         two data bytes of the 8-byte message: TIME[7:0] in data byte 6 
  *         and TIME[15:8] in data byte 7 
  * @note   DLC must be programmed as 8 in order Time Stamp (2 bytes) to be 
  *         sent over the CAN bus.  
  * @retval None
  */
@brief  Enables or disabes the CAN Time TriggerOperation communication mode.
@param  CANx:      where x can be 1 or 2 to to select the CAN peripheral.
@param  NewState : Mode new state , can be one of @ref FunctionalState.
@note   when enabled, Time stamp (TIME[15:0]) value is sent in the last
two data bytes of the 8-byte message: TIME[7:0] in data byte 6
and TIME[15:8] in data byte 7
@note   DLC must be programmed as 8 in order Time Stamp (2 bytes) to be
sent over the CAN bus.
@retval None
@brief Enables or disabes the CAN Time TriggerOperation communication mode . @param CANx : where x can be 1 or 2 to to select the CAN peripheral . @param NewState : Mode new state can be one of @ref FunctionalState . @note when enabled Time stamp ( TIME [ 15 : 0 ] ) value is sent in the last two data bytes of the 8 - byte message : TIME [ 7 : 0 ] in data byte 6 and TIME [ 15 : 8 ] in data byte 7 @note DLC must be programmed as 8 in order Time Stamp ( 2 bytes ) to be sent over the CAN bus . @retval None
void CAN_TTComModeCmd(CAN_TypeDef* CANx, FunctionalState NewState)
{
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  if (NewState != DISABLE)
  {
    CANx->MCR |= CAN_MCR_TTCM;
    CANx->sTxMailBox[0].TDTR |= ((uint32_t)CAN_TDT0R_TGT);
    CANx->sTxMailBox[1].TDTR |= ((uint32_t)CAN_TDT1R_TGT);
    CANx->sTxMailBox[2].TDTR |= ((uint32_t)CAN_TDT2R_TGT);
  }
  else
  {
    CANx->MCR &= (uint32_t)(~(uint32_t)CAN_MCR_TTCM);
    CANx->sTxMailBox[0].TDTR &= ((uint32_t)~CAN_TDT0R_TGT);
    CANx->sTxMailBox[1].TDTR &= ((uint32_t)~CAN_TDT1R_TGT);
    CANx->sTxMailBox[2].TDTR &= ((uint32_t)~CAN_TDT2R_TGT);
  }
}
void CAN_TTComModeCmd ( CAN_TypeDef * CANx , FunctionalState NewState ) { assert_param ( IS_CAN_ALL_PERIPH ( CANx ) ) ; assert_param ( IS_FUNCTIONAL_STATE ( NewState ) ) ; if ( NewState != DISABLE ) { CANx -> MCR |= CAN_MCR_TTCM ; CANx -> sTxMailBox [ 0 ] . TDTR |= ( ( uint32_t ) CAN_TDT0R_TGT ) ; CANx -> sTxMailBox [ 1 ] . TDTR |= ( ( uint32_t ) CAN_TDT1R_TGT ) ; CANx -> sTxMailBox [ 2 ] . TDTR |= ( ( uint32_t ) CAN_TDT2R_TGT ) ; } else { CANx -> MCR &= ( uint32_t ) ( ~ ( uint32_t ) CAN_MCR_TTCM ) ; CANx -> sTxMailBox [ 0 ] . TDTR &= ( ( uint32_t ) ~ CAN_TDT0R_TGT ) ; CANx -> sTxMailBox [ 1 ] . TDTR &= ( ( uint32_t ) ~ CAN_TDT1R_TGT ) ; CANx -> sTxMailBox [ 2 ] . TDTR &= ( ( uint32_t ) ~ CAN_TDT2R_TGT ) ; } }
@brief  Enables or disabes the CAN Time TriggerOperation communication mode.
@brief Enables or disabes the CAN Time TriggerOperation communication mode .
/* Check the parameters */ /* Enable the TTCM mode */ /* Set TGT bits */ /* Disable the TTCM mode */ /* Reset TGT bits */