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


C++ platform_mcu_powersave_enable函数代码示例

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


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

示例1: platform_uart_receive_bytes

OSStatus platform_uart_receive_bytes( platform_uart_driver_t* driver, uint8_t* data_in, uint32_t expected_data_size, uint32_t timeout_ms )
{
  OSStatus err = kNoErr;

  platform_mcu_powersave_disable();

  require_action_quiet( ( driver != NULL ) && ( data_in != NULL ) && ( expected_data_size != 0 ), exit, err = kParamErr);
  require_action_quiet( driver->rx_ring_buffer != NULL , exit, err = kUnsupportedErr);

  while ( expected_data_size != 0 )
  {
    uint32_t transfer_size = MIN(driver->rx_ring_buffer->size / 2, expected_data_size);

    /* Check if ring buffer already contains the required amount of data. */
    if ( transfer_size > ring_buffer_used_space( driver->rx_ring_buffer ) )
    {
      /* Set rx_size and wait in rx_complete semaphore until data reaches rx_size or timeout occurs */
      driver->rx_size = transfer_size;

      if ( mico_rtos_get_semaphore( &driver->rx_complete, timeout_ms ) != kNoErr )
      {
        driver->rx_size = 0;
        err = kTimeoutErr;
        goto exit;
      }

      /* Reset rx_size to prevent semaphore being set while nothing waits for the data */
      driver->rx_size = 0;
    }

    expected_data_size -= transfer_size;

    // Grab data from the buffer
    do
    {
      uint8_t* available_data;
      uint32_t bytes_available;

      ring_buffer_get_data( driver->rx_ring_buffer, &available_data, &bytes_available );
      bytes_available = MIN( bytes_available, transfer_size );
      memcpy( data_in, available_data, bytes_available );
      transfer_size -= bytes_available;
      data_in = ( (uint8_t*)data_in + bytes_available );
      ring_buffer_consume( driver->rx_ring_buffer, bytes_available );
    }
    while ( transfer_size != 0 );
  }

  require_action( expected_data_size == 0, exit, err = kReadErr);

exit:
  platform_mcu_powersave_enable();
  return err;

}
开发者ID:gjw09043108,项目名称:MICO,代码行数:55,代码来源:platform_uart.c

示例2: internalFlashInitialize

static OSStatus internalFlashInitialize( void )
{ 
  platform_log_trace();
  OSStatus err = kNoErr;
  platform_mcu_powersave_disable();

  require_action( flash_init(FLASH_ACCESS_MODE_128, 6) == FLASH_RC_OK, exit, err = kGeneralErr );
  
exit:
  platform_mcu_powersave_enable();
  return err; 
}
开发者ID:yinhongxing,项目名称:mico,代码行数:12,代码来源:platform_flash.c

示例3: platform_gpio_output_low

platform_result_t platform_gpio_output_low( const platform_gpio_t* gpio )
{
    wiced_assert( "bad argument", ( gpio != NULL ) );

    platform_mcu_powersave_disable();

    gpio->port->BSRRH = (uint16_t) ( 1 << gpio->pin_number );

    platform_mcu_powersave_enable();

    return PLATFORM_SUCCESS;
}
开发者ID:fishbaoz,项目名称:wiced-emw3165,代码行数:12,代码来源:platform_gpio.c

示例4: thread_wakeup

static void thread_wakeup(void *arg)
{
    platform_uart_driver_t* driver = arg;

    while(1) {
        if( mico_rtos_get_semaphore( driver->sem_wakeup, 1000) != kNoErr )
        {
            platform_gpio_irq_enable( driver->peripheral->pin_rx, IRQ_TRIGGER_FALLING_EDGE, RX_PIN_WAKEUP_handler, driver );
            platform_mcu_powersave_enable( );
        }
    }
}
开发者ID:ilittlerui,项目名称:MICO,代码行数:12,代码来源:platform_uart.c

示例5: platform_gpio_output_trigger

OSStatus platform_gpio_output_trigger( const platform_gpio_t* gpio )
{
  OSStatus err = kNoErr;
  
  require_action_quiet( gpio != NULL, exit, err = kParamErr);
  platform_mcu_powersave_disable();
  
  ioport_toggle_pin_level( gpio->pin );
  
exit:
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:13,代码来源:platform_gpio.c

示例6: platform_gpio_output_low

OSStatus platform_gpio_output_low( const platform_gpio_t* gpio )
{
  OSStatus err = kNoErr;
  
  require_action_quiet( gpio != NULL, exit, err = kParamErr);
  platform_mcu_powersave_disable();
  
  ioport_set_pin_level( gpio->pin, IOPORT_PIN_LEVEL_LOW );
  
exit:
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:13,代码来源:platform_gpio.c

示例7: platform_gpio_deinit

OSStatus platform_gpio_deinit( const platform_gpio_t* gpio )
{
  OSStatus          err = kNoErr;

  platform_mcu_powersave_disable();
  require_action_quiet( gpio != NULL, exit, err = kParamErr);
  
  ioport_disable_pin( gpio->pin );
    
exit:
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:13,代码来源:platform_gpio.c

示例8: host_platform_bus_deinit

OSStatus host_platform_bus_deinit( void )
{

    platform_mcu_powersave_disable();
#ifdef USE_OWN_SPI_DRV
    pdc_disable_transfer(spi_m_pdc, PERIPH_PTCR_RXTDIS | PERIPH_PTCR_TXTDIS);
	spi_disable(SPI_MASTER_BASE);
#else
    spi_master_vec_disable(&spi_master);
#endif
    platform_mcu_powersave_enable();

    return kNoErr;
}
开发者ID:gjw09043108,项目名称:MICO,代码行数:14,代码来源:wlan_bus_spi.c

示例9: platform_gpio_input_get

wiced_bool_t platform_gpio_input_get( const platform_gpio_t* gpio )
{
    wiced_bool_t result;

    wiced_assert( "bad argument", ( gpio != NULL ) );

    platform_mcu_powersave_disable();

    result = ( ( gpio->port->IDR & (uint32_t) ( 1 << gpio->pin_number ) ) != 0 ) ? WICED_TRUE : WICED_FALSE;

    platform_mcu_powersave_enable();

    return result;
}
开发者ID:fishbaoz,项目名称:wiced-emw3165,代码行数:14,代码来源:platform_gpio.c

示例10: platform_gpio_input_get

bool platform_gpio_input_get( const platform_gpio_t* gpio )
{
  bool result = false;

  platform_mcu_powersave_disable();

  require_quiet( gpio != NULL, exit);

  result = ( ( gpio->port->IDR & (uint32_t) ( 1 << gpio->pin_number ) ) != 0 ) ? true : false;
  
exit:
  platform_mcu_powersave_enable();
  return result;
}
开发者ID:70year,项目名称:MICO,代码行数:14,代码来源:platform_gpio.c

示例11: platform_gpio_input_get

bool platform_gpio_input_get( const platform_gpio_t* gpio )
{
  bool              result = false;
  
  platform_mcu_powersave_disable();
  
  require_quiet( gpio != NULL, exit);
  
  result = ( ioport_get_pin_level( gpio->pin ) == false ) ? false : true;
  
exit:
  platform_mcu_powersave_enable();
  return result;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:14,代码来源:platform_gpio.c

示例12: platform_uart_transmit_bytes

OSStatus platform_uart_transmit_bytes( platform_uart_driver_t* driver, const uint8_t* data_out, uint32_t size )
{
    OSStatus err = kNoErr;

    platform_mcu_powersave_disable();

#ifndef NO_MICO_RTOS
    mico_rtos_lock_mutex( &driver->tx_mutex );
#endif

    require_action_quiet( ( driver != NULL ) && ( data_out != NULL ) && ( size != 0 ), exit, err = kParamErr);

    /* Clear interrupt status before enabling DMA otherwise error occurs immediately */
    clear_dma_interrupts( driver->peripheral->tx_dma_config.stream, driver->peripheral->tx_dma_config.complete_flags | driver->peripheral->tx_dma_config.error_flags );

    /* Init DMA parameters and variables */
    driver->last_transmit_result                    = kGeneralErr;
    driver->tx_size                                 = size;
    driver->peripheral->tx_dma_config.stream->CR   &= ~(uint32_t) DMA_SxCR_CIRC;
    driver->peripheral->tx_dma_config.stream->NDTR  = size;
    driver->peripheral->tx_dma_config.stream->M0AR  = (uint32_t)data_out;

    USART_DMACmd( driver->peripheral->port, USART_DMAReq_Tx, ENABLE );
    USART_ClearFlag( driver->peripheral->port, USART_FLAG_TC );
    driver->peripheral->tx_dma_config.stream->CR   |= DMA_SxCR_EN;

    /* Wait for transmission complete */
#ifndef NO_MICO_RTOS
    mico_rtos_get_semaphore( &driver->tx_complete, MICO_NEVER_TIMEOUT );
#else
    while( driver->tx_complete == false );
    driver->tx_complete = false;
#endif

    while ( ( driver->peripheral->port->SR & USART_SR_TC ) == 0 )
    {
    }

    /* Disable DMA and clean up */
    USART_DMACmd( driver->peripheral->port, USART_DMAReq_Tx, DISABLE );
    driver->tx_size = 0;
    err = driver->last_transmit_result;

exit:
#ifndef NO_MICO_RTOS
    mico_rtos_unlock_mutex( &driver->tx_mutex );
#endif
    platform_mcu_powersave_enable();
    return err;
}
开发者ID:ilittlerui,项目名称:MICO,代码行数:50,代码来源:platform_uart.c

示例13: platform_gpio_output_trigger

OSStatus platform_gpio_output_trigger( const platform_gpio_t* gpio )
{
  OSStatus err = kNoErr;

  platform_mcu_powersave_disable();

  require_action_quiet( gpio != NULL, exit, err = kParamErr);

  gpio->port->ODR ^= (uint16_t) ( 1 << gpio->pin_number );
  
exit:
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:70year,项目名称:MICO,代码行数:14,代码来源:platform_gpio.c

示例14: platform_gpio_output_low

OSStatus platform_gpio_output_low( const platform_gpio_t* gpio )
{
  OSStatus err = kNoErr;

  require_action_quiet( gpio != NULL, exit, err = kParamErr);

  platform_mcu_powersave_disable();
  
  GpioClrRegOneBit(GPIO_A_OUT + gpio->port , ((uint32_t)1 << gpio->pin) );
  
exit:
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:playboy51job,项目名称:MiCO_v2.2.0,代码行数:14,代码来源:platform_gpio.c

示例15: platform_pwm_stop

OSStatus platform_pwm_stop( const platform_pwm_t* pwm )
{
  OSStatus err = kNoErr;
  
  platform_mcu_powersave_disable();

  require_action_quiet( pwm != NULL, exit, err = kParamErr);
  
  TIM_CtrlPWMOutputs( pwm->tim, DISABLE );
  TIM_Cmd( pwm->tim, DISABLE );
  
exit:  
  platform_mcu_powersave_enable();
  return err;
}
开发者ID:70year,项目名称:MICO,代码行数:15,代码来源:platform_pwm.c


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