当前位置: 首页>>代码示例>>C++>>正文


C++ GPIO_PDD_GetPortDataOutput函数代码示例

本文整理汇总了C++中GPIO_PDD_GetPortDataOutput函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIO_PDD_GetPortDataOutput函数的具体用法?C++ GPIO_PDD_GetPortDataOutput怎么用?C++ GPIO_PDD_GetPortDataOutput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GPIO_PDD_GetPortDataOutput函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GPIO2_SetFieldValue

/* ===================================================================*/
void GPIO2_SetFieldValue(LDD_TDeviceData *DeviceDataPtr, LDD_GPIO_TBitField Field, GPIO2_TFieldValue Value)
{
  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  switch (Field) {                     /* no break */
    case I2C_DAT: {                    /* bit field #0 */
      GPIO_PDD_SetPortDataOutput(GPIO2_MODULE_BASE_ADDRESS,
        (
          GPIO_PDD_GetPortDataOutput(GPIO2_MODULE_BASE_ADDRESS)
          & ((GPIO2_TPortValue)(~((GPIO2_TPortValue)GPIO2_I2C_DAT_MASK)))
        )
        | (
          ((GPIO2_TPortValue)(Value << GPIO2_I2C_DAT_START_BIT))
          & ((GPIO2_TPortValue)GPIO2_I2C_DAT_MASK)
        )
      );
      break;
    }
    case I2C_CLK: {                    /* bit field #1 */
      GPIO_PDD_SetPortDataOutput(GPIO2_MODULE_BASE_ADDRESS,
        (
          GPIO_PDD_GetPortDataOutput(GPIO2_MODULE_BASE_ADDRESS)
          & ((GPIO2_TPortValue)(~((GPIO2_TPortValue)GPIO2_I2C_CLK_MASK)))
        )
        | (
          ((GPIO2_TPortValue)(Value << GPIO2_I2C_CLK_START_BIT))
          & ((GPIO2_TPortValue)GPIO2_I2C_CLK_MASK)
        )
      );
      break;
    }
    default:
      break;                           /* Invalid Field is not treated, result is undefined */
  } /* switch (Field) */
}
开发者ID:geliang201201,项目名称:CO2_Sensor,代码行数:35,代码来源:GPIO2.C

示例2: BitsIoLdd2_GetBit

/*
** ===================================================================
**     Method      :  BitsIoLdd2_GetBit (component BitsIO_LDD)
**
**     Description :
**         Returns the value of the specified bit/pin of the
**         Input/Output component. If the direction is [input] then it
**         reads the input value of the pin and returns it. If the
**         direction is [output] then it returns the last written value
**         (see <Safe mode> property for limitations).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**         Bit             - Bit/pin number to read
**       * BitVal          - The returned value: 
**                           <false> - logical "0" (Low level)
**                           <true> - logical "1" (High level)
**     Returns     :
**         ---             - Error code, possible values:
**                           ERR_OK - OK
**                           ERR_PARAM_MASK - Invalid pin index
**                           ERR_VALUE - Invalid output parameter
** ===================================================================
*/
LDD_TError BitsIoLdd2_GetBit(LDD_TDeviceData *DeviceDataPtr, byte Bit, bool *BitVal)
{
  uint32_t mask = 0;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  /* Bit number value - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (Bit > 3U) {
    return ERR_PARAM_MASK;
  }

  /* Bit value returned - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (NULL == BitVal) {
    return ERR_VALUE;
  }

  mask = BitsIoLdd2_PIN_MASK_MAP[Bit];

  if ((GPIO_PDD_GetPortDataOutput(BitsIoLdd2_MODULE_BASE_ADDRESS) & mask) != 0U) {
    *BitVal = (bool)TRUE;
  }
  else {
    *BitVal = (bool)FALSE;
  }

  return ERR_OK;
}
开发者ID:kufi,项目名称:pren19-eruca-prenbot,代码行数:54,代码来源:BitsIoLdd2.c

示例3: BitIoLdd2_GetVal

/* ===================================================================*/
bool BitIoLdd2_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  uint32_t PortData;                   /* Port data masked according to the bit used */

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  PortData = GPIO_PDD_GetPortDataOutput(BitIoLdd2_MODULE_BASE_ADDRESS) & BitIoLdd2_PORT_MASK;
  return (PortData != 0U) ? (bool)TRUE : (bool)FALSE;
}
开发者ID:thihaElec,项目名称:my-git,代码行数:9,代码来源:BitIoLdd2.c

示例4: BitsIoLdd2_GetVal

/*
** ===================================================================
**     Method      :  BitsIoLdd2_GetVal (component BitsIO_LDD)
**
**     Description :
**         Returns the value of the Input/Output component. If the
**         direction is [input] then reads the input value of the pins
**         and returns it. If the direction is [output] then returns
**         the last written value (see <Safe mode> property for
**         limitations).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**     Returns     :
**         ---             - Input value
** ===================================================================
*/
dword BitsIoLdd2_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  dword portData;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  portData = GPIO_PDD_GetPortDataOutput(BitsIoLdd2_MODULE_BASE_ADDRESS) & BitsIoLdd2_PORT_MASK;


  return portData >> BitsIoLdd2_PIN_ALLOC_0_INDEX; /* Return port data shifted with the offset of the first allocated pin*/
}
开发者ID:kufi,项目名称:pren19-eruca-prenbot,代码行数:29,代码来源:BitsIoLdd2.c

示例5: BitIoLdd4_GetVal

/* ===================================================================*/
bool BitIoLdd4_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  uint32_t PortData;                   /* Port data masked according to the bit used */

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  if ((GPIO_PDD_GetPortDirection(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK) == 0U) {
    /* Port is configured as input */
    PortData = GPIO_PDD_GetPortDataInput(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK;
  } else {
    /* Port is configured as output */
    PortData = GPIO_PDD_GetPortDataOutput(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK;
  }
  return (PortData != 0U) ? (bool)TRUE : (bool)FALSE;
}
开发者ID:psh117,项目名称:Jack-Spherobot,代码行数:15,代码来源:BitIoLdd4.c

示例6: BitsIoLdd4_PutVal

/*
** ===================================================================
**     Method      :  BitsIoLdd4_PutVal (component BitsIO_LDD)
**
**     Description :
**         Specified value is passed to the Input/Output component. If
**         the direction is [input] saves the value to a memory or a
**         register, this value will be written to the pins after
**         switching to the output mode - using [SetDir(TRUE)] (see
**         <Safe mode> property for limitations). If the direction is
**         [output] it writes the value to the pins. (Method is
**         available only if the Direction = _[output]_ or
**         _[input/output]_).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**         Val             - Output value
**     Returns     : Nothing
** ===================================================================
*/
void BitsIoLdd4_PutVal(LDD_TDeviceData *DeviceDataPtr, dword Val)
{
  /* Store the raw value of the port, set according to the offset of the first allocated pin */
  dword rawVal;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  /* Calculate the raw data to be set (i.e. shifted to left according to the first allocated pin) */
  rawVal = (Val & BitsIoLdd4_PORT_VALID_VALUE_MASK) << BitsIoLdd4_PIN_ALLOC_0_INDEX; /* Mask and shift output value */

  /* Set port data by toggling the different bits only */
  GPIO_PDD_TogglePortDataOutputMask(BitsIoLdd4_MODULE_BASE_ADDRESS,
      (GPIO_PDD_GetPortDataOutput(BitsIoLdd4_MODULE_BASE_ADDRESS) ^ rawVal) & BitsIoLdd4_PORT_MASK);
}
开发者ID:kufi,项目名称:pren19-eruca-prenbot,代码行数:35,代码来源:BitsIoLdd4.c

示例7: BitsIoLdd4_GetVal

/*
** ===================================================================
**     Method      :  BitsIoLdd4_GetVal (component BitsIO_LDD)
**
**     Description :
**         Returns the value of the Input/Output component. If the
**         direction is [input] then reads the input value of the pins
**         and returns it. If the direction is [output] then returns
**         the last written value (see <Safe mode> property for
**         limitations).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**     Returns     :
**         ---             - Input value
** ===================================================================
*/
dword BitsIoLdd4_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  dword portData;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  if ((GPIO_PDD_GetPortDirection(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK) != 0U) {
    /* port is configured as output */
    portData = GPIO_PDD_GetPortDataOutput(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK;
  } else {
    /* port is configured as input */
    portData = GPIO_PDD_GetPortDataInput(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK;
  }

  return portData >> BitsIoLdd4_PIN_ALLOC_0_INDEX; /* Return port data shifted with the offset of the first allocated pin*/
}
开发者ID:kufi,项目名称:pren19-eruca-prenbot,代码行数:34,代码来源:BitsIoLdd4.c

示例8: LEDRed_SetFieldValue

/* ===================================================================*/
void LEDRed_SetFieldValue(LDD_TDeviceData *DeviceDataPtr, LDD_GPIO_TBitField Field, LEDRed_TFieldValue Value)
{
  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  switch (Field) {                     /* no break */
    case LED_RED: {                    /* bit field #0 */
      GPIO_PDD_SetPortDataOutput(LEDRed_MODULE_BASE_ADDRESS,
        (
          GPIO_PDD_GetPortDataOutput(LEDRed_MODULE_BASE_ADDRESS)
          & ((LEDRed_TPortValue)(~((LEDRed_TPortValue)LEDRed_LED_RED_MASK)))
        )
        | (
          ((LEDRed_TPortValue)(Value << LEDRed_LED_RED_START_BIT))
          & ((LEDRed_TPortValue)LEDRed_LED_RED_MASK)
        )
      );
      break;
    }
    default:
      break;                           /* Invalid Field is not treated, result is undefined */
  } /* switch (Field) */
}
开发者ID:SeismicPi,项目名称:SeismicPi,代码行数:22,代码来源:LEDRed.c


注:本文中的GPIO_PDD_GetPortDataOutput函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。