本文整理汇总了C++中BT类的典型用法代码示例。如果您正苦于以下问题:C++ BT类的具体用法?C++ BT怎么用?C++ BT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: settings_load
void settings_load()
{
eeprom_read_block((void*)&conf, &conf_eep, sizeof(settings_t));
if(settings_camera_index > 0)
{
eeprom_read_block((void*)&conf.camera, &camera_settings_eep[settings_camera_index - 1], sizeof(camera_settings_t));
}
if(conf.lcdContrast > 0xf || conf.lcdContrast < 0x1) conf.lcdContrast = 0x8;
if(conf.lcdCoefficent > 0x7 || conf.lcdCoefficent < 0x3) conf.lcdCoefficent = 0x7;
if(conf.lcdBias > 0x4 || conf.lcdBias < 0x3) conf.lcdBias = 0x4;
if(conf.apertureMin > 100 || conf.apertureMin < 2) conf.apertureMin = 2;
if(conf.lightIntegrationMinutes == 255 || conf.lightIntegrationMinutes == 0) conf.lightIntegrationMinutes = 10;
if(conf.camera.brampGap > 20 || conf.camera.brampGap == 0) conf.camera.brampGap = 6;
if(conf.errorAlert > 5) conf.errorAlert = 0;
if(conf.linearInterpolation > 1) conf.linearInterpolation = 0;
lcd.color(conf.lcdColor);
ir.init();
ir.make = conf.camera.cameraMake;
if(conf.auxPort != AUX_MODE_DISABLED)
{
aux1_off();
aux2_off();
}
if(bt.present && !remote.connected)
{
if(conf.btMode == BT_MODE_SLEEP) bt.sleep(); else bt.advertise();
}
}
示例2:
vector<string> Solution::prefix(vector<string> &A)
{
BT p;
for(int i=0;i<A.size();i++)
p.insert(A[i]);
p.getPrefix(A);
return p.getAns();
}
示例3: settings_load
void settings_load()
{
eeprom_read_block((void*)&conf, &conf_eep, sizeof(settings));
if(conf.lcdContrast > 0xf || conf.lcdContrast < 0x1) conf.lcdContrast = 0x8;
if(conf.lcdCoefficent > 0x7 || conf.lcdCoefficent < 0x3) conf.lcdCoefficent = 0x7;
if(conf.lcdBias > 0x4 || conf.lcdBias < 0x3) conf.lcdBias = 0x4;
if(conf.apertureMin > 100 || conf.apertureMin < 2) conf.apertureMin = 2;
lcd.color(conf.lcdColor);
ir.init();
ir.make = conf.cameraMake;
if(conf.auxPort != AUX_MODE_DISABLED) aux_off();
if(bt.present && !remote.connected)
{
if(conf.btMode == BT_MODE_SLEEP) bt.sleep(); else bt.advertise();
}
}
示例4: processNXT
void VDIP::processNXT(portConfig *portConfigBuffer)
{
char *name;
char *btAddress;
long freeMemory;
extern BT bt;
if (myEEPROM2.getResetStatus() == (byte) 0){
if(nxtQueryDevice(this,portConfigBuffer->usbDev,&name,&btAddress,&freeMemory)){
bt.setRemoteAddress(btAddress);
delay(100);
myEEPROM2.setResetStatus(1);
delay(1000);
software_Reset(); // increments the "status" so that the ChapR knows it has been reset
}
}
}
示例5:
BT<generic>::BT( BT & y)
{
m_size = 0 ;
m_root = NULL;
Btn<generic> * temp ;
PreOrder k ;
for ( k = y.pre_begin() ; k != y.pre_end() ; k++)
{
i_give_up_insert (*k,k.current()->balance) ;
}
i_give_up_insert (*k,k.current()->balance) ;
}
示例6: debug
void debug(char *s)
{
if(conf.debugEnabled == 0) return;
if(VirtualSerial_connected)
VirtualSerial_PutString(s);
//else if(remote.connected && remote.model == REMOTE_MODEL_TLP)
//remote.debug(s);
else if(bt.state == BT_ST_CONNECTED)
bt.send(s);
}
示例7: rotateRight
void rotateRight(P y) { // zig
BT tmp;
P x = tmp.root();
BT::assignFrom(x, -y);
int& bx = (*x).balance();
int& by = (*y).balance();
BT::assignFrom(-y, +x);
BT::assignFrom(+x, y);
BT::assignFrom(y, x);
if (bx >= 0)
by++;
else
by -= bx - 1;
if (by <= 0)
bx++;
else
bx += by + 1;
}
示例8: rotateLeft
void rotateLeft(P x) { // zag
BT tmp;
P y = tmp.root();
BT::assignFrom(y, +x);
int& bx = (*x).balance();
int& by = (*y).balance();
BT::assignFrom(+x, -y);
BT::assignFrom(-y, x);
BT::assignFrom(x, y);
if (by <= 0)
bx--;
else
bx -= by + 1;
if (bx >= 0)
by--;
else
by += bx - 1;
}
示例9: sysInfo
volatile char sysInfo(char key, char first)
{
if(first)
{
lcd.cls();
char l;
char* text;
char buf[6];
uint16_t val;
// Lines (Y) = 6, 12, 18, 24, 30
val = (uint16_t)bt.version();
text = TEXT("TLP01");
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 6 + SY, text);
lcd.writeStringTiny(3, 6 + SY, TEXT("Model:"));
if(val > 1)
text = TEXT("BTLE");
else
text = TEXT("KS99");
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 12 + SY, text);
lcd.writeStringTiny(3, 12 + SY, TEXT("Edition:"));
lcd.writeStringTiny(3, 18 + SY, TEXT("Firmware:"));
uint32_t version = VERSION;
char c;
l = 0;
while(version)
{
c = (char)(version % 10);
buf[0] = ((char)(c + '0'));
buf[1] = 0;
text = buf;
l += lcd.measureStringTiny(text) + 1;
lcd.writeStringTiny(80 - l, 18 + SY, text);
version -= (uint32_t)c;
version /= 10;
}
if(val > 1)
{
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 30 + SY, text);
lcd.writeStringTiny(3, 30 + SY, TEXT("BT FW Version:"));
}
menu.setTitle(TEXT("System Info"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
if(key == FL_KEY || key == LEFT_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例10: sendCommand
uint8_t NMX::sendCommand(uint8_t command, uint8_t dataLength, uint8_t *data)
{
if(!remote.nmx) return 0;
char hexbuf[3];
bt.sendCMD(PSTR("ATGW,0,28,0,0000000000FF"));
uint8tohex(hexbuf, nodeAddress);
bt.sendCMD((char*)hexbuf);
uint8tohex(hexbuf, motorAddress);
bt.sendCMD((char*)hexbuf);
uint8tohex(hexbuf, command);
bt.sendCMD((char*)hexbuf);
uint8tohex(hexbuf, dataLength);
bt.sendCMD((char*)hexbuf);
for(uint8_t i = 0; i < dataLength; i++)
{
uint8tohex(hexbuf, data[i]);
bt.sendCMD((char*)hexbuf);
}
bt.sendCMD(PSTR("\r"));
return bt.checkOK();
}
示例11: send
uint8_t Remote::send(uint8_t id, uint8_t type)
{
switch(id)
{
case REMOTE_BATTERY:
return bt.sendDATA(id, type, (void *) &battery_percent, sizeof(uint8_t));
case REMOTE_STATUS:
return bt.sendDATA(id, type, (void *) &timer.status, sizeof(timer_status));
case REMOTE_PROGRAM:
return bt.sendDATA(id, type, (void *) &timer.current, sizeof(program));
case REMOTE_START:
return bt.sendDATA(id, type, 0, 0);
case REMOTE_STOP:
return bt.sendDATA(id, type, 0, 0);
}
return 0;
}
示例12: run
void run()
{
typedef typename Space::execution_space ExecSpace;
TestViewMappingSubview< ExecSpace > self;
ASSERT_EQ( Aa.extent(0), AN );
ASSERT_EQ( Ab.extent(0), AN - 2 );
ASSERT_EQ( Ac.extent(0), AN - 2 );
ASSERT_EQ( Ba.extent(0), BN0 );
ASSERT_EQ( Ba.extent(1), BN1 );
ASSERT_EQ( Ba.extent(2), BN2 );
ASSERT_EQ( Bb.extent(0), BN0 - 2 );
ASSERT_EQ( Bb.extent(1), BN1 - 2 );
ASSERT_EQ( Bb.extent(2), BN2 - 2 );
ASSERT_EQ( Ca.extent(0), CN0 );
ASSERT_EQ( Ca.extent(1), CN1 );
ASSERT_EQ( Ca.extent(2), CN2 );
ASSERT_EQ( Ca.extent(3), 13 );
ASSERT_EQ( Ca.extent(4), 14 );
ASSERT_EQ( Cb.extent(0), CN0 - 2 );
ASSERT_EQ( Cb.extent(1), CN1 - 2 );
ASSERT_EQ( Cb.extent(2), CN2 - 2 );
ASSERT_EQ( Da.extent(0), DN0 );
ASSERT_EQ( Da.extent(1), DN1 );
ASSERT_EQ( Da.extent(2), DN2 );
ASSERT_EQ( Da.extent(3), DN3 );
ASSERT_EQ( Da.extent(4), DN4 );
ASSERT_EQ( Db.extent(0), DN1 - 2 );
ASSERT_EQ( Db.extent(1), DN2 - 2 );
ASSERT_EQ( Db.extent(2), DN3 - 2 );
ASSERT_EQ( Da.stride_1(), Db.stride_0() );
ASSERT_EQ( Da.stride_2(), Db.stride_1() );
ASSERT_EQ( Da.stride_3(), Db.stride_2() );
long error_count = -1;
Kokkos::parallel_reduce( Kokkos::RangePolicy< ExecSpace >( 0, 1 ), *this, error_count );
ASSERT_EQ( error_count, 0 );
}
开发者ID:aurix,项目名称:lammps-induced-dipole-polarization-pair-style,代码行数:43,代码来源:TestViewMapping_subview.hpp
示例13: hardware_off
void hardware_off(void)
{
hardware_flashlight(0);
if(battery_status() == 0)
{
//if(timer.cableIsConnected())
//{
// menu.message(STR("Error: Cable"));
//}
//else
//{
shutter_off();
// Save the current time-lapse settings to nv-mem
timer.saveCurrent();
// If USB is used, detach from the bus
USB_Detach();
// Shutdown bluetooth
bt.disconnect();
bt.sleep();
// Disable all interrupts
cli();
// Shutdown
setHigh(POWER_HOLD_PIN);
FOREVER;
//}
}
else // Plugged in
{
// Charging screen //
clock.sleeping = 1;
menu.spawn((void *) batteryStatus);
}
}
示例14: sendQuery
// returns data length in bytes (max 4)
uint32_t NMX::sendQuery(uint8_t command)
{
uint8_t b;
uint32_t value = 0;
if(sendCommand(command, 0, 0))
{
bt.sendCMD(PSTR("ATGR,0,24\r"));
if(bt.checkOK())
{
char *buf;
if(bt.waitEvent(STR("GATT_VAL"), &buf))
{
DEBUG(STR("GATT RESPONSE: "));
DEBUG(buf);
if(strncmp(buf, STR("GATT_VAL"), 8) == 0 && strlen(buf) >= 21)
{
uint8_t len;
if(hextouint8(&len, &buf[22]))
{
if(len <= 4)
{
for(uint8_t i = 0; i < len; i++)
{
hextouint8(&b, &buf[24 + i * 2]);
value += ((uint32_t)b << (8 * (len - i - 1)));
}
return value;
}
}
}
return 0;
}
}
}
return 0;
}
示例15: init
void init()
{
int n,l,r,w;
cin>>n;
for (int i=1; i<=n; ++i)
{
cin>>l>>r>>w;
t.ins(i,l,r,w);
ru[l]++; ru[r]++;
}
for (int i=1; i<=n; ++i)
if (!ru[i])
{
t.root=i;
break;
}
}