• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PIO_Get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: platform_pio_op

pio_type platform_pio_op( unsigned port, pio_type pinmask, int op )
{
  Pin* pin;
  pio_type retval = 1;
  
  pin = pio_port_desc + port;
  pin->mask = pinmask;
  switch( op )
  {
    case PLATFORM_IO_PORT_SET_VALUE:    
    case PLATFORM_IO_PIN_SET:
      PIO_Set( pin );
      break;
      
    case PLATFORM_IO_PIN_CLEAR:
      PIO_Clear( pin );
      break;
      
    case PLATFORM_IO_PORT_DIR_INPUT:
      pin->mask = 0x7FFFFFFF;      
    case PLATFORM_IO_PIN_DIR_INPUT:
      pin->type = PIO_INPUT;
      PIO_Configure( pin, 1 );
      break;
      
    case PLATFORM_IO_PORT_DIR_OUTPUT:      
      pin->mask = 0x7FFFFFFF;      
    case PLATFORM_IO_PIN_DIR_OUTPUT:
      pin->type = PIO_OUTPUT_0;
      PIO_Configure( pin, 1 );
      break;      
            
    case PLATFORM_IO_PORT_GET_VALUE:
      pin->mask = 0x7FFFFFFF;
      pin->type = PIO_INPUT;
      retval = PIO_Get( pin );
      break;
      
    case PLATFORM_IO_PIN_GET:
      retval = PIO_Get( pin ) & pinmask ? 1 : 0;
      break;
      
    case PLATFORM_IO_PIN_PULLUP:
      pin->pio->PIO_PPUER = pinmask;
      break;
      
    case PLATFORM_IO_PIN_NOPULL:
      pin->pio->PIO_PPUDR = pinmask;
      break;
      
    default:
      retval = 0;
      break;
  }
  return retval;
}
开发者ID:Theemuts,项目名称:eLuaBrain,代码行数:56,代码来源:platform.c


示例2: ISR_Bp2

/**
 * @brief Interrupt handler for Button 2 - decrements the counter value
 */
static void ISR_Bp2(void)
{
    // Check if the button has been pressed
    if (!PIO_Get(&pinPB2))
    {
        //wait until button gets released
        while (!PIO_Get(&pinPB2))
            ;

        counter = ((counter-1)%8);
    }
}
开发者ID:mknapik,项目名称:avr-MAC,代码行数:15,代码来源:main.c


示例3: stepper_get_step_mode

uint8_t stepper_get_step_mode(void) {
	bool usm[2] = {PIO_Get(&pin_usm[0]), PIO_Get(&pin_usm[1])};
	if(!usm[0] && !usm[1]) {
		return STEP_MODE_FULL;
	} else if(usm[0] && !usm[1]) {
		return STEP_MODE_HALF;
	} else if(!usm[0] && usm[1]) {
		return STEP_MODE_QUARTER;
	} else {
		return STEP_MODE_EIGTH;
	}
}
开发者ID:Nic2012,项目名称:stepper-brick,代码行数:12,代码来源:stepper.c


示例4: prvConfigureVBus

static void prvConfigureVBus( void )
{
const Pin xVBusPin = PIN_USB_VBUS;
const uint32_t ulPriority = 7; /* Highest. */

	/* Configure PIO to generate an interrupt on status change. */
    PIO_Configure( &xVBusPin, 1 );
    PIO_ConfigureIt( &xVBusPin );

	/* Ensure interrupt is disabled before setting the mode and installing the
	handler.  The priority of the tick interrupt should always be set to the
	lowest possible. */
	AIC->AIC_SSR  = ID_PIOE;
	AIC->AIC_IDCR = AIC_IDCR_INTD;
	AIC->AIC_SMR  = AIC_SMR_SRCTYPE_EXT_POSITIVE_EDGE | ulPriority;
	AIC->AIC_SVR = ( uint32_t ) prvVBusISRHandler;

	/* Start with the interrupt clear. */
	AIC->AIC_ICCR = AIC_ICCR_INTCLR;
	PIO_EnableIt( &xVBusPin );
    AIC_EnableIT( ID_PIOE );

	/* Check current level on VBus */
	if( PIO_Get( &xVBusPin ) != pdFALSE )
	{
		/* If VBUS present, force the connect */
		USBD_Connect();
	}
	else
	{
		USBD_Disconnect();
	}
}
开发者ID:mikef5410,项目名称:FreeRTOS,代码行数:33,代码来源:CDCCommandConsole.c


示例5: ISR_Pit

//------------------------------------------------------------------------------
/// Interrupt service routine for the PIT. Debounces the wake-up pin input.
//------------------------------------------------------------------------------
static void ISR_Pit(void)
{
    static unsigned long debounceCounter = DEBOUNCE_TIME;
    unsigned long pisr = 0;

    // Read the PISR
    pisr = PIT_GetStatus() & AT91C_PITC_PITS;

    if (pisr != 0) {

        // Read the PIVR. It acknowledges the IT
        PIT_GetPIVR();
    }

    // Button released
    if (PIO_Get(&pinWakeUp)) {

        debounceCounter = DEBOUNCE_TIME;
    }
    // Button still pressed
    else {

        debounceCounter--;
    }

    // End of debounce time
    if (debounceCounter == 0) {

        debounceCounter = DEBOUNCE_TIME;
        PIT_DisableIT();
        AT91C_BASE_PITC->PITC_PIMR &= ~AT91C_PITC_PITEN;
        COMPOSITEDDriver_RemoteWakeUp();
    }
}
开发者ID:12019,项目名称:at91work,代码行数:37,代码来源:main.c


示例6: SysTick_Handler

//------------------------------------------------------------------------------
/// Interrupt service routine for the system tick. Debounces the wake-up pin input.
//------------------------------------------------------------------------------
void SysTick_Handler(void)
{
    // Button released
    if (PIO_Get(&pinWakeUp)) 
    {

        debounceCounter = DEBOUNCE_TIME;
    }
    // Button still pressed
    else 
    {

        debounceCounter--;
    }

    // End of debounce time
    if (debounceCounter == 0) 
    {

        // Disable debounce timer
        SysTick_Configure(1, BOARD_MCK/1000, 0);

        debounceCounter = DEBOUNCE_TIME;
        HIDDMouseDriver_RemoteWakeUp();
    }
}
开发者ID:aisandovalm,项目名称:tcs-tests,代码行数:29,代码来源:main.c


示例7: ENCODER_ISR_UP

//updates position value if turning clockwise
void ENCODER_ISR_UP (const Pin *encoder_pin_cw )
{
//only updates on change from high to low
    if(!PIO_Get(encoder_pin_cw)){
        encoder_position_output++;
    }
}
开发者ID:NissankaW,项目名称:Mariokart3,代码行数:8,代码来源:encoder.c


示例8: Accel_Z_ST

int Accel_Z_ST(void)
{
	char value[2];
	
	while(!PIO_Get(&(accIntPins[0]))){nop();} // wait for data ready pin
	ReadAccelData(0x2C|(1<<7), value, 2); // ST chip
	return ((signed char)value[1]<<8)|value[0];
}
开发者ID:BotBallARDroneAPI,项目名称:CBC_Library,代码行数:8,代码来源:accel.c


示例9: usb_isr_vbus

void usb_isr_vbus(const Pin *pin) {
    // Check current level on VBus
    if (PIO_Get(&pin_usb_detect)) {
        USBD_Connect();
    } else {
        USBD_Disconnect();
    }
}
开发者ID:copterpilot,项目名称:bricklib,代码行数:8,代码来源:usb.c


示例10: WakeUpHandler

//------------------------------------------------------------------------------
/// Interrupt service routine for the remote wake-up pin. Starts the debouncing
/// sequence.
//------------------------------------------------------------------------------
static void WakeUpHandler(const Pin *pin)
{
    TRACE_DEBUG("Wake-up handler\n\r");

    // Check current level on the remote wake-up pin
    if (!PIO_Get(&pinWakeUp)) {

        ConfigurePit();
    }
}
开发者ID:12019,项目名称:at91work,代码行数:14,代码来源:main.c


示例11: AccelCallback

static void AccelCallback(void)
{
#ifdef STACCEL
	char value[6];
	while(!PIO_Get(&(accIntPins[0]))){nop();} // wait for data ready pin
	ReadAccelData(0x28|(1<<7),value,6); // ST chip
	g_AccelX = ((signed char)value[1]<<8)|value[0];
	g_AccelY = ((signed char)value[3]<<8)|value[2];
	g_AccelZ = ((signed char)value[5]<<8)|value[4];
#else
	char value[3];
	if(g_idle) return;
	while(!PIO_Get(&(accIntPins[0]))){nop();} // wait for data ready pin
	ReadAccelData(0x6,value,3);
	g_AccelX = (signed char)value[0];
	g_AccelY = (signed char)value[1];
	g_AccelZ = (signed char)value[2];
#endif
}
开发者ID:BotBallARDroneAPI,项目名称:CBC_Library,代码行数:19,代码来源:accel.c


示例12: VBus_Configure

//------------------------------------------------------------------------------
/// Configures the VBus pin to trigger an interrupt when the level on that pin
/// changes.
//------------------------------------------------------------------------------
static void VBus_Configure( void ) {
  // Configure PIO
  PIO_Configure(&pinVbus, 1);
  PIO_ConfigureIt(&pinVbus, ISR_Vbus);
  PIO_EnableIt(&pinVbus);

  // Check current level on VBus
  if (PIO_Get(&pinVbus))
    // if VBUS present, force the connect
    USBD_Connect();          
}
开发者ID:Flyagin,项目名称:BS-MRZV,代码行数:15,代码来源:usb_driver.c


示例13: ISR_PioSmartCard

/**
 * PIO interrupt service routine. Checks if the smartcard has been connected
 * or disconnected.
 */
static void ISR_PioSmartCard(const Pin *pPin)
{
	/*  Check all pending interrupts */
	if ((pinSmartCard.pio->PIO_ISR & pinSmartCard.mask) != 0) {
		/*  Check current level on pin */
		if (PIO_Get(&pinSmartCard ) == 0)
			printf("-I- Smartcard inserted\n\r");
		else
			printf("-I- Smartcard removed\n\r");
	}
}
开发者ID:gstroe,项目名称:Arm,代码行数:15,代码来源:main.c


示例14: prvVBusISRHandler

static void prvVBusISRHandler( void )
{
    const Pin xVBusPin = PIN_USB_VBUS;

    /* Check current level on VBus to detect a connect/disconnect. */
    if( PIO_Get( &xVBusPin ) != 0 ) {
        USBD_Connect();
    } else {
        USBD_Disconnect();
    }
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:11,代码来源:CDCCommandConsole.c


示例15: ISR_PioSmartCard

//------------------------------------------------------------------------------
/// PIO interrupt service routine. Checks if the smartcard has been connected
/// or disconnected.
//------------------------------------------------------------------------------
static void ISR_PioSmartCard(const Pin *pPin)
{
    // Check current level on pin
    if (PIO_Get(&pinSmartCard) == 0) {
        printf("-H- Insert\n\r");
        CCID_Insertion();
    } else {
        printf("-H- Removal\n\r");
        CCID_Removal();
    }
}
开发者ID:amsterr,项目名称:at91work,代码行数:15,代码来源:main.c


示例16: CardIsConnected

//------------------------------------------------------------------------------
/// Detect if SD card is connected
//------------------------------------------------------------------------------
static unsigned char CardIsConnected(unsigned char slot)
{
    if (slot == 0) {
#if defined(BOARD_SD_PIN_CD)
        PIO_Configure(&pinCardDetect, 1);
        return PIO_Get(&pinCardDetect) ? 0 : 1;
#else
        return 1;
#endif
    }
    if (slot == 1) {
#if defined(BOARD_SD_MCI1_PIN_CD)
        PIO_Configure(&pinCardDetect1, 1);
        return PIO_Get(&pinCardDetect1) ? 0 : 1;
#else
        return 1;
#endif
    }
    
    return 0;
}
开发者ID:Lodran,项目名称:4pi-firmware,代码行数:24,代码来源:MEDSdcard.c


示例17: AccelCalibration

void AccelCalibration(void)
{
#ifdef STACCEL	
	return;
#else
	char value[9];
	short avgOffset[3];
	int i,j;
	
	g_idle = 1;	// put the callback funciton on idle so it doesn't interrupt
	// set the Accelerometer to measurement mode
	value[0] = 5;
	WriteAccelData(0x16, value, 1);
	
	// clear out the old calibration values first!!!!!!!!
	g_calValues[0] = 0;
	g_calValues[1] = 0;
	g_calValues[2] = 0;
	value[0] = value[1] = value[2] = value[3] = value[4] = value[5] = 0;
	WriteAccelData(0x10, value, 6);
	usleep(200);
	
	for(j=0;j<10;j++){
		// get a set of readings from the Accelerometer
		while(!PIO_Get(&(accIntPins[0]))){nop();} // wait for data ready pin
		ReadAccelData(0x0,value,9);			// read in 9 bytes for both 10bit and 8bit
	
		for(i=0;i<3;i++){
			avgOffset[i] = value[i*2+1]<<8;
			avgOffset[i] |= value[i*2];
			if(avgOffset[i] > 512) avgOffset[i] -=1024;
			
			g_calValues[i] += avgOffset[i];	// sum up values
		}
		usleep(100000);
	}

	// take the average
	g_calValues[0] /= 10;
	g_calValues[1] /= 10;
	g_calValues[2] /= 10;
	
	// multiply the offsets by 2, stated in the datasheet unsure why has to do with 1/2 LSB
	g_calValues[0] = -g_calValues[0]*2;
	g_calValues[1] = -g_calValues[1]*2;
	g_calValues[2] = (64 - g_calValues[2])*2;
	
	// write data to offset register	
	AccelSetCalibration();
	g_idle = 0;	// turn back on the callback
#endif
}
开发者ID:BotBallARDroneAPI,项目名称:CBC_Library,代码行数:52,代码来源:accel.c


示例18: CardIsProtected

//------------------------------------------------------------------------------
/// Checks if the device is write protected.
/// \return 1 if protected.
//------------------------------------------------------------------------------
static unsigned char CardIsProtected(unsigned char slot)
{
    if (slot == 0) {
#ifdef BOARD_SD_PIN_WP
        PIO_Configure(&pinMciWriteProtect, 1);
        return (PIO_Get(&pinMciWriteProtect) != 0);
#else
        return 0;
#endif
    }
    
    if (slot == 1) {
#ifdef BOARD_SD_MCI1_PIN_WP
        PIO_Configure(&pinMciWriteProtect1, 1);
        return (PIO_Get(&pinMciWriteProtect1) != 0);
#else
        return 0;
#endif
    }
    
    return 0;
}
开发者ID:Lodran,项目名称:4pi-firmware,代码行数:26,代码来源:MEDSdcard.c


示例19: HIDDKeyboardProcessKeys

//-----------------------------------------------------------------------------
/// Monitor keyboard buttons & Update key status in HID driver
//-----------------------------------------------------------------------------
static void HIDDKeyboardProcessKeys(void)
{
    unsigned int i;
    unsigned char pressedKeys[NUM_KEYS];
    unsigned char pressedKeysSize = 0;
    unsigned char releasedKeys[NUM_KEYS];
    unsigned char releasedKeysSize = 0;
    
    // Monitor buttons
    for (i=0; i < PIO_LISTSIZE(pinsPushButtons); i++) {
    
        // Check if button state has changed
        unsigned char isButtonPressed = PIO_Get(&(pinsPushButtons[i]));
        if (isButtonPressed != keyStatus[i]) {
    
            // Update button state
            if (!isButtonPressed) {
    
                // Key has been pressed
                TRACE_INFO("-I- Key %u has been pressed\n\r", i);
                keyStatus[i] = 0;
                pressedKeys[pressedKeysSize] = keyCodes[i];
                pressedKeysSize++;
                HIDDKeyboardDriver_RemoteWakeUp();
            }
            else {
    
                // Key has been released
                TRACE_INFO("-I- Key %u has been released\n\r", i);
                keyStatus[i] = 1;
                releasedKeys[releasedKeysSize] = keyCodes[i];
                releasedKeysSize++;
            }
        }
    }
    
    // Update key status in the HID driver if necessary
    if ((pressedKeysSize != 0) || (releasedKeysSize != 0)) {
    
        unsigned char status;

        do {
        
            status = HIDDKeyboardDriver_ChangeKeys(pressedKeys,
                                                   pressedKeysSize,
                                                   releasedKeys,
                                                   releasedKeysSize);
        }
        while (status != USBD_STATUS_SUCCESS);
    }
}
开发者ID:12019,项目名称:at91work,代码行数:54,代码来源:main.c


示例20: HIDDKeyboardProcessKeys

/**
 * Monitor keyboard buttons & Update key status in HID driver
 */
static void HIDDKeyboardProcessKeys(void)
{
    uint32_t i;
    uint8_t pressedKeys[NUM_KEYS];
    uint8_t pressedKeysSize = 0;
    uint8_t releasedKeys[NUM_KEYS];
    uint8_t releasedKeysSize = 0;

    /* Monitor buttons */
    for (i=0; i < PIO_LISTSIZE(pinsPushButtons); i++) {

        /* Check if button state has changed */
        uint8_t isButtonPressed = PIO_Get(&(pinsPushButtons[i]));
        if (isButtonPressed != keyStatus[i]) {

            /* Update button state */
            if (!isButtonPressed) {

                /* Key has been pressed */
                TRACE_INFO("-I- Key %u has been pressed\n\r", (unsigned int)i);
                keyStatus[i] = 0;
                pressedKeys[pressedKeysSize] = keyCodes[i];
                pressedKeysSize++;
                HIDDKeyboard_RemoteWakeUp();
            }
            else {

                /* Key has been released */
                TRACE_INFO("-I- Key %u has been released\n\r", (unsigned int)i);
                keyStatus[i] = 1;
                releasedKeys[releasedKeysSize] = keyCodes[i];
                releasedKeysSize++;
            }
        }
    }

    /* Update key status in the HID driver if necessary */
    if ((pressedKeysSize != 0) || (releasedKeysSize != 0)) {

        uint8_t status;

        do {

            status = HIDDKeyboard_ChangeKeys(pressedKeys,
                                             pressedKeysSize,
                                             releasedKeys,
                                             releasedKeysSize);
        }
        while (status != USBD_STATUS_SUCCESS);
    }
}
开发者ID:cxjlante,项目名称:at91sam3s,代码行数:54,代码来源:main.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PIO_LISTSIZE函数代码示例发布时间:2022-05-30
下一篇:
C++ PIO_Configure函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap