本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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( );
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}