summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
authorschurig <schurig>2003-06-06 07:43:08 (UTC)
committer schurig <schurig>2003-06-06 07:43:08 (UTC)
commite7d5436f3379f45d9c165a2826b1f4ae5adaeea4 (patch) (unidiff)
treec05f10f573167fd2a0289715a6e7272cfa45fad4 /libopie/odevice.cpp
parent4f987e0199430d04a4ac86007f0a79c631c2e611 (diff)
downloadopie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.zip
opie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.tar.gz
opie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.tar.bz2
ramses stuff
better doc-strings setDisplayBrightness(), setDisplayContrast() and their ...Resolution() friends
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 160568b..f808960 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -547,42 +547,46 @@ bool ODevice::setDisplayStatus ( bool on )
547 bool res = false; 547 bool res = false;
548 int fd; 548 int fd;
549 549
550 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 550 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
551 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 551 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
552 ::close ( fd ); 552 ::close ( fd );
553 } 553 }
554 return res; 554 return res;
555} 555}
556 556
557/** 557/**
558 * This sets the display brightness 558 * This sets the display brightness
559 *
560 * @param p The brightness to be set on a scale from 0 to 255
559 * @return success or failure 561 * @return success or failure
560 */ 562 */
561bool ODevice::setDisplayBrightness ( int p) 563bool ODevice::setDisplayBrightness ( int p)
562{ 564{
563 Q_UNUSED( p ) 565 Q_UNUSED( p )
564 return false; 566 return false;
565} 567}
566 568
567/** 569/**
568 * @return return the max value for the brightness settings slider 570 * @return returns the number of steppings on the brightness slider
571 * in the Light-'n-Power settings.
569 */ 572 */
570int ODevice::displayBrightnessResolution ( ) const 573int ODevice::displayBrightnessResolution ( ) const
571{ 574{
572 return 16; 575 return 16;
573} 576}
574 577
575/** 578/**
576 * This sets the display contrast 579 * This sets the display contrast
580 * @param p The contrast to be set on a scale from 0 to 255
577 * @return success or failure 581 * @return success or failure
578 */ 582 */
579bool ODevice::setDisplayContrast ( int p) 583bool ODevice::setDisplayContrast ( int p)
580{ 584{
581 Q_UNUSED( p ) 585 Q_UNUSED( p )
582 return false; 586 return false;
583} 587}
584 588
585/** 589/**
586 * @return return the max value for the brightness settings slider 590 * @return return the max value for the brightness settings slider
587 * or 0 if the device doesn't support setting of a contrast 591 * or 0 if the device doesn't support setting of a contrast
588 */ 592 */
@@ -2061,38 +2065,38 @@ bool Ramses::setDisplayBrightness(int bright)
2061 2065
2062int Ramses::displayBrightnessResolution() const 2066int Ramses::displayBrightnessResolution() const
2063{ 2067{
2064 return 32; 2068 return 32;
2065} 2069}
2066 2070
2067bool Ramses::setDisplayContrast(int contr) 2071bool Ramses::setDisplayContrast(int contr)
2068{ 2072{
2069 qDebug("Ramses::setDisplayContrast(%d)", contr); 2073 qDebug("Ramses::setDisplayContrast(%d)", contr);
2070 bool res = false; 2074 bool res = false;
2071 int fd; 2075 int fd;
2072 2076
2073 // pwm0 contrast: 35 steps 65..100 (dunkel->hell) 2077 // pwm0 contrast: 20 steps 79..90 (dunkel->hell)
2074 2078
2075 if (contr > 255 ) 2079 if (contr > 255 )
2076 contr = 255; 2080 contr = 255;
2077 if (contr < 0) 2081 if (contr < 0)
2078 contr = 0; 2082 contr = 0;
2079 contr = 65 + (contr * 350 / 255); 2083 contr = 90 - (contr * 20 / 255);
2080 2084
2081 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { 2085 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
2082 qDebug(" %d -> pwm0", contr); 2086 qDebug(" %d -> pwm0", contr);
2083 char writeCommand[100]; 2087 char writeCommand[100];
2084 const int count = sprintf(writeCommand, "%d\n", contr); 2088 const int count = sprintf(writeCommand, "%d\n", contr);
2085 res = (::write(fd, writeCommand, count) != -1); 2089 res = (::write(fd, writeCommand, count) != -1);
2086 res = true; 2090 res = true;
2087 ::close(fd); 2091 ::close(fd);
2088 } else { 2092 } else {
2089 qWarning("no write"); 2093 qWarning("no write");
2090 } 2094 }
2091 return res; 2095 return res;
2092} 2096}
2093 2097
2094 2098
2095int Ramses::displayContrastResolution() const 2099int Ramses::displayContrastResolution() const
2096{ 2100{
2097 return 32; 2101 return 20;
2098} 2102}