Set IMU pin as input pin when using camera
If we don't set this as an input, it interferes with our PWM signal
Also, setting LED duty_cycle to 0.25, to make it less blinding
Change-Id: I6660273753b42141bf72b6617b06d15a4f97071f
Signed-off-by: Jim Ostrowski <yimmy13@gmail.com>
diff --git a/y2022/vision/camera_reader.h b/y2022/vision/camera_reader.h
index 2a0bfbc..d3dd202 100644
--- a/y2022/vision/camera_reader.h
+++ b/y2022/vision/camera_reader.h
@@ -39,6 +39,7 @@
target_estimate_sender_(
event_loop->MakeSender<TargetEstimate>("/camera")),
read_image_timer_(event_loop->AddTimer([this]() { ReadImage(); })),
+ gpio_imu_pin_(GPIOControl(GPIO_PIN_SCLK_IMU, kGPIOIn)),
gpio_pwm_control_(GPIOPWMControl(GPIO_PIN_SCK_PWM, duty_cycle_)),
gpio_disable_control_(
GPIOControl(GPIO_PIN_MOSI_DISABLE, kGPIOOut, kGPIOLow)) {
@@ -100,6 +101,7 @@
aos::TimerHandler *const read_image_timer_;
double duty_cycle_ = 0.0;
+ GPIOControl gpio_imu_pin_;
GPIOPWMControl gpio_pwm_control_;
GPIOControl gpio_disable_control_;
};
diff --git a/y2022/vision/camera_reader_main.cc b/y2022/vision/camera_reader_main.cc
index d5ba448..f91b07e 100644
--- a/y2022/vision/camera_reader_main.cc
+++ b/y2022/vision/camera_reader_main.cc
@@ -6,7 +6,7 @@
// bazel run //y2022/vision:camera_reader -- --config y2022/aos_config.json
// --override_hostname pi-7971-1 --ignore_timestamps true
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-DEFINE_double(duty_cycle, 0.5, "Duty cycle of the LEDs");
+DEFINE_double(duty_cycle, 0.25, "Duty cycle of the LEDs");
DEFINE_uint32(exposure, 5,
"Exposure time, in 100us increments; 0 implies auto exposure");
diff --git a/y2022/vision/gpio.h b/y2022/vision/gpio.h
index 90ad812..bc9aa8a 100644
--- a/y2022/vision/gpio.h
+++ b/y2022/vision/gpio.h
@@ -23,6 +23,11 @@
// This pin is MOSI, being used to control the LED Disable
static constexpr int GPIO_PIN_MOSI_DISABLE = 10;
+// Physical pin 23 maps to sysfs pin 11
+// This pin is SCLK, and is used to talk to the IMU
+// To drive the lights, we have to set this pin to an input
+static constexpr int GPIO_PIN_SCLK_IMU = 11;
+
// Physical pin 33 maps to sysfs pin 13
// This pin is SCK, being used to control the LED PWM
static constexpr int GPIO_PIN_SCK_PWM = 13;