本文整理汇总了C++中sendChar函数的典型用法代码示例。如果您正苦于以下问题:C++ sendChar函数的具体用法?C++ sendChar怎么用?C++ sendChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendChar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parse_ctc
int parse_ctc(char s[])
{
char ctc[11];
unsigned char i = 3, j = 0;
while( (s[i] != '\0') && (j <= 11) )
{
if( (s[i] >= '0') && (s[i] <= '9') )
{
ctc[j++] = s[i++];
}
else
{
sendFString(ERROR_NONINT);
sendChar(s[i]);
sendChar('\r');
return 0;
}
}
ctc[j] = '\0';
if(j>4)// must be < 256
{
sendFString(ERROR_NUMTOLARGE);
return 0;
}
else
{
set_ctc(atoi(ctc));
}
return 1;
}
开发者ID:bnnttlee,项目名称:CIS541_Pacemaker,代码行数:35,代码来源:Demonstrator.c
示例2: sendString
bool InterfaceAvr::sendString(QString string, QString callingClassName)
{
// QString debugstring;
// emit message(">>> sendString");
// send starter
if (sendChar(starter, callingClassName) == true)
{
// send 'content' of string
// debugstring = "*";
for (int i=0; i<string.length(); i++)
{
// char by char
if (sendChar(string.at(i).toAscii(), callingClassName) == false)
{
return false;
}
// debugstring.append(string.at(i));
}
// send terminator
if (sendChar(terminator, callingClassName) == true)
{
// success
// debugstring.append("#");
// emit message(debugstring);
return true;
}
}
return false;
}
开发者ID:markusk,项目名称:SMS2Speech,代码行数:33,代码来源:interfaceAvr.cpp
示例3: header
//======================================================================
// Get a header record. If its not an empty one, open the output
// file.
//======================================================================
static int
header(SerialPort& port)
{
// Get a header sector (sector 0)
sendChar(port, NAK);
int block = getBlock(port, blockBuf);
if (block == ERROR)
return ERROR;
if (block != 0) {
exitCode = 3;
return ERROR;
}
sendChar(port, ACK);
// If its a empty header, just return
if (blockBuf[0] == 0)
return OK;
// Get the number of bytes in the file
bytesLeft = 2000000000L;
char* ptr = blockBuf + 1 + strlen(blockBuf);
if (*ptr)
sscanf(ptr, "%ld", &bytesLeft);
// Try to open the filename
outputFile = fopen(blockBuf, "w");
if (outputFile == NULL) {
exitCode = 4;
return ERROR;
}
printf("Receiving %s (%ld)\n", blockBuf, bytesLeft);
return OK;
}
开发者ID:cwarden,项目名称:quasar,代码行数:39,代码来源:recv_xmodem.cpp
示例4: stmSendTrajectory
/* -------------------------------------------------------------------- */
void stmSendTrajectory(float elevatorTrajectory[5], float aileronTrajectory[5]) {
char crc = 0;
sendChar(usart_buffer_stm, 'a', &crc); // this character initiates the transmission
sendChar(usart_buffer_stm, 1 + 5*4 + 5*4, &crc); // this will be the size of the message
sendChar(usart_buffer_stm, 't', &crc); // id of the message
int i;
// send the elevator trajectory
for (i = 0; i < 5; i++) {
sendFloat(usart_buffer_stm, elevatorTrajectory[i], &crc);
}
// send the aileron trajectory
for (i = 0; i < 5; i++) {
sendFloat(usart_buffer_stm, aileronTrajectory[i], &crc);
}
// at last send the crc, ends the transmission
sendChar(usart_buffer_stm, crc, &crc);
}
开发者ID:klaxalk,项目名称:multirotor-control-board,代码行数:27,代码来源:mpcHandler.c
示例5: sendChar
void TxUART::sendNumber(unsigned int sendMe){
sendChar(((sendMe / 10000)%10)+48);
sendChar(((sendMe / 1000)%10)+48);
sendChar(((sendMe / 100)%10)+48);
sendChar(((sendMe / 10)%10)+48);
sendChar(((sendMe)%10)+48);
}
开发者ID:stuffekarl,项目名称:PRJ2,代码行数:7,代码来源:TxUART.cpp
示例6: muckle_over
void muckle_over(int awardQP) {
CharData *i;
int reward = 0;
for(i = character_list; i; i = i->next) {
sendChar(i, "The quest is over.\r\n");
REMOVE_BIT_AR(PRF_FLAGS(i), PRF_QUEST);
if(!awardQP)
break;
reward = i->muckleTime/60 + (i->muckleTime % 60 > 0 ? 1:0);
if(i->muckleTime == muckle_duration * 60)
reward += 2;
if(!IS_NPC(i) && reward) {
sendChar(i, "You have been awarded %d quest points for your effort.\r\n", reward);
GET_QP(i) += reward;
mudlog(BRF, LVL_IMMORT, TRUE, "%s has received %d quest points for %s efforts in muckle.",
GET_NAME(i), reward, HSHR(i));
}
i->muckleTime = 0;
}
CONFIG_QUEST_ACTIVE = 0;
}
开发者ID:Lundessa,项目名称:NewRavenVM,代码行数:27,代码来源:muckle.c
示例7: ansi_me
void ansi_me(void)
{
// ANSI turn off all attribute: me=\E[0m
sendChar(27);
sendChar('[');
sendChar('0');
sendChar('m');
}
开发者ID:Ernie99,项目名称:avr-info-web-server,代码行数:8,代码来源:TermCtrl.c
示例8: sendChar
void TiBasicEditor::sendKey(SDL_keysym k1)
{
SDLKey k=k1.sym;
if (keyParser::isChar(k1))
{
sendChar(keyParser::getChar(k1));
return;
}
if (_isInSpecialCommandsMenu)
{
switch (k)
{
case SDLK_RETURN:
sendChar( _specialsCommandsMenu->getSelectedString()[0]);
_isInSpecialCommandsMenu=false;
reDisplay();
return;
case SDLK_DELETE:
_isInSpecialCommandsMenu=false;
reDisplay();
return;
default:
_specialsCommandsMenu->sendKey(k1);
}
}
else
{
switch (k)
{
case SDLK_DELETE:
rmChar();
break;
case SDLK_UP:
changeLine(true);
break;
case SDLK_DOWN:
changeLine(false);
break;
case SDLK_LEFT:
changeCursorPos(true);
break;
case SDLK_RIGHT:
changeCursorPos(false);
break;
case SDLK_RETURN:
addLine();
break;
case SDLK_LALT:
_isInSpecialCommandsMenu=true;
_specialsCommandsMenu->reDisplay();
break;
}
}
}
开发者ID:2mac,项目名称:ti,代码行数:55,代码来源:tiBasicEditor.cpp
示例9: menu
void menu ( void )
{
sendChar ( '\r' );
sendString ( "Menu\r" );
sendString ( "a. Add\r" );
sendString ( "b. Sub\r" );
sendString ( "c. Mult\r" );
sendString ( "d. Integer division\r" );
sendString ( "e. Decimal division\r" );
sendChar ( '\r' );
}
开发者ID:HoboJ,项目名称:avr,代码行数:11,代码来源:demo.c
示例10: getBlock
//======================================================================
// Get a whole block. Handles checksums, ...
//======================================================================
static int
getBlock(SerialPort& port, char* block)
{
int checksum;
int ch;
int blockNum;
for (int errorCnt = 0; errorCnt < RETRY_MAX; errorCnt++) {
ch = recvChar(port, 2);
if (ch == EOT) {
sendChar(port, ACK);
return GOT_EOT;
}
if (ch == CAN) {
exitCode = 7;
return ERROR;
}
if (ch == SOH || ch == STX) {
if (ch == SOH)
blockLen = 128;
else
blockLen = 1024;
blockNum = recvChar(port, 2);
ch = recvChar(port, 2);
if (blockNum + ch == 0377) {
checksum = 0;
char* p = block;
for (int cnt = 0; cnt < blockLen; cnt++) {
ch = recvChar(port, 2);
checksum += (*p++ = ch);
}
ch = recvChar(port, 2);
if (((checksum - ch) & 0377) == 0)
return blockNum;
exitCode = 8;
}
}
if (ch == TIMEOUT)
exitCode = 9;
flushInput(port);
sendChar(port, NAK);
}
return ERROR;
}
开发者ID:cwarden,项目名称:quasar,代码行数:54,代码来源:recv_xmodem.cpp
示例11: stmSetKalmanPosition
/* -------------------------------------------------------------------- */
void stmSetKalmanPosition(float elevatorPos, float aileronPos) {
char crc = 0;
sendChar(usart_buffer_stm, 'a', &crc); // this character initiates the transmission
sendChar(usart_buffer_stm, 1 + 2*4, &crc); // this will be the size of the message
sendChar(usart_buffer_stm, '3', &crc); // id of the message
sendFloat(usart_buffer_stm, elevatorPos, &crc);
sendFloat(usart_buffer_stm, aileronPos, &crc);
// at last send the crc, ends the transmission
sendChar(usart_buffer_stm, crc, &crc);
}
开发者ID:klaxalk,项目名称:multirotor-control-board,代码行数:16,代码来源:mpcHandler.c
示例12: stmResetKalman
/* -------------------------------------------------------------------- */
void stmResetKalman(float initElevator, float initAileron) {
char crc = 0;
sendChar(usart_buffer_stm, 'a', &crc); // this character initiates the transmission
sendChar(usart_buffer_stm, 1 + 2*4, &crc); // this will be the size of the message
sendChar(usart_buffer_stm, '2', &crc); // id of the message
sendFloat(usart_buffer_stm, initElevator, &crc);
sendFloat(usart_buffer_stm, initAileron, &crc);
// at last send the crc, ends the transmission
sendChar(usart_buffer_stm, crc, &crc);
}
开发者ID:klaxalk,项目名称:multirotor-control-board,代码行数:16,代码来源:mpcHandler.c
示例13: sendChar
void LCD1602::sendString (const char str[])
{
uint8_t i;
for(i = 0; str[i] != '\0'; i++)
sendChar(str[i]);
}
开发者ID:LittleBuster,项目名称:SimpleSecuritySystem15,代码行数:7,代码来源:lcd1602.cpp
示例14: sendString
void sendString(char* string, u8 len)
{
u8 i;
for (i=0;i<len;i++)
sendChar(string[i]);
}
开发者ID:12019,项目名称:nitrokey-storage-firmware,代码行数:7,代码来源:keyboard.c
示例15: stmSendSetpoint
/* -------------------------------------------------------------------- */
void stmSendSetpoint(float elevatorSetpoint, float aileronSetpoint) {
char crc = 0;
sendChar(usart_buffer_stm, 'a', &crc); // this character initiates the transmission
sendChar(usart_buffer_stm, 1 + 2*4, &crc); // this will be the size of the message
sendChar(usart_buffer_stm, 's', &crc); // id of the message
// sends the payload
sendFloat(usart_buffer_stm, elevatorSetpoint, &crc);
sendFloat(usart_buffer_stm, aileronSetpoint, &crc);
// at last send the crc, ends the transmission
sendChar(usart_buffer_stm, crc, &crc);
}
开发者ID:klaxalk,项目名称:multirotor-control-board,代码行数:17,代码来源:mpcHandler.c
示例16: sendString
/*****************************************************************************
DISCRIPTION : 文字列送信
ARGUMENT : pConsReg = コンソールバッファ
pcStr = 送信文字列
iLen = 送信する文字列の長さ
RETURN : -
NOTE : 割込処理とスレッドから呼ばれるが送信バッファを操作しており
再入不可のため、スレッドから呼び出す場合は排他のため
割込禁止状態で呼ぶこと。
UPDATED : 2014-06-22
*****************************************************************************/
static void sendString(CONS_DRV_REG* pConsReg, char* pcStr, int iLen)
{
int i;
for(i = 0; i < iLen; i++){
pConsReg->pcSendBuf[pConsReg->iSendLen] = pcStr[i];
pConsReg->iSendLen++;
}
/*
送信割込無効ならば、送信開始されていないので送信開始する。
送信割込有効ならば、送信開始されており、送信割込の延長で
送信バッファ内のデータが順次送信されるので、何もしなくて良い。
*/
if(pConsReg->iSendLen != 0){ /* 送信サイズが0でない */
/* 割込無効である */
if(srlIntrIsSendEnable(pConsReg->iIdx) == FALSE){
srlIntrSetSendEnable(pConsReg->iIdx);
/*
送信割込を有効化して先頭の1文字を出力する。
後続の文字は、送信完了後に送信割込の延長で
送信される。
*/
sendChar(pConsReg);
}
}
return;
}
开发者ID:TokiSasaki,项目名称:KOZOS_with_MONIX,代码行数:40,代码来源:consdrv.c
示例17: clearScreen
/**
* Clear the display and print the character c at (0,0)
* @param c Character to be printed
*/
void LCD5110::printChar(byte c){
clearScreen();
setOrigin();
sendChar(c);
}
开发者ID:a-dma,项目名称:LCD5110,代码行数:11,代码来源:LCD5110.cpp
示例18: main
task main()
{
// Setup the two UART ports
//configureSerialPort(uartOne, uartUserControl);
//configureSerialPort(uartTwo, uartUserControl);
setBaudRate(uartOne, baudRate115200);
setBaudRate(uartTwo, baudRate115200);
while (getChar(uartTwo) != -1) // Purge existing chars from buffer
{}
StartTask(UARTReceive);
while (true)
{
// Loop forever transmitting the characters 0, 1, 2, ..., 255, 0, 1, 2, ....
for (int i = 0; i < 20; ++i)
{
++nTotalXmitChars;
xmitChar = nTotalXmitChars % 256;
sendChar(uartOne, xmitChar);
}
while (!bXmitComplete(uartOne))
{
wait1Msec(1);
}
}
}
开发者ID:ehsanmasdar,项目名称:gateway-2012,代码行数:31,代码来源:UARTPortTest.c
示例19: sendChar
void TarryTown::p_sendText(QScriptValue target,QString text) {
int i;
for (i = 0; i < text.length(); i++) {
QChar c = text.at(i);
sendChar(c.toAscii());
}
}
开发者ID:jasonknight,项目名称:ichabod,代码行数:7,代码来源:tarrytown.cpp
示例20: handleLayer1SpecialCases
bool handleLayer1SpecialCases(KBDLLHOOKSTRUCT keyInfo)
{
switch(keyInfo.scanCode) {
case 13:
sendChar(L'`', keyInfo);
keybd_event(VK_SPACE, 0, 0, 0);
return true;
case 27:
sendChar(L'´', keyInfo);
keybd_event(VK_SPACE, 0, 0, 0);
return true;
default:
return false;
}
}
开发者ID:owdee,项目名称:neo2-llkh,代码行数:16,代码来源:main.c
注:本文中的sendChar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论