added (wrong port numbered) support for the digital inputs
diff --git a/gyro_board/src/usb/analog.c b/gyro_board/src/usb/analog.c
index a956a5d..cfcd67d 100644
--- a/gyro_board/src/usb/analog.c
+++ b/gyro_board/src/usb/analog.c
@@ -495,10 +495,18 @@
packet->left_drive = encoder5_val;
packet->shooter_angle = encoder2_val;
packet->indexer = encoder3_val;
- packet->wrist = (int32_t)QEI->QEIPOS;
- // TODO(brians): should we re-enable it in between here so that it's disabled
- // for shorter chunks?
+ NVIC_DisableIRQ(EINT1_IRQn);
+ NVIC_DisableIRQ(EINT2_IRQn);
+
+ packet->wrist = (int32_t)QEI->QEIPOS;
+ packet->wrist_hall_effect = digital(0);
+ packet->capture_wrist_rise = capture_wrist_rise;
+ packet->wrist_rise_count = wrist_rise_count;
+
+ NVIC_EnableIRQ(EINT1_IRQn);
+ NVIC_EnableIRQ(EINT2_IRQn);
+
NVIC_DisableIRQ(EINT3_IRQn);
packet->capture_top_rise = capture_top_rise;
@@ -506,16 +514,16 @@
packet->capture_top_fall = capture_top_fall;
packet->top_fall_count = top_fall_count;
+ packet->top_disc = digital(4);
packet->capture_bottom_fall_delay = capture_bottom_fall_delay;
packet->bottom_fall_delay_count = bottom_fall_delay_count;
packet->bottom_fall_count = bottom_fall_count;
-
- packet->capture_wrist_rise = capture_wrist_rise;
- packet->wrist_rise_count = wrist_rise_count;
+ packet->bottom_disc = digital(3);
packet->capture_shooter_angle_rise = capture_shooter_angle_rise;
packet->shooter_angle_rise_count = shooter_angle_rise_count;
+ packet->angle_adjust_bottom_hall_effect = digital(2);
NVIC_EnableIRQ(EINT3_IRQn);
diff --git a/gyro_board/src/usb/analog.h b/gyro_board/src/usb/analog.h
index 7b2fb58..262b230 100644
--- a/gyro_board/src/usb/analog.h
+++ b/gyro_board/src/usb/analog.h
@@ -4,33 +4,43 @@
extern int64_t gyro_angle;
struct DataStruct {
- int64_t gyro_angle;
+ int64_t gyro_angle;
- int32_t right_drive;
- int32_t left_drive;
- int32_t shooter_angle;
- int32_t shooter;
- int32_t indexer;
- int32_t wrist;
+ int32_t right_drive;
+ int32_t left_drive;
+ int32_t shooter_angle;
+ int32_t shooter;
+ int32_t indexer;
+ int32_t wrist;
- int32_t capture_top_rise;
- int32_t capture_top_fall;
- int32_t capture_bottom_fall_delay;
- int32_t capture_wrist_rise;
- int32_t capture_shooter_angle_rise;
+ int32_t capture_top_rise;
+ int32_t capture_top_fall;
+ int32_t capture_bottom_fall_delay;
+ int32_t capture_wrist_rise;
+ int32_t capture_shooter_angle_rise;
- int8_t top_rise_count;
+ int8_t top_rise_count;
- int8_t top_fall_count;
+ int8_t top_fall_count;
- int8_t bottom_rise_count;
+ int8_t bottom_rise_count;
- int8_t bottom_fall_delay_count;
- int8_t bottom_fall_count;
+ int8_t bottom_fall_delay_count;
+ int8_t bottom_fall_count;
- int8_t wrist_rise_count;
+ int8_t wrist_rise_count;
- int8_t shooter_angle_rise_count;
+ int8_t shooter_angle_rise_count;
+
+ union {
+ struct {
+ uint8_t wrist_hall_effect : 1;
+ uint8_t angle_adjust_bottom_hall_effect : 1;
+ uint8_t top_disc : 1;
+ uint8_t bottom_disc : 1;
+ };
+ uint32_t digitals;
+ };
} __attribute__((__packed__));
// Gets called in the USB data output ISR. Assumes that it will not be preempted
// except by very high priority things.