本文整理汇总了C++中Usart::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Usart::Init方法的具体用法?C++ Usart::Init怎么用?C++ Usart::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Usart
的用法示例。
在下文中一共展示了Usart::Init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gps_start
void gps_start()
{
GPS_UART_PWR_ON;
gps_uart.Init(GPS_UART, 9600);
gps_uart.SetInterruptPriority(MEDIUM);
GpioSetDirection(GPS_EN, OUTPUT); //active high
GpioWrite(GPS_EN, LOW);
GpioSetDirection(GPS_TIMER, INPUT); //active low, otherwise open-drain
GpioSetPull(GPS_TIMER, gpio_pull_up);
GpioSetInterrupt(GPS_TIMER, gpio_interrupt1, gpio_falling);
GpioSetDirection(GPS_RESET, OUTPUT); //active low
GpioWrite(GPS_RESET, LOW);
GpioWrite(GPS_EN, HIGH);
_delay_ms(10);
GpioWrite(GPS_RESET, LOW);
_delay_ms(20);
GpioWrite(GPS_RESET, HIGH);
gps_parser_state = GPS_IDLE;
fc.gps_data.valid = false;
fc.gps_data.fix = 0;
fc.gps_data.fix_cnt = 0;
for (uint8_t i = 0; i < GPS_SAT_CNT; i++)
{
fc.gps_data.sat_id[i] = 0;
fc.gps_data.sat_snr[i] = 0;
}
}
示例2: bt_step
void bt_step()
{
if (bt_module_state == BT_MOD_STATE_OFF)
return;
if (bt_reset_counter)
{
if (bt_reset_counter > task_get_ms_tick())
return;
DEBUG("BT RESET STEP: %d\n", bt_reset_counter_step);
switch(bt_reset_counter_step)
{
case(0):
GpioWrite(BT_EN, HIGH);
bt_reset_counter = task_get_ms_tick() + 500;
bt_reset_counter_step = 1;
break;
case(1):
//enable bt uart
BT_UART_PWR_ON;
bt_uart.Init(BT_UART, 115200);
bt_uart.SetInterruptPriority(MEDIUM);
// while(1)
// {
// _delay_ms(100);
// bt_uart.Write(0x00);
// _delay_ms(1);
// bt_uart.Write(0xAA);
// ewdt_reset();
// }
bt_reset_counter = task_get_ms_tick() + 10;
bt_reset_counter_step = 2;
break;
case(2):
GpioWrite(BT_RESET, HIGH);
bt_reset_counter_step = 0;
bt_reset_counter = 0;
break;
}
return;
}
if (bt_module_type == BT_PAN1322)
bt_pan1322.Step();
if (bt_module_type == BT_PAN1026)
bt_pan1026.Step();
if (bt_module_type == BT_UNKNOWN)
bt_unknown_parser();
}
示例3: uart_low_speed
void uart_low_speed()
{
//enable usart
DEBUG_UART_PWR_ON;
//init uart
uart.Init(DEBUG_UART, 9600);
uart.SetInterruptPriority(HIGH);
// uart.dbg = true;
SetStdIO(uart_in, uart_out);
}
示例4: uart_init
void uart_init()
{
//enable usart
DEBUG_UART_PWR_ON;
//init uart
switch (config.connectivity.uart_function)
{
case(UART_FORWARD_DEBUG):
uart.Init(DEBUG_UART, 921600ul);
break;
case(UART_FORWARD_OFF):
DEBUG_UART_PWR_OFF;
return;
break;
case(UART_FORWARD_9600):
uart.Init(DEBUG_UART, 9600ul);
break;
case(UART_FORWARD_19200):
uart.Init(DEBUG_UART, 19200ul);
break;
case(UART_FORWARD_38400):
uart.Init(DEBUG_UART, 38400ul);
break;
case(UART_FORWARD_57600):
uart.Init(DEBUG_UART, 57600ul);
break;
case(UART_FORWARD_115200):
uart.Init(DEBUG_UART, 115200ul);
break;
}
uart.SetInterruptPriority(HIGH);
// uart.dbg = true;
SetStdIO(uart_in, uart_out);
}
示例5: gps_change_uart_baudrate
void gps_change_uart_baudrate()
{
gps_uart.Stop();
gps_uart.Init(GPS_UART, 115200);
}