コード例 #1
0
/**
 * @brief  Initializes the SPIRIT GPIOx according to the specified
 *         parameters in the pxGpioInitStruct.
 * @param  pxGpioInitStruct pointer to a SGpioInit structure that
 *         contains the configuration information for the specified SPIRIT GPIO.
 * @retval None.
 */
void SpiritGpioInit(SGpioInit* pxGpioInitStruct)
{
  uint8_t tempRegValue = 0x00;

  /* Check the parameters */
  s_assert_param(IS_SPIRIT_GPIO(pxGpioInitStruct->xSpiritGpioPin));
  s_assert_param(IS_SPIRIT_GPIO_MODE(pxGpioInitStruct->xSpiritGpioMode));
  s_assert_param(IS_SPIRIT_GPIO_IO(pxGpioInitStruct->xSpiritGpioIO));

  tempRegValue = ((uint8_t)(pxGpioInitStruct->xSpiritGpioMode) | (uint8_t)(pxGpioInitStruct->xSpiritGpioIO));

  g_xStatus = SpiritSpiWriteRegisters(pxGpioInitStruct->xSpiritGpioPin, 1, &tempRegValue);

}
コード例 #2
0
ファイル: spirit_gpio.c プロジェクト: AlexShiLucky/NuttX
int spirit_gpio_initialize(FAR struct spirit_library_s *spirit,
                           FAR const struct spirit_gpio_init_s *gpioinit)
{
  uint8_t regval = 0x00;

  /* Check the parameters */

  DEBUGASSERT(IS_SPIRIT_GPIO(gpioinit->gpiopin));
  DEBUGASSERT(IS_SPIRIT_GPIO_MODE(gpioinit->gpiomode));
  DEBUGASSERT(IS_SPIRIT_GPIO_IO(gpioinit->gpioio));

  regval = ((uint8_t)(gpioinit->gpiomode) | (uint8_t)(gpioinit->gpioio));
  return spirit_reg_write(spirit, gpioinit->gpiopin, &regval, 1);
}