Tweaks for orientation and A/B pins for Kyria left

This commit is contained in:
Pete Johanson 2020-07-21 13:52:03 -04:00
parent b48011ace6
commit f3267e6030
2 changed files with 4 additions and 4 deletions

View File

@ -10,8 +10,8 @@
encoder: encoder0 {
compatible = "alps,ec11";
label = "Rotary Encoder";
a-gpios = <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
a-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
};
};

View File

@ -41,10 +41,10 @@ static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan)
switch(val | (drv_data->ab_state << 2)) {
case 0b0010: case 0b0100: case 0b1101: case 0b1011:
delta = 1;
delta = -1;
break;
case 0b0001: case 0b0111: case 0b1110: case 0b1000:
delta = -1;
delta = 1;
break;
default:
delta = 0;