本文整理汇总了C++中UARTClass类的典型用法代码示例。如果您正苦于以下问题:C++ UARTClass类的具体用法?C++ UARTClass怎么用?C++ UARTClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UARTClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SendToWeb
// UART DATA To Raspberry
// Raspberry To Web
void SendToWeb() {
UARTClass * uart = UARTClass::getInstance();
uart->setup();
uart->startCommunicate();
while (true) {
try {
ClientSocket client("218.150.181.154", 10000);
while (true) {
try {
client << uart->getMsg(); // 웹으로 메세지 보내기
//cout << uart->getMsg() << endl;
uart->clear();
}
catch (SocketException& e) {
cout << "Exception was caught: " << e.description() << "\n";
}
delay(1000); // 10sec
}
}
catch (SocketException& e) {
cout << "ClientSocket Constructor Exception" << e.description() << endl;
}
delay(100);
}
}
开发者ID:CSEJaeHwanKim,项目名称:graduation_project,代码行数:28,代码来源:main.cpp
示例2: main
int main() {
UARTClass * uart = UARTClass::getInstance();
AltitudeController *altiCon = AltitudeController::getInstance();
UltrasonicClass *sonar = UltrasonicClass::getInstance();
DroneController *drone = DroneController::getInstance();
uart->setup();
uart->startCommunicate();
// *************** ( ^_^ )*****************
thread serverTh([&]() { RecvFromWeb(); });
serverTh.detach();
//thread clientTh([&]() { SendToWeb(); });
//clientTh.detach();
// *****************************************
delay(3000);
while (1) {
uart->SendSerial(drone->get_pwm_string());
cout << "throttle : " << drone->get_pwm(droneControlType::throttle) << endl;
if (is_takeoff) {
altiCon->calculate();
}
delay(100);
}
return 0;
}
开发者ID:CSEJaeHwanKim,项目名称:graduation_project,代码行数:28,代码来源:main.cpp
示例3: _write
int _write (int fd, char *ptr, int len)
{
char *p = ptr;
int res = UART_SUCCESS;
(void)fd;
(void)len;
while (*p != '\n') {
UART.WriteChar(*p++);
if (res != UART_SUCCESS) {
break;
}
}
if(*p == '\n') {
UART.WriteChar('\r');
UART.WriteChar('\n');
}
return res;
}
开发者ID:analogdevicesinc,项目名称:EVAL-ADICUP360,代码行数:26,代码来源:Communication.cpp
示例4: initVariant
void initVariant()
{
Serial.begin(115200);
Serial1.begin(115200);
Serial2.begin(115200);
Serial3.begin(115200);
Serial4.begin(115200);
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:8,代码来源:variant.cpp
示例5: check_for_reset
void check_for_reset()
{
if(Serial.isResetReceived() || Serial1.isResetReceived())
{
SCB->AIRCR = 0x05FA0004;
//BOOT_reset();
}
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:8,代码来源:variant.cpp
示例6: serialEventRun
void serialEventRun(void)
{
if (Serial.available() && serialEvent) serialEvent();
if (Serial1.available() && serialEvent) serialEvent();
if (Serial2.available() && serialEvent) serialEvent();
if (Serial3.available() && serialEvent) serialEvent();
if (Serial4.available() && serialEvent) serialEvent();
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:9,代码来源:variant.cpp
示例7: serialEventRun
void serialEventRun(void)
{
if (Serial.available()) serialEvent();
if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2();
if (Serial3.available()) serialEvent3();
}
开发者ID:faisalomar,项目名称:Alligator-Repetier-Firmware,代码行数:7,代码来源:variant.cpp
示例8: UART0_Stop
void UART0_Stop()
{
if (UART0_State == UART0_State_NotStarted)
return;
// Wait for any outstanding data to be sent
Serial.flush();
NRF_UART0->TASKS_STOPTX = 1;
NRF_UART0->TASKS_STOPRX = 1;
NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos);
// Disable UART interrupt in NVIC
detachInterrupt(UART0_IRQn);
// Disconnect high drive tx pin
int tx_pin = NRF_UART0->PSELTXD;
NRF_GPIO->PIN_CNF[tx_pin] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
| (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos)
| (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)
| (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
UART0_State = UART0_State_NotStarted;
}
开发者ID:A-L-E-X,项目名称:RFduino,代码行数:26,代码来源:variant.cpp
示例9:
// IT handlers
unsigned long
uart5IntFunction(void *pvCBData, unsigned long ulEvent,
unsigned long ulMsgParam,void *pvMsgData)
{
// while(Serial5.uartInt()==0);
Serial5.uartInt();
return 0;
}
开发者ID:AndersonBY,项目名称:MegaMind,代码行数:9,代码来源:variant.cpp
示例10:
//void UART0_IRQHandler( void )
static void UART0_handler( void )
{
Serial.irq_handler();
/*
if( NRF_UART0->EVENTS_RXDRDY )
{
NRF_UART0->EVENTS_RXDRDY = 0;
uint8_t dat = NRF_UART0->RXD;
if( UART0_CheckRXError() )
return;
rx_buffer->store_char( dat );
}
*/
}
开发者ID:A-L-E-X,项目名称:nRF51822-Arduino,代码行数:18,代码来源:wuart.cpp
示例11: _read
int _read(int fd, char *ptr, int len)
{
(void)fd;
(void)len;
while(read_ch == false);
*ptr = Rx_char;
UART.WriteChar(*ptr);
printf("\n");
read_ch = false;
return 1;
}
开发者ID:analogdevicesinc,项目名称:EVAL-ADICUP360,代码行数:17,代码来源:Communication.cpp
示例12: Rx3_Handler
void Rx3_Handler(void){
Serial3.RxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例13: Tx3_Handler
void Tx3_Handler(void){
Serial3.TxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例14: Rx2_Handler
void Rx2_Handler(void){
Serial2.RxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例15: Tx2_Handler
void Tx2_Handler(void){
Serial2.TxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例16: Rx1_Handler
void Rx1_Handler(void){
Serial1.RxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例17: LEUART0_IRQHandler
void LEUART0_IRQHandler(void)
{
Serial1.IrqHandler();
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:4,代码来源:variant.cpp
示例18: Tx1_Handler
void Tx1_Handler(void){
Serial1.TxHandler();
}
开发者ID:ekawahyu,项目名称:HALMX_Arduino_STM32,代码行数:3,代码来源:variant.cpp
示例19: LEUART1_IRQHandler
void LEUART1_IRQHandler(void)
{
Serial2.IrqHandler();
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:4,代码来源:variant.cpp
示例20: UART1_Handler
// IT handlers
void UART1_Handler(void)
{
Serial1.IrqHandler();
}
开发者ID:digitalcarmona,项目名称:ArduinoCodebase,代码行数:5,代码来源:variant.cpp
注:本文中的UARTClass类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论