diff --git a/sw/airborne/boards/bebop/mt9v117.c b/sw/airborne/boards/bebop/mt9v117.c index a99d6caaf5..3fd2a04e48 100644 --- a/sw/airborne/boards/bebop/mt9v117.c +++ b/sw/airborne/boards/bebop/mt9v117.c @@ -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 */