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

C++ sendByte函数代码示例

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

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



在下文中一共展示了sendByte函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:duckboy81,项目名称:gitMe,代码行数:11,代码来源:XBeeModule.c


示例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;
}
开发者ID:raceimaztion,项目名称:createSimulator,代码行数:15,代码来源:main.cpp


示例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;
}
开发者ID:raceimaztion,项目名称:createSimulator,代码行数:15,代码来源:main.cpp


示例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();
}
开发者ID:raceimaztion,项目名称:createSimulator,代码行数:18,代码来源:main.cpp


示例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);
}
开发者ID:tymmothy,项目名称:TymmsArduinoMIDI,代码行数:14,代码来源:Midi.cpp


示例6: sendHeader

void iPodSerial::sendCommand(
    byte mode,
    byte cmdByte1,
    byte cmdByte2)
{
    sendHeader();
    sendLength(1 + 1 + 1);
    sendByte(mode);
    sendByte(cmdByte1);
    sendByte(cmdByte2);
    sendChecksum();
}
开发者ID:Blind029,项目名称:arduinaap,代码行数:12,代码来源:iPodSerial.cpp


示例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);
}
开发者ID:LOGre,项目名称:fpgaSynths,代码行数:12,代码来源:linestream.c


示例8: sendByte

void CompactQik2s9v1::motor1Forward(uint8_t speed)
{
	if ( speed > 127 )
	{
		sendByte(MOTOR1FORWARDFASTPACKET);
		sendByte(speed-127);	
	}
	else
	{
		sendByte(MOTOR1FORWARDPACKET);
		sendByte(speed);
	}
}
开发者ID:buzztoy,项目名称:qik2s9v1arduino,代码行数:13,代码来源:CompactQik2s9v1.cpp


示例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;
}
开发者ID:conorpp,项目名称:school,代码行数:16,代码来源:main.c


示例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);
}
开发者ID:Alx2000y,项目名称:stm32f103_projects,代码行数:13,代码来源:KDC_5060R.c


示例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;
	}
开发者ID:ArunJayan,项目名称:expeyes-programs,代码行数:14,代码来源:ejlib.c


示例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]);
	}

}
开发者ID:Aliandrana,项目名称:snesnet,代码行数:14,代码来源:Mode1.c


示例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);
}
开发者ID:bubgum,项目名称:crw-cmu,代码行数:14,代码来源:I2C.cpp


示例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;
	}
开发者ID:ArunJayan,项目名称:expeyes-programs,代码行数:15,代码来源:ejlib.c


示例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);
}
开发者ID:AeroDoms,项目名称:GrovePi,代码行数:29,代码来源:ChainableLED.cpp


示例16: fillAddressBuffer

int SoftwareI2CPort::send(uint8_t address, uint32_t subaddress, uint32_t subaddressLength, const void * data, uint32_t dataLength)
{
    fillAddressBuffer(address, subaddress, subaddressLength);
    
    m_scl.setDirection(GpioPin::kInput);
    m_sda.setDirection(GpioPin::kInput);

    m_scl.clear();
    m_sda.clear();

    sendStart();

    bool ret = sendByte((address << 1), true);
    if (!ret)
    {
        sendStop();
    
        return I2C_ERROR_NO_SLAVE_ACK;
    }

    const uint8_t * subaddressData = (const uint8_t *)&m_addressBuffer[1];
    while (subaddressLength--)
    {
        ret = sendByte(*subaddressData++, true);
        if (!ret)
        {
            sendStop();
    
            return I2C_ERROR_GOT_NAK;
        }
    }

    const uint8_t * transfer_data = reinterpret_cast<const uint8_t *>(data);
    uint32_t u16Size = dataLength;
    while (u16Size--)
    {
        ret = sendByte(*transfer_data++, true);
        if (!ret)
        {
            sendStop();
    
            return I2C_ERROR_GOT_NAK;
        }
    }

    sendStop();
    
    return I2C_OK;
}
开发者ID:mohammedgomaa,项目名称:Cute-references,代码行数:49,代码来源:software_i2c_port.cpp


示例17: setMode

void FrSkySportSingleWireSerial::sendEmpty(uint16_t dataTypeId)
{
  if(port != NULL)
  {
    setMode(TX);
    sendByte(0x00);
    uint8_t *bytes = (uint8_t*)&dataTypeId;
    sendByte(bytes[0]);
    sendByte(bytes[1]);
    for(uint8_t i = 0; i < 4; i++) sendByte(0x00);
    sendCrc();
    port->flush();
    setMode(RX);
  }
}
开发者ID:variostudio,项目名称:FrSkySportTelemetry,代码行数:15,代码来源:FrSkySportSingleWireSerial.cpp


示例18: cm_set_leds

/**
 * Controls the LEDs on top of the robot.
 *   @param play Turns the Play light on if non-zero.
 *   @param advance Turns the Advance light on if non-zero.
 *   @param power_color Sets the shade of the Power light between green (at 0) and orange (at 255).
 *   @param power_intensity Sets the brightness of the Power light from off (at 0) to full brightness (at 255).
 */
void cm_set_leds(const uint8_t &play, const uint8_t &advance, const uint8_t &power_color, const uint8_t &power_intensity)
{
	uint8_t b = 0;
	if (play)		b |= LEDPlay;
	if (advance)	b |= LEDAdvance;
	
	sendByte(CmdLeds);
	padCommand();
	sendByte(b);
	padCommand();
	sendByte(power_color);
	padCommand();
	sendByte(power_intensity);
	endCommand();
}
开发者ID:raceimaztion,项目名称:createSimulator,代码行数:22,代码来源:main.cpp


示例19: setLeds

void setLeds(BYTE out[2]) {

    // We start with the lowest bit, and moving towards the higher
    sendByte(out[1]);
    sendByte(out[0]);

    
    lLatch_On();
    Nop();
    Nop();
    Nop();
    Nop();
    Nop();
    Nop();
    lLatch_Off();
}
开发者ID:mrbig,项目名称:x-openpanels-hw,代码行数:16,代码来源:led_driver.c


示例20: main

/**************************************************************************//**
*
* main
*
* @brief      main function
*
* @param      -
*
* @return     -
*
******************************************************************************/
void main(void)
{
  uint8_t data;

  // source ACLK with internal VLO clock
  BCSCTL3 |= LFXT1S_2;

  // Set DCO register value based on the selected input clock frequency
  BCSCTL1 = BCSCTL1_VAL;
  DCOCTL = DCOCTL_VAL;

  // set GPIO as UART pins - P1.1=UCA0RXD, P1.2=UCA0TXD
  P1SEL = BIT1 + BIT2 ;
  P1SEL2 = BIT1 + BIT2;

  // setup USCI UART registers
  UCA0CTL1 |= UCSSEL_2 + UCSWRST;
  UCA0BR0 = USCI_BR0_VAL;
  UCA0BR1 = USCI_BR1_VAL;
  UCA0MCTL = USCI_BRS_VAL;
  UCA0CTL1 &= ~UCSWRST;

  // do somekind of splash screen
  splash();

  while(1)
  {
    if(rcvByte(&data) == true)
    {
      // echo back the received data
      sendByte(data);
    }
  }
}
开发者ID:Claoo,项目名称:lhend-code-collection,代码行数:45,代码来源:msp430g2553_uart_echo.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ sendChar函数代码示例发布时间:2022-05-30
下一篇:
C++ sendBuffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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