本文整理汇总了C++中sendByte函数的典型用法代码示例。如果您正苦于以下问题:C++ sendByte函数的具体用法?C++ sendByte怎么用?C++ sendByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendByte函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendInt
void sendInt(unsigned int intToSend){
unsigned int upperByte;
unsigned int lowerByte;
upperByte=intToSend & 0xFF00;//clear lower bits
upperByte=upperByte >> 8; //shift to make it a char
lowerByte=intToSend & 0x00FF; //clear upper bits
sendByte(upperByte);
sendByte(lowerByte);
} //sendInt()
示例2: cm_read_caster_wheel_drop
/**
* Returns 1 if the caster wheel is dropped.
*/
uint8_t cm_read_caster_wheel_drop(void)
{
sendByte(CmdSensors);
padCommand();
sendByte(SEN_BUMP_DROP);
endCommand();
if (readByte() & 0x10)
return 1;
else
return 0;
}
示例3: cm_read_right_bumper
/**
* Returns 1 if the right bumper is pressed.
*/
uint8_t cm_read_right_bumper(void)
{
sendByte(CmdSensors);
padCommand();
sendByte(SEN_BUMP_DROP);
endCommand();
if (readByte() & 0x01)
return 1;
else
return 0;
}
示例4: cm_digital_outputs
/**
* Sets the digital outputs on the Create's cargo bay connector.
* @param pin*: Turns the pin on if non-zero.
* Note 1: Not used in simulations.
* Note 2: Only available on Create robots. Does nothing on Roomba or Scooba robots.
*/
void cm_digital_outputs(const uint8_t &pin0, const uint8_t &pin1, const uint8_t &pin2)
{
uint8_t b = 0;
if (pin0) b |= 0x01;
if (pin1) b |= 0x02;
if (pin2) b |= 0x04;
sendByte(CmdOutputs);
padCommand();
sendByte(b);
endCommand();
}
示例5: sendByte
// Send a Midi CC message to a given channel, as a given controller 0-127, with given
// value 0-127
void Midi::sendControlChange(unsigned int channel, unsigned int controller, unsigned int value)
{
int status = STATUS_EVENT_CONTROL_CHANGE | ((channel - 1) & 0x0f);
if (sendFullCommands_ || (lastStatusSent_ != status)) {
sendByte(status);
}
sendByte(controller & 0x7f);
sendByte(value & 0x7f);
}
示例6: sendHeader
void iPodSerial::sendCommand(
byte mode,
byte cmdByte1,
byte cmdByte2)
{
sendHeader();
sendLength(1 + 1 + 1);
sendByte(mode);
sendByte(cmdByte1);
sendByte(cmdByte2);
sendChecksum();
}
示例7: sendFrame1
inline void sendFrame1(unsigned int value)
{
unsigned int checksum=0xaa;
serial_write(HDLC_frameFlag);
sendByte(value);
checksum ^= value;
sendByte(checksum);
serial_write(HDLC_frameFlag);
}
示例8: sendByte
void CompactQik2s9v1::motor1Forward(uint8_t speed)
{
if ( speed > 127 )
{
sendByte(MOTOR1FORWARDFASTPACKET);
sendByte(speed-127);
}
else
{
sendByte(MOTOR1FORWARDPACKET);
sendByte(speed);
}
}
示例9: accelReadReg
/*
Reads a value from a ADXL345 register and returns it
*/
unsigned int accelReadReg(const Accel *a, int reg){
int I2C = a->I2C;
sendStart(I2C); // start transaction
sendByte(I2C, a->write); // write accel device
sendByte(I2C, reg); // specify device register
repeatStart(I2C);
sendByte(I2C, a->read); // read accel device
unsigned int d = readByte(I2C); // grab data
I2CAcknowledgeByte(I2C, 0); // Send nack
while(!I2CAcknowledgeHasCompleted(I2C));
I2CStop(I2C); // end transaction
return d;
}
示例10: KDC_5060R_receive
void KDC_5060R_receive(void){
GPIO_ResetBits(CE_Port,CE_Pin);
sendByte(CMD_OUTPUT);
GPIO_SetBits(CE_Port,CE_Pin);
key_data[0]=sendByte(0);
key_data[1]=sendByte(0);
key_data[2]=sendByte(0);
key_data[3]=sendByte(0);
GPIO_ResetBits(CE_Port,CE_Pin);
}
示例11: read_adcNS
byte read_adcNS(byte ch, u16* iv) // Read ADC, without entering SLEEP mode
{
byte res[2];
if ((ch < 0) || (ch > 12))
return INVARG;
sendByte(READADC);
sendByte(ch);
*res = COMERR;
sread(1, res);
if (*res != 'D') return *res;
if(sread(2, res) != 2) return COMERR;
*iv = res[0] | (res[1] << 8);
return 0;
}
示例12: sendString
void sendString(void){
consoleDrawText(7, 5, "sending...");
int length = strlen(str);
sendByte(length);
int i;
for(i=0;i<length;i++){
sendByte(str[i]);
}
}
示例13: start
uint8_t I2C::write(uint8_t address, uint8_t registerAddress, uint8_t data)
{
returnStatus = 0;
returnStatus = start();
if(returnStatus){return(returnStatus);}
returnStatus = sendAddress(SLA_W(address));
if(returnStatus){return(returnStatus);}
returnStatus = sendByte(registerAddress);
if(returnStatus){return(returnStatus);}
returnStatus = sendByte(data);
if(returnStatus){return(returnStatus);}
returnStatus = stop();
return(returnStatus);
}
示例14: disable_actions
//------------------- Modifiers for Capture ------------------------------
byte disable_actions()
{
// Disable all modifiers to the capture call. The capture calls will be set to
// do analog triggering on the first channel captured.
byte res[1];
sendByte(SETACTION);
sendByte(AANATRIG);
sendByte(0); //Self trigger on channel zero means the first channel captured
*res = COMERR;
sread(1,res);
if(*res != 'D') return *res;
return 0;
}
示例15: sendByte
void ChainableLED::setColorRGB(byte led, byte red, byte green, byte blue)
{
// Send data frame prefix (32x "0")
sendByte(0x00);
sendByte(0x00);
sendByte(0x00);
sendByte(0x00);
// Send color data for each one of the leds
for (byte i=0; i<_num_leds; i++)
{
if (i == led)
{
_led_state[i*3 + _CL_RED] = red;
_led_state[i*3 + _CL_GREEN] = green;
_led_state[i*3 + _CL_BLUE] = blue;
}
sendColor(_led_state[i*3 + _CL_RED],
_led_state[i*3 + _CL_GREEN],
_led_state[i*3 + _CL_BLUE]);
}
// Terminate data frame (32x "0")
sendByte(0x00);
sendByte(0x00);
sendByte(0x00);
sendByte(0x00);
}