本文整理汇总了C++中set_light函数的典型用法代码示例。如果您正苦于以下问题:C++ set_light函数的具体用法?C++ set_light怎么用?C++ set_light使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_light函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_light
// *************************************************************************************************
// @fn update_light
// @brief Update light status
// @param none
// @return none
// *************************************************************************************************
void update_light(void)
{
if(!sys.flag.low_battery && light.value >= LIGHT_LEVEL)
{
// Config front light duty cicle and blink rate
light.front_blink = 6;
light.front_duty = 10;
// Enable front light Timer
light.front_enable = TRUE;
Timer0_A1_Start();
// Enable back light Timer
light.back_enable = TRUE;
Timer0_A2_Start();
// Turn on lights
set_light(LIGHT_ALL, LIGHT_ON);
}
else
{
// Disable front light Timer
light.front_enable = FALSE;
Timer0_A1_Stop();
// Disable back light Timer
light.back_enable = FALSE;
Timer0_A2_Stop();
// Turn off lights
set_light(LIGHT_ALL, LIGHT_OFF);
}
}
示例2: autobaud
int autobaud(int port) {
int lighton=0;
int leastErrors=99999;
int leastBaud=-1;
unsigned int chars,errors;
for(int i=0;i<STANDARD_BAUD_NUM;i++) {
lighton=1-lighton;
set_light(port,lighton);
int result=countCharBaud(port,standardBaud[i],&chars,&errors);
if(result>0) {
baud[port]=standardBaud[i];
set_light(port,OFF);
return result;
}
if(result==-2) {
if(errors<(chars/10) && errors<leastErrors) {
leastErrors=errors;
leastBaud=i;
}
}
drainToSD(&uartbuf[port]);
}
//No spped was perfect, use the best speed
if(leastBaud>=0) {
baud[port]=standardBaud[leastBaud];
set_light(port,OFF);
return 2;
}
//No speed was close enough, don't use the port
uartMode[port]=PKT_NONE;
baud[port]=0;
set_light(port,OFF);
return -1;
}
示例3: pinModeFast
void hexbright::init_hardware() {
// These next 8 commands are for reference and cost nothing,
// as we are initializing the values to their default state.
pinModeFast(DPIN_PWR, OUTPUT);
digitalWriteFast(DPIN_PWR, LOW);
pinModeFast(DPIN_RLED_SW, INPUT);
pinModeFast(DPIN_GLED, OUTPUT);
pinModeFast(DPIN_DRV_MODE, OUTPUT);
pinModeFast(DPIN_DRV_EN, OUTPUT);
digitalWriteFast(DPIN_DRV_MODE, LOW);
digitalWriteFast(DPIN_DRV_EN, LOW);
#if (DEBUG!=DEBUG_OFF)
// Initialize serial busses
Serial.begin(9600);
Wire.begin();
Serial.println("DEBUG MODE ON");
#endif
#if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT)
if(DEBUG==DEBUG_LIGHT) {
// do a full light range sweep, (printing all light intensity info)
set_light(0,1000,update_delay*1002);
} else if (DEBUG==DEBUG_TEMP) {
set_light(0, MAX_LEVEL, NOW);
} else if (DEBUG==DEBUG_LOOP) {
// note the use of TIME_MS/update_delay.
set_light(0, MAX_LEVEL, 2500/update_delay);
}
#ifdef FREE_RAM
Serial.print("Ram available: ");
Serial.print(freeRam());
Serial.println("/1024 bytes");
#endif
#ifdef FLASH_CHECKSUM
Serial.print("Flash checksum: ");
Serial.println(flash_checksum());
#endif
#endif // DEBUG!=DEBUG_OFF
#ifdef ACCELEROMETER
enable_accelerometer();
#endif
// was this power on from battery? if so, it was a button press, even if it was too fast to register.
read_charge_state();
if(get_charge_state()==BATTERY)
press_button();
continue_time = micros();
}
示例4: check_ball
int check_ball(uint32_t d, uint32_t t){
int found = 0;
set_light(LIT_LEFT, LIT_OFF);
if(d < WALL){
if( d < min.d){
min.d = d;
min.t = t;
printf("Distance: %d Angle: %d NEW MIN!\n", d);
set_light(LIT_LEFT, LIT_RED);
found = 1;
}
}
return found;
}
示例5: blinklock
void blinklock(int maintainWatchdog, int blinkcode) {
if(blinkcode==0) {
for(;;) {
set_light(0,ON);
delay_ms(50);
set_light(0,OFF);
set_light(1,ON);
delay_ms(50);
set_light(1,OFF);
}
} else {
for(;;) {
for(int i=0;i<blinkcode;i++) {
set_light(0,ON);
delay_ms(250);
set_light(0,OFF);
delay_ms(250);
}
set_light(1,ON);
delay_ms(250);
set_light(1,OFF);
delay_ms(250);
}
}
}
示例6: error_message
void error_message(char *message){
printf("%s", message);
fflush(stdout);
ev3_clear_lcd();
ev3_text_lcd_normal(0,0, message);
while(1){
set_light(LIT_RIGHT, LIT_RED);
set_light(LIT_LEFT, LIT_OFF);
sleep(1);
set_light(LIT_RIGHT, LIT_OFF);
set_light(LIT_LEFT, LIT_RED);
sleep(1);
}
}
示例7: pinModeFast
void hexbright::init_hardware() {
// We just powered on! That means either we got plugged
// into USB, or the user is pressing the power button.
pinModeFast(DPIN_PWR, INPUT);
digitalWriteFast(DPIN_PWR, LOW);
// Initialize GPIO
pinModeFast(DPIN_RLED_SW, INPUT);
pinModeFast(DPIN_GLED, OUTPUT);
pinModeFast(DPIN_DRV_MODE, OUTPUT);
pinModeFast(DPIN_DRV_EN, OUTPUT);
digitalWriteFast(DPIN_DRV_MODE, LOW);
digitalWriteFast(DPIN_DRV_EN, LOW);
#if (DEBUG!=DEBUG_OFF)
// Initialize serial busses
Serial.begin(9600);
Wire.begin();
Serial.println("DEBUG MODE ON");
#endif
#if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT)
if(DEBUG==DEBUG_LIGHT) {
// do a full light range sweep, (printing all light intensity info)
set_light(0,1000,update_delay*1002);
} else if (DEBUG==DEBUG_TEMP) {
set_light(0, MAX_LEVEL, NOW);
} else if (DEBUG==DEBUG_LOOP) {
// note the use of TIME_MS/update_delay.
set_light(0, MAX_LEVEL, 2500/update_delay);
}
#ifdef FREE_RAM
Serial.print("Ram available: ");
Serial.print(freeRam());
Serial.println("/1024 bytes");
#endif
#ifdef FLASH_CHECKSUM
Serial.print("Flash checksum: ");
Serial.println(flash_checksum());
#endif
#endif // DEBUG!=DEBUG_OFF
#ifdef ACCELEROMETER
enable_accelerometer();
#endif
continue_time = micros();
}
示例8: setup
void setup() {
set_short("Xrazzicaz' Boot Camp");
add_property("determinate", "");
set_light( 75 );
add_property("no teleport", 1);
set_long("This is a small training room, designed to help the new "
"adventurer get off to a good start on Discworld. The air is "
"stale with the combined stench of sweat, beer, and old "
"warriors. Off to one side is a rather unusual training "
"dummy above which is a small plaque.\n");
add_item( "face", "As you stare at it, squinting and turning your head "
"side to side, you realise it looks rather like your old maths "
"teacher!\n");
add_item( "floor", "The floor is made of flagstones, cemented together "
"with centuries of accumulated muck.\n");
add_item( "wall", "The walls are marked with mysterious stains that may or "
"may not be blood. But surely training dummies don't bleed.\n");
add_item( "ceiling", "The ceiling appears to be dingy patches of plaster "
"stuck between old oak rafters that have turned black with "
"age.\n");
/* Make it so you cannot godmother out of here */
add_property("no godmother", 1);
add_exit( "combat", PATH + "combat", "door" );
add_alias( "southeast", "foyer");
}/*setup*/
示例9: set_uniform_matrix4
void ForwardPositonalLightShader::update_properties(
const Mat4& trans,
const RenderEngine& engine) const
{
//TODO remove global camera.
// auto mvp =
set_uniform_matrix4("transformation_mat", trans);
// set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat());
// set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat());
set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat());
set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat());
set_uniform_matrix3("normal_mat", trans.get_mat3().inverse().transpose());
set_light("positional_light.light", engine.get_active_light());
set_pos_light("positional_light",static_cast<const PositionalLight*>(engine.get_active_light()),trans);
//
//TODO
set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos());
// //use the new texture
// material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]);
}
示例10: setup
void setup() {
set_short( "uninitialised search room" );
set_long( "You are in an uninitialized search room. "
"This is an example of a room that gets cloned and configured "
"afterwards. In this room, it's the function set_marker that's "
"used to define its look, and most if the exits as well. And "
"the function set_destination that is used to find, possibly "
"clone and configure, the rooms that fit the keywords you search "
"for. The handler called SEARCH in the code, is \""+
SEARCH +"\" and the one called QUIT_HANDLER, is \""+
QUIT_HANDLER +"\".\n" );
add_property( "no map", 1 );
/* set_light sets the amount of light the room has. See help light
* for a list of what the number means:)
*/
set_light( 50 );
add_exit( "exit", LEARNING +"search", "path" );
/* add_property is used to add a value to an object, that can later be
* queried for with query_property.
* The "commented functions" and "keywords" properties are specific for
* rooms in the learning domain and is used to make it possible to search
* for subjects.
* See /d/learning/handlers/search.c for the way this is done.
*/
add_property( "commented functions",
({ "set_destination", "query_quit_handler",
"query_cloning_info" }) );
示例11: create
create() {
set_short("Winding Path");
set_long("\
This is a winding, thickly wooded path winding east and west through the\n\
the Forest of Elwoode. The thick canopy of leaves overhead shelters the\n\
trail almost completely from the elements. An opening in the vegetation\n\
lies to the north.\n");
add_exit(ROOMS+"garg001", "north");
/* what the fuck is this? COMMENT any changes, dammit! - Slider 2/16/2000 */
// Sorry Slider, the exit was mine to lead to Barrowmere. - Frij
add_exit("/room/circ/roads/west1b","south");
add_exit(ROOMS+"path4", "west");
add_exit(ROOMS+"path2", "east");
add_item("leaves",
"The cool, fragrant leaves protect the path from the elements.\n");
add_item("path",
"The force of many feet through the ages has etched this path deeply into\n\
the earth. You wonder where it leads.....\n");
add_item("opening",
"It looks dangerous. You feel a cautious sort of dread as you consider \n\
what may be beyond the vegetation.\n");
add_item("vegetation",
"There's an opening in the vegetation that leads north.\n");
set_light(1);
add_property("outside"); // added by Frijoles
reset(0);
}
示例12: setup
void setup() {
set_short( "bedroom" );
set_long( "This is a small bedroom above the shop. There is a window "
"in the north wall.\n");
set_light( 60 );
// This is usually calculated for you and only needed if you want the room
// to be bigger than normal.
set_room_size( 10 );
// set the movement zone.
set_zone( "Tiny Town");
/*
* lots of add_items are needed here to describe all the things in the
* room.
*/
add_exit("window", PATH+"shop-ledge", "window");
add_exit("down", PATH +"item-shop", "stair" );
// make them move downwards 9feet when they go down the stairs
modify_exit("down", ({ "downgrade", 9 }));
示例13: setup
void setup() {
set_short("Desert");
set_long("This is the end of Desert\n");
set_light( 80 );
add_exit("east", DESERT + "desert4", "road");
add_exit("west", DESERT + "desert2", "road");
}
示例14: setup
void setup() {
set_light(100);
set_short("Small Gods Street outside Temple");
set_long(
"You are on Small Gods Street outside the Temple of Small Gods. "+
"A large gateway to the west leads into the Temple. The "+
"street continues north and south.\n");
add_exit("north", ROOM+"smallgod1", "road");
add_exit("south", ROOM+"smallgod3", "road");
add_exit("west", TEMPLE, "gate");
add_item("temple",
"It is the Temple of Small Gods. It is covered in small statues.\n");
add_alias("temple of small gods", "temple");
add_item("gateway",
"This is a large wrought-iron set of gates which have been open for so many years "+
"that they appear to have rusted permanently open. Various and sundry "+
"religious symbols are situated over the top of the gateway.\n");
add_alias("gate", "gateway");
add_alias("gates", "gateway");
add_item("symbols", "From the look of it the many different symbols are all "+
"collected from the myriad of small obscure gods that are worshipped "+
"in Ankh-Morpork.\n");
add_alias("symbol", "symbols");
set_zone("ankh morpork");
set_monster(NUM, "city");
}
示例15: reset
reset() {
set_light(1);
set_emotes(1, ({
"A carriage barrels through the street causing passerbys to flee.\n",
"Smoke wafts through on the back of a short gust from a nearby hearth.\n",
}));