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

C++ UART类代码示例

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

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



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

示例1: main

int main()
{
	int l = 1;
    uint8_t c[2];

	X.output();
	Y.output();
	Z.output();
	E.output();

	setleds(l);

	if (1) {
		UART * s = new UART(0, 9600);
		s->send((uint8_t *) "Start\n", 6);

		for(;;)
		{
    		for (int i = 0 ; ((i & (1 << 22)) == 0) && !g_LoopDummy ; i++)
    		{
    		}
    		c[0] = '0' + (l & 7);
    		c[1] = '\n';
			//s->send(c, 2);
			setleds(l++);
		}
	}
}
开发者ID:CNCBASHER,项目名称:LPC1758-Skeleton,代码行数:28,代码来源:main.cpp


示例2: main

int main(void)
{
	char dutyCycle;
	UART uart;
	PWM pwm;
	uart.init();
	uart.println("*** QC-BLCD OS Startup Sequence ***");
	uart.println(" > UART initialized");
	pwm.init();
	uart.println(" > PWM initialized");

	uart.println("Startup Sequence successfull!");
	uart.println("Main program starts now");
	
	dutyCycle=0;
	

    while(42) {                       
               /*itoa(dutyCycle,msg,10);
			   println(msg);*/
			   pwm.setDutyCycle(dutyCycle);
			   dutyCycle++;
			   _delay_ms(200);

	}                        


}
开发者ID:malterik,项目名称:QC-BLDCctrl,代码行数:28,代码来源:main.cpp


示例3: uart0

namespace RODOS {
#endif

/*
 * nonblocking getc / getchar (from stdin)
 */
/****************************************************/

static UART uart0 ("uart0");

/** Returns -1 if no data, else char from getchar **/
int getcharNoWait() {
    char c;

	if (uart0.getcharNoWait(c)) return (unsigned char)c;
    else return -1;
}

bool isCharReady() {
    return uart0.isCharReady();
}

char* getsNoWait() {
	static char inBuffer[122];
	static int inBufferIndex = 0;

	while(1) { // terminated with returns

		int c= getcharNoWait();
		if(c < 0) return 0;

		if(c == '\n') { // end of string -> return
			inBuffer[inBufferIndex] = 0;
			inBufferIndex = 0;
			return inBuffer;
		}

		inBuffer[inBufferIndex] = c;
		if(inBufferIndex < 120) inBufferIndex++;
	}

}

void getUARTStats(XUartLite_Stats* stats) {
    uart0.getStats(stats);
}

void clearUARTStats() {
    uart0.clearStats();
}

#ifndef NO_RODOS_NAMESPACE
}
开发者ID:art1,项目名称:FloatSat-Project-G9,代码行数:53,代码来源:getcharnowait.cpp


示例4: main

int main()
{
   UART uart;

   std::string outputString;
   int outData;
   uart.initUart();

   std::string RPM="010C\r";
   std::string Speed="010D\r";
   
   uart.sendLine("ATZ\r");
  
   sleep(5);

   outputString = uart.receiveLineString();
   std::cout << outputString << std::endl;

   uart.sendLine(RPM);


   outData = uart.receiveLineData("010C41 0C ", 5);

   std::cout << outData << std::endl;

}
开发者ID:MulliganKyle,项目名称:LORAX,代码行数:26,代码来源:main.cpp


示例5: main

int main(void)
{
  HAL *hal = HAL::get_HAL();
  UART *uart = hal->uart;
  
  uart->init((uint32_t)115200);
 
  const int TEST_DATA_SIZE = 3;
  uint8_t test_data[TEST_DATA_SIZE] = {'!', '1', ' '};
  uint8_t recv_buff[TEST_DATA_SIZE] = {};
  
  volatile bool testOk = false;
  while(1)
  {
    int msg_size = uart->write(test_data, TEST_DATA_SIZE);
    if (msg_size == TEST_DATA_SIZE)
    {
      hal->time->delay(1000);
      int recv_bytes = uart->read(recv_buff, TEST_DATA_SIZE);
      
      if (recv_bytes == TEST_DATA_SIZE)
      {
        int i;
        for(i = 0; i < TEST_DATA_SIZE; i++)
        {
          testOk = test_data[i] == recv_buff[i];
          recv_buff[i] = 0;
          
          if (!testOk) break;
        }
      }
    }
    if (!testOk)
    {//Fail catch
      while(1){}
    }
  }
  
}
开发者ID:smart2home,项目名称:smarthome,代码行数:39,代码来源:main.cpp


示例6: main

int main()
{
    HardwareInit();

    g_Uart.printf("UART over BLE Demo\r\n");

    //g_Uart.Disable();

    BleAppInit((const BLEAPP_CFG *)&s_BleAppCfg, true);

    BleAppRun();

	return 0;
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:14,代码来源:UartBleDemo.cpp


示例7: ApplicationEntryPoint

void ApplicationEntryPoint()
{
    BOOL result;
   
    RAM         RamTest    ( (UINT32*)RAMTestBase, (UINT32)RAMTestSize, (ENDIAN_TYPE)ENDIANESS, BUS_WIDTH );
    TimedEvents eventsTest;
    UART        usartTest  ( COMTestPort, 9600, USART_PARITY_NONE, 8, USART_STOP_BITS_ONE, USART_FLOW_NONE );
    GPIO        gpioTest   ( GPIOTestPin );   
    SPI         spiTest    ( SPIChipSelect, SPIModule, g_EEPROM_STM95x );
    Timers      timersTest ( DisplayInterval, TimerDuration );

    do
    {   
        result = RamTest.Execute   ( STREAM__OUT );       
        result = eventsTest.Execute( STREAM__OUT );
        result = usartTest.Execute ( STREAM__OUT );
        result = gpioTest.Execute  ( STREAM__OUT );
        result = spiTest.Execute   ( STREAM__OUT );
        result = timersTest.Execute( STREAM__OUT );

    } while(FALSE); // run only once!

    while(TRUE);
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:24,代码来源:NativeSample.cpp


示例8: main_task

void main_task(void *pvParameters)
{
	(void) pvParameters;

	vTaskDelay(500 / portTICK_RATE_MS);

	SPIMaster spi5(SPI5, SPI_BAUDRATEPRESCALER_32, 0x2000, {
				{MEMS_SPI_SCK_PIN,  GPIO_MODE_AF_PP, GPIO_PULLDOWN, GPIO_SPEED_MEDIUM, GPIO_AF5_SPI5},
				{MEMS_SPI_MISO_PIN, GPIO_MODE_AF_PP, GPIO_PULLDOWN, GPIO_SPEED_MEDIUM, GPIO_AF5_SPI5},
				{MEMS_SPI_MOSI_PIN, GPIO_MODE_AF_PP, GPIO_NOPULL,   GPIO_SPEED_MEDIUM, GPIO_AF5_SPI5},
			}, {
				{GYRO_CS_PIN,  GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_MEDIUM, 0},
				{ACCEL_CS_PIN, GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_MEDIUM, 0},
			});

	SPIMaster spi2(SPI2, SPI_BAUDRATEPRESCALER_32, 0x2000, {
					{EXT_MEMS_SPI_SCK_PIN,  GPIO_MODE_AF_PP, GPIO_PULLDOWN, GPIO_SPEED_MEDIUM, GPIO_AF5_SPI2},
					{EXT_MEMS_SPI_MISO_PIN, GPIO_MODE_AF_PP, GPIO_PULLDOWN, GPIO_SPEED_MEDIUM, GPIO_AF5_SPI2},
					{EXT_MEMS_SPI_MOSI_PIN, GPIO_MODE_AF_PP, GPIO_NOPULL,   GPIO_SPEED_MEDIUM, GPIO_AF5_SPI2},
				}, {
					{EXT_GYRO_CS_PIN,  GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_MEDIUM, 0},
					{LPS25HB_PRESSURE_CS_PIN,  GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_MEDIUM, 0},
					{BMP280_PRESSURE_CS_PIN,  GPIO_MODE_OUTPUT_PP, GPIO_PULLUP, GPIO_SPEED_MEDIUM, 0},
				});

	L3GD20 gyro(spi5, 0);
	LPS25HB lps25hb(spi2, 1);
	BMP280 bmp2(spi2, 2);
	LSM303D accel(spi5, 1);
	uint8_t gyro_wtm = 5;
	uint8_t acc_wtm = 8;
	TimeStamp console_update_time;
	TimeStamp sample_dt;
	TimeStamp led_toggle_ts;
	FlightControl flight_ctl;
	static bool print_to_console = false;
	LowPassFilter<Vector3f, float> gyro_lpf({0.5});
	LowPassFilter<Vector3f, float> acc_lpf_alt({0.9});
	LowPassFilter<Vector3f, float> acc_lpf_att({0.990});
	LowPassFilter<float, float> pressure_lpf({0.6});
	attitudetracker att;

	/*
	 * Apply the boot configuration from flash memory.
	 */
	dronestate_boot_config(*drone_state);

	L3GD20Reader gyro_reader(gyro, GYRO_INT2_PIN, gyro_align);
	LSM303Reader acc_reader(accel, ACC_INT2_PIN, acc_align);

	UartRpcServer rpcserver(*drone_state, configdata, acc_reader.mag_calibrator_);

	bmp2.set_oversamp_pressure(BMP280_OVERSAMP_16X);
	bmp2.set_work_mode(BMP280_ULTRA_HIGH_RESOLUTION_MODE);
	bmp2.set_filter(BMP280_FILTER_COEFF_OFF);

	Bmp280Reader bmp_reader(bmp2);

	HAL_NVIC_SetPriority(DMA1_Stream6_IRQn, 1, 1);
	HAL_NVIC_EnableIRQ (DMA1_Stream6_IRQn);
	HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 1, 0);
	HAL_NVIC_EnableIRQ (DMA1_Stream5_IRQn);

#ifndef ENABLE_UART_TASK
	uart2.uart_dmarx_start();
#endif

	printf("Priority Group: %lu\n", NVIC_GetPriorityGrouping());
	printf("SysTick_IRQn priority: %lu\n", NVIC_GetPriority(SysTick_IRQn) << __NVIC_PRIO_BITS);
	printf("configKERNEL_INTERRUPT_PRIORITY: %d\n", configKERNEL_INTERRUPT_PRIORITY);
	printf("configMAX_SYSCALL_INTERRUPT_PRIORITY: %d\n", configMAX_SYSCALL_INTERRUPT_PRIORITY);
	printf("LPS25HB Device id: %d\n", lps25hb.Get_DeviceID());
	vTaskDelay(500 / portTICK_RATE_MS);

	gyro_reader.init(gyro_wtm);
	gyro_reader.enable_int2(false);

	vTaskDelay(500 / portTICK_RATE_MS);

	acc_reader.init(acc_wtm);
	acc_reader.enable_int2(false);
	acc_reader.mag_calibrator_.set_bias(drone_state->mag_bias_);
	acc_reader.mag_calibrator_.set_scale_factor(drone_state->mag_scale_factor_);
	vTaskDelay(500 / portTICK_RATE_MS);

	printf("Calibrating...");

	gyro_reader.enable_int2(true);
	gyro_reader.calculate_static_bias_filtered(2400);
	printf(" Done!\n");
	flight_ctl.start_receiver();

	printf("Entering main loop...\n");
	gyro_reader.enable_int2(true);

	sample_dt.time_stamp();
	lps25hb.Set_FifoMode(LPS25HB_FIFO_STREAM_MODE);
	lps25hb.Set_FifoModeUse(LPS25HB_ENABLE);
	lps25hb.Set_Odr(LPS25HB_ODR_25HZ);
	lps25hb.Set_Bdu(LPS25HB_BDU_NO_UPDATE);
//.........这里部分代码省略.........
开发者ID:sigmadrone,项目名称:sigmadrone,代码行数:101,代码来源:main.cpp


示例9: main

int main()
{
	bool res;

#ifdef DEMO_C
	res = UARTInit(&g_UartDev, &g_UartCfg);
#else
	res = g_Uart.Init(g_UartCfg);
#endif

	uint8_t d = 0xff;
    uint8_t val = 0;
    uint32_t errcnt = 0;
    uint32_t cnt = 0;
    auto t_start = std::chrono::high_resolution_clock::now();
    auto t_end = std::chrono::high_resolution_clock::now();
    
    std::chrono::duration<float> elapse = std::chrono::duration<float>(0);
    t_start = std::chrono::high_resolution_clock::now();

    time_t t;
    double e = 0.0;
    bool isOK = false;
//    do {
#ifdef DEMO_C
    while (UARTRx(&g_UartDev, &d, 1) <= 0);
#else
    while (g_Uart.Rx(&d, 1) <= 0);
#endif
    	if (val == d)
            isOK = true;
    	val = Prbs8(d);
 //   } while (!isOK);
    
	while(1)
	{
       // t_start = std::chrono::high_resolution_clock::now();
        t = time(NULL);
#ifdef DEMO_C
        while (UARTRx(&g_UartDev, &d, 1) <= 0);
#else
        while (g_Uart.Rx(&d, 1) <= 0);
#endif
		{
            e += difftime(time(NULL), t);
          //  t_end = std::chrono::high_resolution_clock::now();
            //elapse += std::chrono::duration<float>(t_end-t_start);
            cnt++;
            
			// If success send next code
           // printf("%x ", d);
            if (val != d)
            {
                errcnt++;
               // printf("PRBS %u errors %x %x\n", errcnt, val, d);
            }
            else if ((cnt & 0x7fff) == 0)
            {
                printf("PRBS rate %.3f B/s, err : %u\n", cnt / e, errcnt);
//                printf("PRBS rate %.3f B/s, err : %u\n", cnt / elapse.count(), errcnt);

            }
			val = Prbs8(d);
		}
	}
	return 0;
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:67,代码来源:main.cpp


示例10: clearUARTStats

void clearUARTStats() {
    uart0.clearStats();
}
开发者ID:art1,项目名称:FloatSat-Project-G9,代码行数:3,代码来源:getcharnowait.cpp


示例11: getUARTStats

void getUARTStats(XUartLite_Stats* stats) {
    uart0.getStats(stats);
}
开发者ID:art1,项目名称:FloatSat-Project-G9,代码行数:3,代码来源:getcharnowait.cpp


示例12: query

void query()
{

   ////////////////////////////////////////////////
   extern int curSpeed;
   extern int curRPM;
   extern int initFuel, prevFuel, curFuel;
   extern int initDist, curDist;
   extern int curTemp;
   extern int leftDist, rightDist;

   //Time Globals
   extern time_t rawTime;
   extern struct tm *prevTime, *curTime;
   extern int timeOffset;
   extern bool forwardMode;



   ////////////////////////////////////////////////

   int temp, count=0;
   UART uart;
   myI2C *sensorPtr0 = new myI2C();
   myI2C *sensorPtr1 = new myI2C();

   std::string RPM="010C\r";
   std::string Speed="010D\r";
   std::string Temperature="0105\r";
   std::string Fuel="012F\r";
   std::string Dist="0131\r";

   //   sensorPtr0->i2cSetAddress(DEVICE_ADDR0);
   //   sensorPtr1->i2cSetAddress(DEVICE_ADDR1);

   uart.initUart();

   uart.sendLine("ATZ\r");

   int fd = open( "/sys/class/gpio/gpio67/value", O_RDONLY | O_NONBLOCK );
   GIOChannel* channel = g_io_channel_unix_new( fd );
   GIOCondition cond = GIOCondition( G_IO_PRI );
   guint id = g_io_add_watch( channel, cond, onButtonEvent, 0 );


   usleep(5000000);



   //Get initial Distance
   //======================================
   uart.sendLine(Dist);
   temp=-1;
   while(temp==-1)
   {
      if ((temp=uart.receiveLineData("013141 31 ",5))!=-1)
      {
	 initDist=temp;
	 curDist=initDist;
      }
      usleep(500000);
   }
   //======================================

   //Get initial time
   //======================================
   time(&rawTime);
   prevTime=localtime(&rawTime);
   prevTime->tm_hour+=timeOffset;
   curTime=localtime(&rawTime);
   curTime->tm_hour+=timeOffset;
   if(prevTime->tm_hour<0)
   {
      prevTime->tm_hour+=24;
      curTime->tm_hour+=24;
   }
   //======================================

   //Get initial fuel level
   //======================================
   uart.sendLine(Fuel);
   temp=-1;
   while(temp==-1)
   {
      if ((temp=uart.receiveLineData("012F41 2F ",2))!=-1)
      {
	 initFuel=temp;
	 prevFuel=initFuel;
	 curFuel=initFuel;
      }
      usleep(500000);
   }
   //======================================

   //Query for Engine Temp
   //======================================
   uart.sendLine(Temperature);
   temp=-1;
   while(temp==-1)
   {
//.........这里部分代码省略.........
开发者ID:MulliganKyle,项目名称:LORAX,代码行数:101,代码来源:query.cpp


示例13: printk

    void printk(const char* message_) { // boring and not flexible but mandatory =/
	UART com;
	VGA v;
	v.put(message_, COLOR_WHITE);
	com.send(message_);
    }
开发者ID:newincpp,项目名称:ownKernel,代码行数:6,代码来源:main.cpp


示例14: main

int main()
{
	g_Uart.Init(s_UartCfg);

	// Retarget printf to UART
	UARTRetargetEnable(g_Uart, STDOUT_FILENO);
	UARTRetargetEnable(g_Uart, STDIN_FILENO);

	printf("Flash Memory Demo\r\n");
	getchar();

	g_Spi.Init(s_SpiCfg);

    IOPinConfig(FLASH_HOLD_PORT, FLASH_HOLD_PIN, FLASH_HOLD_PINOP, IOPINDIR_OUTPUT, IOPINRES_PULLUP, IOPINTYPE_NORMAL);

	g_FlashDiskIO.Init(s_FlashDiskCfg, &g_Spi, &g_FlashCache, 1);

	uint8_t buff[512];
	uint8_t tmp[512];
	uint16_t *p = (uint16_t*)buff;

	memset(tmp, 0, 512);
	for (int i = 0; i < 256; i++)
	{
		p[i] = i;
	}


	printf("Erasing... Please wait\r\n");

	// Ease could take a few minutes
	g_FlashDiskIO.Erase();

	printf("Writing 2KB data...\r\n");

	g_FlashDiskIO.SectWrite(0, buff);
	g_FlashDiskIO.SectWrite(2, buff);
	g_FlashDiskIO.SectWrite(4, buff);
	g_FlashDiskIO.SectWrite(8, buff);

	printf("Validate readback...\r\n");

	g_FlashDiskIO.SectRead(0, tmp);

	if (memcmp(buff, tmp, 512) != 0)
	{
		printf("Sector 0 verify failed\r\n");
	}
	else
	{
		printf("Sector 0 verify success\r\n");
	}

	memset(tmp, 0, 512);
	g_FlashDiskIO.SectRead(2, tmp);
	if (memcmp(buff, tmp, 512) != 0)
	{
		printf("Sector 2 verify failed\r\n");
	}
	else
	{
		printf("Sector 2 verify success\r\n");
	}

	memset(tmp, 0, 512);
	g_FlashDiskIO.SectRead(4, tmp);
	if (memcmp(buff, tmp, 512) != 0)
	{
		printf("Sector 4 verify failed\r\n");
	}
	else
	{
		printf("Sector 4 verify success\r\n");
	}

	memset(tmp, 0, 512);
	g_FlashDiskIO.SectRead(8, tmp);
	if (memcmp(buff, tmp, 512) != 0)
	{
		printf("Sector 8 verify failed\r\n");
	}
	else
	{
		printf("Sector 8 verify success\r\n");
	}

}
开发者ID:I-SYST,项目名称:EHAL,代码行数:87,代码来源:flash_memory_demo.cpp


示例15: main

int main()
{
	bool res;
char *data = "nRF UART Hello World\r\n";
	uint8_t buff[20];

/*	nrf_gpio_cfg_output(9);
	while (1)
	{
		nrf_gpio_pin_toggle(9);
		usDelay(1000);
	}*/
	//NRF_MPU->PERR0 &= ~(1 << 2);
	//uart_init();
	//simple_uart_config(UART_RTS_PIN, UART_TX_PIN, UART_CTS_PIN, UART_RX_PIN, false);

#ifdef C_CODE
	res = UARTInit(&g_UartDev, &g_UartCfg);
	UARTprintf(&g_UartDev, data);
#else
	res = g_Uart.Init(g_UartCfg);
	g_Uart.printf(data);dfg
#endif
//    nrf_drv_gpiote_in_config_t cts_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
//    nrf_drv_gpiote_in_init(p_comm_params->cts_pin_no, &cts_config, gpiote_uart_event_handler);

	//for (int i = 0; i < 20; i++)
	//	simple_uart_put(data[i]);
	//simple_uart_putstring((const uint8_t*)data);

	while(1) {
		uint8_t d;
		//usDelay(1000);
		//d = simple_uart_get();
		//simple_uart_put(d);
#ifndef TEST_INTERRUPT
		if (UARTRx(&g_UartDev, &d, 1) > 0)
		{
			UARTTx(&g_UartDev, &d, 1);
		//	UARTTx(&g_UartDev, (uint8_t*)data, 22);
			//usDelay(1000);
		}
#else
		int cnt = UARTRx(&g_UartDev, buff, 20);
		if (cnt > 0)
		{
			uint8_t *p = buff;
			while (cnt > 0)
			{
				int l = UARTTx(&g_UartDev, p, cnt);
				cnt -= l;
				p += l;
			}
		//	UARTTx(&g_UartDev, (uint8_t*)data, 22);
			//usDelay(1000);
		}

#endif
		//__WFI();
	}
	return 0;
}
开发者ID:t-riffel,项目名称:EHAL,代码行数:62,代码来源:main.cpp


示例16: ButEvent

void ButEvent(int IntNo)
{
	if (IntNo == 0)
	{
		if (g_bUartState == false)
		{
			g_Uart.Enable();
			g_bUartState = true;
		}
		else
		{
			g_Uart.Disable();
			g_bUartState = false;
		}
	}
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:16,代码来源:UartBleDemo.cpp


示例17: UartRxChedHandler

void UartRxChedHandler(void * p_event_data, uint16_t event_size)
{
	uint8_t buff[128];

	int l = g_Uart.Rx(buff, 128);
	if (l > 0)
	{
		BleSrvcCharNotify(&g_UartBleSrvc, 0, buff, l);
	}
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:10,代码来源:UartBleDemo.cpp


示例18: uart_task

void uart_task(void *pvParameters)
{
	char buffer[128];
	char *p;
	uint8_t tmp;
	(void)pvParameters;

	// Enable nCTS
	uart2.handle_.Instance->CR3 |= (USART_CR3_CTSE);
	for (unsigned int i = 0; true; i++) {
		snprintf(buffer, sizeof(buffer), "{\"uart_task\": %d}\n", i);
		for (p = buffer; *p; p++) {
			uart2.rx(&tmp, 0);
			if (uart2.tx(*p, 250) != HAL_OK)
				break;
		}
		vTaskDelay(350 / portTICK_RATE_MS);
	}
}
开发者ID:sigmadrone,项目名称:sigmadrone,代码行数:19,代码来源:main.cpp


示例19: HardwareInit

void HardwareInit()
{
	g_Uart.Init(g_UartCfg);

	IOPinCfg(s_LedPins, s_NbLedPins);
	IOPinSet(BLUEIO_LED_BLUE_PORT, BLUEIO_LED_BLUE_PIN);
	IOPinSet(BLUEIO_LED_GREEN_PORT, BLUEIO_LED_GREEN_PIN);
	IOPinSet(BLUEIO_LED_RED_PORT, BLUEIO_LED_RED_PIN);

	IOPinCfg(s_ButPins, s_NbButPins);

	IOPinEnableInterrupt(0, APP_IRQ_PRIORITY_LOW, s_ButPins[0].PortNo, s_ButPins[0].PinNo, IOPINSENSE_LOW_TRANSITION, ButEvent);
}
开发者ID:I-SYST,项目名称:EHAL,代码行数:13,代码来源:UartBleDemo.cpp


示例20: serialCommand

// must contain quick code only
void serialCommand(char *line) {
	// check uart1/wlan first
	if (strstr(line, "+CWLAP:(0")) {// == 0 && line[8] == '0') {
		// some pointer dangerous magic
		uint8_t apNameLength = strstr(line+11, "\"") - line - 11;
		if (apNameLength > 19) apNameLength = 19; // TODO: trim -> will result in connection error : redo datatypes
		if (data.freeAPCount < 5) {
			memset(data.freeAPList[data.freeAPCount], 0, 19);
			strncpy(data.freeAPList[data.freeAPCount], line+11, apNameLength);
			uart0.send("free ap: %s ", data.freeAPList[data.freeAPCount]);
			data.freeAPCount++;
		}
	}
	// check uart0/user commands first
	if (strcmp(line, "beep") == 0) beep();
	else if (strcmp(line, "shutdown") == 0) shutdown();
	else if (strcmp(line, "listwlan") == 0) wifi.listAP();
}
开发者ID:fluppie,项目名称:uradmonitor_d,代码行数:19,代码来源:Application.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ UARTClass类代码示例发布时间:2022-05-31
下一篇:
C++ U3DDataBlockWriter类代码示例发布时间: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