diff options
author | Koen Kooi <koen@openembedded.org> | 2008-12-19 15:26:13 +0100 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2008-12-19 15:26:13 +0100 |
commit | dce67387e065102fb3a765f45bf8d4c32027dfeb (patch) | |
tree | 8dcef15603678a074ea9c5cbeed4e1329c6f0ca2 /packages | |
parent | 448c0f81a2c8d902c0582cd843cc14d2e40da98f (diff) |
picodlp-control: cycle through flipmodes and reindent
Diffstat (limited to 'packages')
-rw-r--r-- | packages/i2c-tools/picodlp-control/picodlp-control.c | 74 | ||||
-rw-r--r-- | 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 8120356f7d..313d977f58 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 add0839a8f..1f31910827 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} } |