本文整理汇总了C++中setBrightness函数的典型用法代码示例。如果您正苦于以下问题:C++ setBrightness函数的具体用法?C++ setBrightness怎么用?C++ setBrightness使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setBrightness函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pulse
/*
Fade from off to given color and back.
*/
void pulse(int w) {
uint32_t c;
//uint32_t c = Wheel(map(opt, 0, 1023, 0, 255));
for(uint16_t j = 8; j <= getOpt(_pin_lev, 0, 255); j++) {
if( checkButton() ){ return; };
setBrightness(j);
c = Wheel(map(opt, 0, 1023, 0, 255));
for(uint16_t i = 0; i < numPixels(); i++) {
setPixelColor(i, c);
}
show();
delay(w);
}
delay(w*10+50);
for(uint16_t j=getOpt(_pin_lev, 0, 255); j>8; j--) {
if( checkButton() ){ return; };
setBrightness(j);
c = Wheel(map(opt, 0, 1023, 0, 255));
for(uint16_t i = 0; i < numPixels(); i++) {
setPixelColor(i, c);
}
show();
delay(w);
}
delay(w*10+50);
}
示例2: qDebug
void LEDControl::detectPath()
{
qDebug() << "detectPath called";
// get the name of this hardware from the /etc/hw-release file
QSettings hwFile("/etc/hw-release", QSettings::IniFormat);
QString name = hwFile.value("NAME").toString();
qDebug() << "Name detected from /etc/hw-release is: " << name;
// Use the name from /etc/hw-release to look up the control file location in controlfile.conf
QSettings controlFileSettings("/usr/share/harbour-hammerhead-torch/controlfile.conf",QSettings::IniFormat);
// Difficult to replace /usr/share/ with a variable, because QStandardPaths doesn't support an option that resolves to /usr/share/<APPNAME> yet
//qDebug() << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); //QStandardPaths::AppDataLocation and QStandardPaths::AppLocalDataLocation added in Qt 5.4
if ( controlFileSettings.contains(name) ) {
setDevice( name );
setPath( controlFileSettings.value(name).toString() );
} else {
qDebug() << "Hardware not recognised";
setDevice("Unknown");
setPath("Unknown");
}
// Use the name from /etc/hw-release to look up the brightness in brightness.conf
QSettings brightnessSettings("/usr/share/harbour-hammerhead-torch/brightness.conf",QSettings::IniFormat);
if ( brightnessSettings.contains(name) ) {
setBrightness( brightnessSettings.value(name).toString() );
} else {
setBrightness(QString::number(1));
}
}
示例3: onInit
void onInit()
{
setBrightness(3, -16);
videoSetMode(MODE_5_2D);
videoSetModeSub(MODE_0_2D);
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG);
int bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
dmaCopy(splashBitmap, bgGetGfxPtr(bg3), 256*256);
dmaCopy(splashPal, BG_PALETTE, 256*2);
for(int i = 0; i < 128; i++)
{
setBrightness(3, -16+(i/8));
swiWaitForVBlank();
}
for(int i = 0; i < 128; i++)
{
setBrightness(3, -(i/8));
swiWaitForVBlank();
}
}
示例4: setBrightness
void Brightness::dim()
{
if(m_dimOff) setBrightness(0);
else setBrightness(DIM_LEVEL);
m_dimmed = true;
// Speed up the updater a little
m_mouseUpdate.start(500);
}
示例5: breathe
// Breath a color, for a total breathe time of...
void breathe(struct WS2812B_Strip *strip, uint32_t color, const uint32_t breathCycleTime)
{
uint8_t oldBrightness = strip->brightness;
uint16_t pixelIndex;
uint8_t j;
clear(strip);
show(strip);
for (pixelIndex = 0; pixelIndex < strip->numberOfPixels; pixelIndex++)
{
setPixelColor(strip, pixelIndex, color);
}
// Breathe in.
for(j = 1; j < 255; j++)
{
if (strip->breakFromPattern == true)
{
return;
}
setBrightness(strip, j);
show(strip);
delay_ms(breathCycleTime/512);
}
// pause in.
delay_ms(breathCycleTime/16);
// Breathe out.
for(j = 255; j > 0; j--)
{
if (strip->breakFromPattern == true)
{
return;
}
setBrightness(strip, j);
show(strip);
delay_ms(breathCycleTime/512);
}
// pause out.
delay_ms(breathCycleTime/16);
strip->brightness = oldBrightness;
return;
}
示例6: switch
void S60CameraImageProcessingControl::setProcessingParameter(
QCameraImageProcessingControl::ProcessingParameter parameter, QVariant value)
{
switch (parameter) {
case QCameraImageProcessingControl::Contrast:
setContrast(value.toInt());
break;
case QCameraImageProcessingControl::Saturation:
setSaturation(value.toInt());
break;
case QCameraImageProcessingControl::Brightness:
setBrightness(value.toInt());
break;
case QCameraImageProcessingControl::Sharpening:
if (isSharpeningSupported())
setSharpeningLevel(value.toInt());
break;
case QCameraImageProcessingControl::Denoising:
if (isDenoisingSupported())
setDenoisingLevel(value.toInt());
break;
case QCameraImageProcessingControl::ColorTemperature:
setManualWhiteBalance(value.toInt());
break;
default:
break;
}
}
示例7: max7456_on
void OSD::hw_init() {
max7456_on();
//read black level register
byte osdbl_r = MAX_read(MAX7456_OSDBL_reg_read);//black level read register
MAX_write(MAX7456_VM0_reg, MAX7456_RESET | video_mode);
delay_150();
//set black level
MAX_write(MAX7456_OSDBL_reg, (osdbl_r & 0xef)); //black level write register - Set bit 4 to zero 11101111 - Enable automatic OSD black level control
// set position - may be EEPROM.read(OSD_SHIFT_X)
MAX_write(MAX7456_HOS_reg, 0x20); // 0x20 default
MAX_write(MAX7456_VOS_reg, 0x10); // 0x10 default
MAX_write(MAX7456_OSDM_reg, 0b00010010); // 0x00011011 default
setBrightness();
// define sync (auto,int,ext)
// MAX_write(MAX7456_VM0_reg, MAX7456_DISABLE_display | video_mode);
MAX_write(MAX7456_VM0_reg, (MAX7456_ENABLE_display_vert | video_mode) | MAX7456_SYNC_internal);
delay_150();
MAX_write(MAX7456_VM0_reg, (MAX7456_ENABLE_display_vert | video_mode) | MAX7456_SYNC_autosync);
max7456_off();
}
示例8: pinMode
Matrix::Matrix(uint8_t data, uint8_t clock, uint8_t load, uint8_t screens /* = 1 */)
{
// record pins for sw spi
_pinData = data;
_pinClock = clock;
_pinLoad = load;
// set ddr for sw spi pins
pinMode(_pinClock, OUTPUT);
pinMode(_pinData, OUTPUT);
pinMode(_pinLoad, OUTPUT);
// allocate screenbuffers
_screens = screens;
_buffer = (uint8_t*)calloc(_screens, 64);
_maximumX = (_screens * 8);
// initialize registers
clear(); // clear display
setScanLimit(0x07); // use all rows/digits
setBrightness(0x0F); // maximum brightness
setRegister(REG_SHUTDOWN, 0x01); // normal operation
setRegister(REG_DECODEMODE, 0x00); // pixels not integers
setRegister(REG_DISPLAYTEST, 0x00); // not in test mode
}
示例9: onResourceInitialization
//! Initialize resources.
void
onResourceInitialization(void)
{
if (!getConstantParameters())
throw RestartNeeded(DTR("failed to get constant parameters"), c_restart_delay);
setConfig();
std::map<std::string, LED*>::iterator itr = m_led_by_name.begin();
for (unsigned i = 0; i < c_led_count; ++i)
setBrightness(itr->second, 0);
if (!m_args.led_patterns.empty())
{
uint8_t count = m_args.led_patterns.size();
UCTK::Frame frame;
frame.setId(PKT_ID_LED_PATTERN);
frame.setPayloadSize(1 + (count * 2));
frame.set(count, 0);
for (size_t i = 0; i < count; ++i)
frame.set<uint16_t>(m_args.led_patterns[i], 1 + i * 2);
if (!m_ctl->sendFrame(frame))
throw RestartNeeded(DTR("failed to set LED patterns"), c_restart_delay);
}
m_wdog.reset();
setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_ACTIVE);
}
示例10: rainbowSingle
//Rainbow Program
void rainbowSingle() {
setBrightness();
//int wait = getOpt(_pin_opt, -20, 20);
uint16_t i, j;
for(j = 0; j < 256; j++) {
// calculate wait based on volatile opt from interrupt
int wait = (int) map(opt, 0, 1023, -100, 100);
if( wait < 0 ) {
// negative values make a huge apparent difference, so fake a larger spread
// by having -100 to 100 instead of -20 to 100
wait = floor( wait / 5 );
}
// kind of a hack to allow negative wait value to speed rainbow by
// skipping colors, otherwise 0 would be fast as chip could process
if(wait < 0 && j % ( -1 * wait ) != 0){
continue;
}
if( checkButton() ){ return; };
for(i=0; i < numPixels(); i++) {
setPixelColor(i, Wheel(j));
}
show();
if(wait > 0){
delay(wait);
}
}
}
示例11: QSerialPort
/*
* Called on device start
*/
void LcdController::setup()
{
// Setup LCD
serial = new QSerialPort(this);
serial->setPortName(portName);
status = serial->open(QIODevice::WriteOnly);
if(status)
{
serial->setBaudRate(QSerialPort::Baud9600,QSerialPort::AllDirections);
serial->setDataBits(QSerialPort::Data8);
serial->setStopBits(QSerialPort::OneStop);
serial->setFlowControl(QSerialPort::NoFLowControl);
serial->setParity(QSerialPort::NoParity);
// Set 16 Characters Wide
serial->putChar(LCD_COMMAND);
serial->putChar(4);
// Set 2 Lines
serial->putChar(LCD_COMMAND);
serial->putChar(6);
clearScreen();
}
// Setup brightness
setBrightness(30);
}
示例12: doSave
void SettingsMenu::doSave()
{
auto settings = Game::getInstance()->settings();
settings->setCombatDifficulty(((UI::MultistateImageButton*)getUI("combat_difficulty"))->state());
settings->setGameDifficulty(((UI::MultistateImageButton*)getUI("game_difficulty"))->state());
settings->setViolenceLevel(((UI::MultistateImageButton*)getUI("violence_level"))->state());
settings->setTargetHighlight(((UI::MultistateImageButton*)getUI("target_highlight"))->state());
settings->setCombatLooks(((UI::MultistateImageButton*)getUI("combat_looks"))->state());
settings->setCombatMessages(((UI::MultistateImageButton*)getUI("combat_messages"))->state());
settings->setCombatTaunts(((UI::MultistateImageButton*)getUI("combat_taunts"))->state());
settings->setLanguageFilter(((UI::MultistateImageButton*)getUI("language_filter"))->state());
settings->setRunning(((UI::MultistateImageButton*)getUI("running"))->state());
settings->setSubtitles(((UI::MultistateImageButton*)getUI("subtitles"))->state());
settings->setItemHighlight(((UI::MultistateImageButton*)getUI("item_highlight"))->state());
settings->setMasterVolume(((UI::Slider*)getUI("master_volume"))->value());
settings->setMusicVolume(((UI::Slider*)getUI("music_volume"))->value());
settings->setVoiceVolume(((UI::Slider*)getUI("voice_volume"))->value());
settings->setSfxVolume(((UI::Slider*)getUI("sfx_volume"))->value());
settings->setTextDelay(((UI::Slider*)getUI("text_delay"))->value());
settings->setCombatSpeed(((UI::Slider*)getUI("combat_speed"))->value());
settings->setBrightness(((UI::Slider*)getUI("brightness"))->value());
settings->setMouseSensitivity(((UI::Slider*)getUI("mouse_sensitivity"))->value());
settings->setPlayerSpeedup(((UI::ImageButton*)getUI("player_speedup"))->checked());
settings->save();
Game::getInstance()->popState();
}
示例13: setBrightness
void Graphics::fadein(int duration)
{
FBO::unbind();
float curr = p->brightness;
float diff = 255.0f - curr;
for (int i = 1; i <= duration; ++i)
{
setBrightness(curr + (diff / duration) * i);
if (p->frozen)
{
GLMeta::blitBeginScreen(p->scSize);
GLMeta::blitSource(p->frozenScene);
FBO::clear();
p->metaBlitBufferFlippedScaled();
GLMeta::blitEnd();
p->swapGLBuffer();
}
else
{
update();
}
}
}
示例14: m_acuity
YarpManager::YarpManager():
m_acuity(0),
m_brightness(0),
m_fov(0),
m_threshold(0)
{
std::cout<<"## YarpManager Initialisation ##"<<std::endl;
std::cout<<"- Setting default parameters value"<<std::endl;
setAcuity(3);
setFov(100);
setBrightness(50);
setTreshold(150);
std::cout<<"- Setting up YARP network"<<std::endl;
yarp::os::Network::init();
std::cout<<"- Opening YARP port"<<std::endl;
std::cout<<" * /target/module"<<std::endl;
m_modulePort.open("/target/module");
m_modulePort.setStrict();
m_modulePort.useCallback(*this);
std::cout<<" * /target/parameter"<<std::endl;
m_parameterPort.open("/target/parameter");
m_parameterPort.setStrict();
m_parameterPort.useCallback(*this);
}
示例15: setBrightness
void LevelState::Init()
{
setBrightness(2, 0);
//Création du worldmanager
worldMan = new WorldManagerOffline();
worldMan->Init();
}