[oe-commits] Koen Kooi : picodlp-control: cycle through flipmodes and reindent
GIT User account
git at amethyst.openembedded.net
Fri Dec 19 14:33:21 UTC 2008
Module: openembedded.git
Branch: org.openembedded.dev
Commit: dce67387e065102fb3a765f45bf8d4c32027dfeb
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=dce67387e065102fb3a765f45bf8d4c32027dfeb
Author: Koen Kooi <koen at openembedded.org>
Date: Fri Dec 19 15:26:13 2008 +0100
picodlp-control: cycle through flipmodes and reindent
---
.../i2c-tools/picodlp-control/picodlp-control.c | 74 ++++++++++++--------
packages/i2c-tools/picodlp-control_0.1.bb | 2 +-
2 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/packages/i2c-tools/picodlp-control/picodlp-control.c b/packages/i2c-tools/picodlp-control/picodlp-control.c
index 8120356..313d977 100644
--- a/packages/i2c-tools/picodlp-control/picodlp-control.c
+++ b/packages/i2c-tools/picodlp-control/picodlp-control.c
@@ -31,46 +31,60 @@
#define ADDRESS 0x1a
-int
-main (int argc, char **argv)
+int main(int argc, char **argv)
{
- int fd = 0;
+ int fd = 0;
- /* Attempt to open I2C device (/dev/i2c-3) */
- fd = open ("/dev/i2c-3", O_RDWR);
- if (fd == -1)
- {
- fprintf (stderr, "Failed to open pico DLP I2C device: %m\n");
- exit (0);
- }
+ /* Attempt to open I2C device (/dev/i2c-3) */
+ fd = open("/dev/i2c-3", O_RDWR);
+ if (fd == -1) {
+ fprintf(stderr, "Failed to open pico DLP I2C device: %m\n");
+ exit(0);
+ }
- /* Set the slave address of type I2C_SLAVE */
- if (ioctl (fd, I2C_SLAVE, ADDRESS) < 0)
- {
- fprintf (stderr, "Failed to access pico DLp: %m\n");
- exit (0);
- }
+ /* Set the slave address of type I2C_SLAVE */
+ if (ioctl(fd, I2C_SLAVE, ADDRESS) < 0) {
+ fprintf(stderr, "Failed to access pico DLp: %m\n");
+ exit(0);
+ }
- /* Attempt to enable checksumming */
- if (ioctl (fd, I2C_PEC, 1) < 0)
- {
- fprintf (stderr, "Failed to enable PEC\n");
- exit (0);
- }
+ /* Attempt to enable checksumming */
+ if (ioctl(fd, I2C_PEC, 1) < 0) {
+ fprintf(stderr, "Failed to enable PEC\n");
+ exit(0);
+ }
- uint16_t hflip; /* The horizontal flip bit */
- uint16_t vflip; /* The vertical flip bit */
+ uint16_t hflip; /* The horizontal flip bit */
+ uint16_t vflip; /* The vertical flip bit */
- /* Read the status bits for horizontal and vertical vlip */
- hflip = i2c_smbus_read_word_data (fd, 0x08);
- vflip = i2c_smbus_read_word_data (fd, 0x09);
+ /* Read the status bits for horizontal and vertical vlip */
+ fprintf(stdout, "Getting flip bits \n");
+ hflip = i2c_smbus_read_word_data(fd, 0x08);
+ vflip = i2c_smbus_read_word_data(fd, 0x09);
+ /* set flip bits to 0 */
+ fprintf(stdout, "Setting flip bits to zero\n");
+ i2c_smbus_write_word_data(fd, 0x08, 0);
+ i2c_smbus_write_word_data(fd, 0x08, 0);
+ sleep(2);
- /* Output the values to stdout */
- fprintf (stdout, "hflip: %d - vflip: %d\n", hflip, vflip);
+ /* set flip bits to 1 */
+ fprintf(stdout, "Getting flip bits to one\n");
+ i2c_smbus_write_word_data(fd, 0x08, 1);
+ i2c_smbus_write_word_data(fd, 0x08, 1);
- return 0;
+ sleep(2);
+
+ /* restore values */
+ fprintf(stdout, "Restoring flip bits \n");
+ i2c_smbus_write_word_data(fd, 0x08, hflip);
+ i2c_smbus_write_word_data(fd, 0x08, vflip);
+
+ /* Output the values to stdout */
+ fprintf(stdout, "hflip: %d - vflip: %d\n", hflip, vflip);
+
+ return 0;
}
diff --git a/packages/i2c-tools/picodlp-control_0.1.bb b/packages/i2c-tools/picodlp-control_0.1.bb
index add0839..1f31910 100644
--- a/packages/i2c-tools/picodlp-control_0.1.bb
+++ b/packages/i2c-tools/picodlp-control_0.1.bb
@@ -13,6 +13,6 @@ do_compile() {
do_install() {
install -d ${D}/${bindir}
- install -m -755 ${S}/${PN} {D}/${bindir}
+ install -m 0755 ${S}/${PN} ${D}/${bindir}
}
More information about the Openembedded-commits
mailing list