[bebop] fix warnings in mt9v117

This commit is contained in:
Felix Ruess
2016-07-14 11:36:13 +02:00
parent 229647ba37
commit b398b66e64
+15 -4
View File
@@ -362,19 +362,30 @@ static inline void mt9v117_config(struct mt9v117_t *mt) {
*/
void mt9v117_init(struct mt9v117_t *mt)
{
/* bytes written to gpios/pwm */
int wc = 0;
/* Reset the device */
int gpio129 = open("/sys/class/gpio/gpio129/value", O_WRONLY | O_CREAT | O_TRUNC, 0666);
(void)write(gpio129, "0", 1);
(void)write(gpio129, "1", 1);
wc += write(gpio129, "0", 1);
wc += write(gpio129, "1", 1);
close(gpio129);
if (wc != 2) {
printf("[MT9V117] Couldn't write to GPIO 129\n");
}
/* Start PWM 9 (Which probably is the clock of the MT9V117) */
//#define BEBOP_CAMV_PWM_FREQ 43333333
int pwm9 = open("/sys/class/pwm/pwm_9/run", O_WRONLY | O_CREAT | O_TRUNC, 0666);
(void)write(pwm9, "0", 1);
(void)write(pwm9, "1", 1);
wc = 0;
wc += write(pwm9, "0", 1);
wc += write(pwm9, "1", 1);
close(pwm9);
if (wc != 2) {
printf("[MT9V117] Couldn't write to PWM\n");
}
//TODO: Make PWM and GPIO generic
/* Wait 50ms */