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

C++ Usart类代码示例

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

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



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

示例1: write_time

    void write_time(Usart& uart, DS3231 &rtc)
    {
        uint8_t buffer[8] = {0};
        rtc.readRaw(buffer, 8);

        write_digits(uart, buffer[3]);
        uart.write(':');
        write_digits(uart, buffer[2]);
        uart.write(':');
        write_digits(uart, buffer[1]);
        uart.write(' ');

        write_digits(uart, buffer[5]);
        uart.write('.');
        write_digits(uart, buffer[6]);
        uart.write(".20");
        write_digits(uart, buffer[7]);
    }
开发者ID:mildrock,项目名称:NoSpark,代码行数:18,代码来源:serialconsole.cpp


示例2: write_temp

 void write_temp(Usart& uart, const uint8_t temp)
 {
     write_decimal(uart, temp);
     uart.write('C');
 }
开发者ID:mildrock,项目名称:NoSpark,代码行数:5,代码来源:serialconsole.cpp


示例3: write_decimal

 void write_decimal(Usart& uart, const uint32_t dec)
 {
     char buffer[6] = {0};
     ltoa(dec, buffer, 10);
     uart.write(buffer);
 }
开发者ID:mildrock,项目名称:NoSpark,代码行数:6,代码来源:serialconsole.cpp


示例4: 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;
	}
}
开发者ID:rgagne002,项目名称:SkyDrop,代码行数:33,代码来源:gps_l80.cpp


示例5: bt_unknown_parser

void bt_unknown_parser()
{
	while (!bt_uart.isRxBufferEmpty())
	{
		uint8_t c = bt_uart.Read();
		DEBUG(">> %02X %c ??\n", c, c);
	}
}
开发者ID:MaxNero,项目名称:SkyDrop,代码行数:8,代码来源:bt.cpp


示例6: 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();
}
开发者ID:Flyingplanet,项目名称:SkyDrop,代码行数:58,代码来源:bt.cpp


示例7: 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);
}
开发者ID:ChrisDD11,项目名称:SkyDrop,代码行数:12,代码来源:uart.cpp


示例8: gps_set_baudrate

void gps_set_baudrate()
{
	DEBUG("set_baudrate\n");
	fprintf_P(gps_out, PSTR("$PMTK251,115200*1F\r\n"));
	gps_uart.FlushTxBuffer();
	_delay_ms(1);
}
开发者ID:rgagne002,项目名称:SkyDrop,代码行数:7,代码来源:gps_l80.cpp


示例9: bt_init

void bt_init()
{
	DEBUG("bt_init\n");

	//get module type
	eeprom_busy_wait();
	bt_module_type = eeprom_read_byte(&config_ro.bt_module_type);

	//init bt_uart
	bt_uart.InitBuffers(BUFFER_SIZE * 2, BUFFER_SIZE);

	//pin init
	GpioSetDirection(BT_EN, OUTPUT);
	GpioSetDirection(BT_RESET, OUTPUT);
	GpioSetDirection(BT_RTS, OUTPUT);

	//power is off
	GpioWrite(BT_RTS, LOW);
	GpioWrite(BT_EN, LOW);
	GpioWrite(BT_RESET, LOW);

	//IRQ init
	GpioSetDirection(BT_CTS, INPUT);
	GpioSetPull(BT_CTS, gpio_pull_down);
	GpioSetInterrupt(BT_CTS, gpio_interrupt1, gpio_rising);
}
开发者ID:MaxNero,项目名称:SkyDrop,代码行数:26,代码来源:bt.cpp


示例10: uart_stop

void uart_stop()
{
	uart.Stop();

	//disable usart
	DEBUG_UART_PWR_OFF;
}
开发者ID:ChrisDD11,项目名称:SkyDrop,代码行数:7,代码来源:uart.cpp


示例11: bt_module_deinit

void bt_module_deinit()
{
	GpioWrite(BT_EN, LOW);
	GpioWrite(BT_RESET, LOW);

	bt_irgh(BT_IRQ_DEINIT, 0);
	bt_uart.Stop();
	BT_UART_PWR_OFF;
}
开发者ID:MaxNero,项目名称:SkyDrop,代码行数:9,代码来源:bt.cpp


示例12: uart_send

void uart_send(char * msg)
{
	char * ptr = msg;

	while (*ptr != 0)
	{
		uart.Write(*ptr);
		ptr++;
	}
}
开发者ID:ChrisDD11,项目名称:SkyDrop,代码行数:10,代码来源:uart.cpp


示例13: bt_module_reset

void bt_module_reset()
{
	GpioWrite(BT_EN, LOW);
	GpioWrite(BT_RESET, LOW);

	bt_uart.Stop();
	BT_UART_PWR_OFF;

	bt_reset_counter = task_get_ms_tick() + 4000;
	bt_reset_counter_step = 0;
}
开发者ID:Flyingplanet,项目名称:SkyDrop,代码行数:11,代码来源:bt.cpp


示例14: main

int main(void)
{
  leds.initHW();

  NVIC_SetPriorityGrouping( NVIC_PriorityGroup_4 );

  leds.write( 0x0F );  delay_bad_ms( 200 );
  leds.write( 0x0A );  delay_bad_ms( 200 );
  leds.reset( 0x0F );  delay_bad_ms( 200 );

  xTaskCreate( task_leds, "leds", 2*def_stksz, 0, 1, 0 );
  xTaskCreate( task_usart2_send, "send", 2*def_stksz, 0, 1, 0 );
  xTaskCreate( task_usart2_recv, "recv", 2*def_stksz, 0, 1, 0 );
  xTaskCreate( task_string_send, "ss",     def_stksz, 0, 1, 0 );

  us2.initIRQ( configKERNEL_INTERRUPT_PRIORITY, 0 );
  us2.initHW();
  us2.init();
  us2.itConfig( USART_IT_RXNE, ENABLE );
  us2.setOnRecv( on_received_char );
  us2.enable();

  vTaskStartScheduler();
  die4led( 0xFF );

  return 0;
}
开发者ID:atu-guda,项目名称:stm32ox,代码行数:27,代码来源:main.cpp


示例15: gps_stop

void gps_stop()
{
	GpioSetDirection(GPS_EN, INPUT);
	GpioSetDirection(GPS_RESET, INPUT);

	fc.gps_data.valid = false;
	fc.gps_data.fix = 0;
	fc.gps_data.fix_cnt = 0;

	GpioSetPull(GPS_TIMER, gpio_totem);

	gps_init_ok = false;
	gps_uart.Stop();
	GPS_UART_PWR_OFF;
}
开发者ID:rgagne002,项目名称:SkyDrop,代码行数:15,代码来源:gps_l80.cpp


示例16: storage_deinit

void storage_deinit()
{
	DEBUG("storage_deinit\n");

	if (!sd_avalible)
		return;

	uint8_t res;
	res = f_mount(NULL, "", 1); //unmount

	sd_spi_usart.Stop();

	sd_avalible = false;

	//power spi & sdcard
	SD_EN_OFF;
	SD_SPI_PWR_OFF;
}
开发者ID:pculka,项目名称:SkyDrop,代码行数:18,代码来源:storage.cpp


示例17: 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);
}
开发者ID:ChrisDD11,项目名称:SkyDrop,代码行数:36,代码来源:uart.cpp


示例18: storage_init

bool storage_init()
{
	uint8_t res;

	GpioSetPull(SD_IN, gpio_pull_up);
	GpioSetDirection(SD_IN, INPUT);

	DEBUG("SD_IN %d\n", GpioRead(SD_IN));

	if (!SD_CARD_DETECT)
		return false;

	//power spi & sdcard
	SD_EN_ON;
	SD_SPI_PWR_ON;

	DEBUG("Mounting SD card ... ");

	for (uint8_t i = 0; i < 5; i++)
	{
		//power spi & sdcard
		SD_EN_ON;
		SD_SPI_PWR_ON;

		res = f_mount(&FatFs, "", 1);		/* Give a work area to the default drive */
		DEBUG("%d ", i + 1);
		if (res == RES_OK)
			break;


		sd_spi_usart.Stop();

		//power spi & sdcard
		SD_EN_OFF;
		SD_SPI_PWR_OFF;

		for (uint8_t j = 0; j < i +1; j++)
			_delay_ms(10);
	}

	if (res != RES_OK)
	{
		DEBUG("Error %02X\n", res);

		sd_spi_usart.Stop();

		//power spi & sdcard
		SD_EN_OFF;
		SD_SPI_PWR_OFF;

		sd_avalible = false;

		return false;
	}

	DEBUG("OK\n");

	uint32_t size;

	FATFS * FatFs1;

	res = f_getfree("", &size, &FatFs1);

//	DEBUG1("f_getfree res = %d, size = %lu MiB", res, size / 256);

	uint32_t sector_count;

	res = disk_ioctl(0, GET_SECTOR_COUNT, &sector_count);

//	DEBUG1("GET_SECTOR_COUNT res = %d, size = %lu", res, sector_count);

	uint16_t sector_size;

	res = disk_ioctl(0, GET_SECTOR_SIZE, &sector_size);

//	DEBUG1("GET_SECTOR_SIZE res = %d, size = %u", res, sector_size);

	storage_space = sector_count * sector_size;
	storage_free_space = size * 4 * 1024;

	DEBUG("Disk info\n");
	DEBUG(" sector size  %12u\n", sector_size);
	DEBUG(" sector count %12lu\n", sector_count);
	DEBUG(" total space  %12lu\n", storage_space);
	DEBUG(" free space   %12lu\n", storage_free_space);

	sd_avalible = true;
	return true;
}
开发者ID:pculka,项目名称:SkyDrop,代码行数:89,代码来源:storage.cpp


示例19: uart_init_buffers

void uart_init_buffers()
{
	uart.InitBuffers(0, BUFFER_SIZE);
}
开发者ID:ChrisDD11,项目名称:SkyDrop,代码行数:4,代码来源:uart.cpp


示例20: gps_change_uart_baudrate

void gps_change_uart_baudrate()
{
	gps_uart.Stop();
	gps_uart.Init(GPS_UART, 115200);
}
开发者ID:rgagne002,项目名称:SkyDrop,代码行数:5,代码来源:gps_l80.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ UsdAttribute类代码示例发布时间:2022-05-31
下一篇:
C++ UsageEnvironment类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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