本文整理汇总了C++中platform_mcu_powersave_enable函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_mcu_powersave_enable函数的具体用法?C++ platform_mcu_powersave_enable怎么用?C++ platform_mcu_powersave_enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_mcu_powersave_enable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: platform_gpio_peripheral_pin_init
OSStatus platform_gpio_peripheral_pin_init( const platform_gpio_t* gpio, ioport_mode_t pin_mode )
{
OSStatus err = kNoErr;
platform_mcu_powersave_disable( );
require_action_quiet( gpio != NULL, exit, err = kParamErr);
/* Set pin mode and disable GPIO peripheral */
ioport_set_pin_mode( gpio->pin, pin_mode );
ioport_disable_pin( gpio->pin );
exit:
platform_mcu_powersave_enable();
return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:15,代码来源:platform_gpio.c
示例17: platform_adc_deinit
OSStatus platform_adc_deinit( const platform_adc_t* adc )
{
OSStatus err = kNoErr;
platform_mcu_powersave_disable();
require_action_quiet( adc != NULL, exit, err = kParamErr);
adc_disable();
initialized = false;
exit:
platform_mcu_powersave_enable();
return err;
}
开发者ID:SmartArduino,项目名称:MICO-1,代码行数:16,代码来源:platform_adc.c
示例18: host_platform_spi_transfer
OSStatus host_platform_spi_transfer( bus_transfer_direction_t dir, uint8_t* buffer, uint16_t buffer_length )
{
OSStatus result;
uint32_t junk;
platform_mcu_powersave_disable();
wifi_spi.tx_dma.stream->NDTR = buffer_length;
wifi_spi.tx_dma.stream->M0AR = (uint32_t) buffer;
if ( dir == BUS_READ )
{
wifi_spi.rx_dma.stream->NDTR = buffer_length;
wifi_spi.rx_dma.stream->M0AR = (uint32_t) buffer;
wifi_spi.rx_dma.stream->CR |= DMA_MemoryInc_Enable | ( 1 << 4);
}
else
{
wifi_spi.rx_dma.stream->NDTR = buffer_length;
wifi_spi.rx_dma.stream->M0AR = (uint32_t) &junk;
wifi_spi.rx_dma.stream->CR &= ( ~DMA_MemoryInc_Enable ) | ( 1 << 4);
}
platform_gpio_output_low( &wifi_spi_pins[WIFI_PIN_SPI_CS] );
DMA_Cmd( wifi_spi.rx_dma.stream, ENABLE );
DMA_Cmd( wifi_spi.tx_dma.stream, ENABLE );
/* Wait for DMA TX to complete */
result = mico_rtos_get_semaphore( &spi_transfer_finished_semaphore, 100 );
// loop_count = 0;
// while ( ( DMA_GetFlagStatus( SPIX_DMA_RX_STREAM, DMA_FLAG_TCIF3 ) == RESET ) && ( loop_count < (uint32_t) DMA_TIMEOUT_LOOPS ) )
// {
// loop_count++;
// }
DMA_Cmd( wifi_spi.rx_dma.stream, DISABLE );
DMA_Cmd( wifi_spi.tx_dma.stream, DISABLE );
/* Clear the CS pin and the DMA status flag */
platform_gpio_output_high( &wifi_spi_pins[WIFI_PIN_SPI_CS] ); /* CS high (to deselect) */
clear_dma_interrupts( wifi_spi.rx_dma.stream, wifi_spi.rx_dma.complete_flags );
clear_dma_interrupts( wifi_spi.tx_dma.stream, wifi_spi.tx_dma.complete_flags );
platform_mcu_powersave_enable();
return result;
}
开发者ID:HargicStudio,项目名称:smartCup_micokit_V2.3.0.2,代码行数:46,代码来源:wlan_bus_spi.c
示例19: platform_uart_deinit
OSStatus platform_uart_deinit( platform_uart_driver_t* driver )
{
OSStatus err = kNoErr;
platform_mcu_powersave_disable();
require_action_quiet( ( driver != NULL ), exit, err = kParamErr);
usart_disable_interrupt( driver->peripheral->port, 0xffffffff );
NVIC_DisableIRQ( platform_flexcom_irq_numbers[driver->peripheral->uart_id] );
pdc_disable_transfer( usart_get_pdc_base( driver->peripheral->port ), PERIPH_PTCR_TXTDIS | PERIPH_PTCR_RXTDIS );
usart_disable_tx( driver->peripheral->port );
usart_disable_rx( driver->peripheral->port );
if( pmc_is_periph_clk_enabled( driver->peripheral->peripheral_id ) == 1 ) {
flexcom_disable( driver->peripheral->flexcom_base );
}
platform_gpio_deinit( driver->peripheral->tx_pin );
platform_gpio_deinit( driver->peripheral->rx_pin );
if ( driver->peripheral->cts_pin != NULL )
{
platform_gpio_deinit( driver->peripheral->cts_pin );
}
if ( driver->peripheral->rts_pin != NULL )
{
platform_gpio_deinit( driver->peripheral->rts_pin );
}
#ifndef NO_MICO_RTOS
mico_rtos_deinit_semaphore(&driver->rx_complete);
mico_rtos_deinit_semaphore(&driver->tx_complete);
#endif
driver->peripheral = NULL;
memset( driver, 0, sizeof(platform_uart_driver_t) );
exit:
platform_mcu_powersave_enable();
return err;
}
开发者ID:karlnet,项目名称:mico,代码行数:45,代码来源:platform_uart.c
示例20: platform_gpio_irq_disable
OSStatus platform_gpio_irq_disable( const platform_gpio_t* gpio )
{
uint8_t intPort;
int i;
OSStatus err = kNoErr;
platform_mcu_powersave_disable();
require_action_quiet( gpio != NULL, exit, err = kParamErr);
switch( gpio->port ){
case GPIOA:
intPort = GPIO_A_INT;
break;
case GPIOB:
intPort = GPIO_B_INT;
break;
case GPIOC:
intPort = GPIO_C_INT;
break;
default:
err = kParamErr;
goto exit;
}
GpioIntDis( intPort, ((uint32_t)1 << gpio->pin) );
for( i = 0; i < NUMBER_OF_GPIO_IRQ_LINES; i++ ){
if ( gpio_irq_data[i].port == gpio->port && gpio_irq_data[i].pin == gpio->pin){
gpio_irq_data[ i ].port = 0;
gpio_irq_data[ i ].pin = 0;
gpio_irq_data[ i ].handler = NULL;
gpio_irq_data[ i ].arg = NULL;
break;
}
}
if( i == NUMBER_OF_GPIO_IRQ_LINES){
err = kNotFoundErr;
goto exit;
}
exit:
platform_mcu_powersave_enable();
return err;
}
开发者ID:playboy51job,项目名称:MiCO_v2.2.0,代码行数:45,代码来源:platform_gpio.c
注:本文中的platform_mcu_powersave_enable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论