示例#1
0
/*
** ===================================================================
**     Method      :  TU1_OnChannel0 (component TimerInt_LDD)
**
**     Description :
**         The method services the event of the linked component TU1 and 
**         eventually invokes event TimerIntLdd1_OnInterrupt.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void TU1_OnChannel0(LDD_TUserData *UserDataPtr)
{
  TimerIntLdd1_TDeviceData *DeviceDataPrv = PE_LDD_DeviceDataList[PE_LDD_COMPONENT_TimerIntLdd1_ID];
  uint16_t Ticks;

  (void)UserDataPtr;                   /* Parameter is not used, suppress unused argument warning */
  (void)TU1_GetOffsetTicks(DeviceDataPrv->LinkedDeviceDataPtr, CHANNEL, &Ticks);
  Ticks += DeviceDataPrv->CmpVal;
  (void)TU1_SetOffsetTicks(DeviceDataPrv->LinkedDeviceDataPtr, CHANNEL, Ticks);
  if (DeviceDataPrv->EnEvents & LDD_TIMERINT_ON_INTERRUPT) { /* Is the event enabled? */
    TimerIntLdd1_OnInterrupt(DeviceDataPrv->UserDataPtr); /* Invoke OnInterrupt event */
  }
}
示例#2
0
/*
** ===================================================================
**     Method      :  SetRatio (component PWM_LDD)
**
**     Description :
**         This method calculates new value of duty compare register from 
**         variable RatioStore.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
static void SetRatio(LDD_TDeviceData *DeviceDataPtr)
{
  PwmLdd1_TDeviceData *DeviceDataPrv = (PwmLdd1_TDeviceData*)DeviceDataPtr;
  uint16_t Period;
  uint16_t Duty;

  (void)TU1_GetPeriodTicks(DeviceDataPrv->LinkedDeviceDataPtr, &Period);
  if (Period == 0U) {
    Duty = DeviceDataPrv->RatioStore;
  }
  else {
    Duty = (uint16_t)((((uint32_t)(Period) * DeviceDataPrv->RatioStore) + 0x8000) >> 0x10);
  }
  (void)TU1_SetOffsetTicks(DeviceDataPrv->LinkedDeviceDataPtr, CHANNEL, Duty);
}
示例#3
0
文件: ESC.c 项目: Ngomat/mcuoneclipse
static uint8_t ESC_SetOffsetTicks_BL(uint16_t ticks) { return TU1_SetOffsetTicks(PWM4_DeviceData, 3, ticks); }
示例#4
0
文件: ESC.c 项目: Ngomat/mcuoneclipse
static uint8_t ESC_SetOffsetTicks_BR(uint16_t ticks) { return TU1_SetOffsetTicks(PWM3_DeviceData, 2, ticks); }
示例#5
0
文件: ESC.c 项目: Ngomat/mcuoneclipse
static uint8_t ESC_SetOffsetTicks_FL(uint16_t ticks) { return TU1_SetOffsetTicks(PWM2_DeviceData, 1, ticks); }
示例#6
0
文件: ESC.c 项目: Ngomat/mcuoneclipse
static uint8_t ESC_SetOffsetTicks_FR(uint16_t ticks) { return TU1_SetOffsetTicks(PWM1_DeviceData, 0, ticks); }