diff options
author | Lennart <lekaiser@uos.de> | 2020-08-18 17:31:49 +0200 |
---|---|---|
committer | Lennart <lekaiser@uos.de> | 2020-08-18 17:31:49 +0200 |
commit | 550482401d95720306873d1fa1de11717c5845dc (patch) | |
tree | aa38f8aa4cf239dfdb1f7da3d8389ea0871e8f63 /src/driver | |
parent | 714e5788be7b89f937fe8dbf270b8035c4f7d436 (diff) |
Working version
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/resistive_load.cc | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/driver/resistive_load.cc b/src/driver/resistive_load.cc index 419c6c0..0c3009c 100644 --- a/src/driver/resistive_load.cc +++ b/src/driver/resistive_load.cc @@ -18,12 +18,22 @@ #error RESISTIVE_LOAD_PIN4 must be set #endif +#ifndef RESISTIVE_LOAD_PIN5 +#error RESISTIVE_LOAD_PIN5 must be set +#endif + +#ifndef RESISTIVE_LOAD_PIN6 +#error RESISTIVE_LOAD_PIN6 must be set +#endif + void ResistiveLoad::setup() { gpio.output(RESISTIVE_LOAD_PIN1, 0); gpio.output(RESISTIVE_LOAD_PIN2, 0); gpio.output(RESISTIVE_LOAD_PIN3, 0); gpio.output(RESISTIVE_LOAD_PIN4, 0); + gpio.output(RESISTIVE_LOAD_PIN5, 0); + gpio.output(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchToNone() @@ -32,6 +42,8 @@ void ResistiveLoad::switchToNone() gpio.write(RESISTIVE_LOAD_PIN2, 0); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo750() @@ -40,6 +52,8 @@ void ResistiveLoad::switchTo750() gpio.write(RESISTIVE_LOAD_PIN2, 1); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo1K0() @@ -48,6 +62,8 @@ void ResistiveLoad::switchTo1K0() gpio.write(RESISTIVE_LOAD_PIN2, 0); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo2K4() @@ -56,6 +72,8 @@ void ResistiveLoad::switchTo2K4() gpio.write(RESISTIVE_LOAD_PIN2, 1); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 1); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo3K3() @@ -64,6 +82,8 @@ void ResistiveLoad::switchTo3K3() gpio.write(RESISTIVE_LOAD_PIN2, 1); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo10K() @@ -72,6 +92,8 @@ void ResistiveLoad::switchTo10K() gpio.write(RESISTIVE_LOAD_PIN2, 0); gpio.write(RESISTIVE_LOAD_PIN3, 0); gpio.write(RESISTIVE_LOAD_PIN4, 1); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::switchTo47K() @@ -80,6 +102,68 @@ void ResistiveLoad::switchTo47K() gpio.write(RESISTIVE_LOAD_PIN2, 0); gpio.write(RESISTIVE_LOAD_PIN3, 1); gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 0); +} + +void ResistiveLoad::switchTo2K2() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 0); + gpio.write(RESISTIVE_LOAD_PIN2, 0); + gpio.write(RESISTIVE_LOAD_PIN3, 0); + gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 1); + gpio.write(RESISTIVE_LOAD_PIN6, 0); +} + +void ResistiveLoad::switchTo4K7() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 0); + gpio.write(RESISTIVE_LOAD_PIN2, 0); + gpio.write(RESISTIVE_LOAD_PIN3, 0); + gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 0); + gpio.write(RESISTIVE_LOAD_PIN6, 1); +} + +void ResistiveLoad::switchTo680() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 1); + gpio.write(RESISTIVE_LOAD_PIN2, 0); + gpio.write(RESISTIVE_LOAD_PIN3, 0); + gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 1); + gpio.write(RESISTIVE_LOAD_PIN6, 0); +} + +void ResistiveLoad::switchTo2K() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 0); + gpio.write(RESISTIVE_LOAD_PIN2, 0); + gpio.write(RESISTIVE_LOAD_PIN3, 1); + gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 1); + gpio.write(RESISTIVE_LOAD_PIN6, 0); +} + +void ResistiveLoad::switchTo1K8() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 0); + gpio.write(RESISTIVE_LOAD_PIN2, 0); + gpio.write(RESISTIVE_LOAD_PIN3, 0); + gpio.write(RESISTIVE_LOAD_PIN4, 1); + gpio.write(RESISTIVE_LOAD_PIN5, 1); + gpio.write(RESISTIVE_LOAD_PIN6, 0); +} + +void ResistiveLoad::switchTo1K3() +{ + gpio.write(RESISTIVE_LOAD_PIN1, 0); + gpio.write(RESISTIVE_LOAD_PIN2, 1); + gpio.write(RESISTIVE_LOAD_PIN3, 0); + gpio.write(RESISTIVE_LOAD_PIN4, 0); + gpio.write(RESISTIVE_LOAD_PIN5, 1); + gpio.write(RESISTIVE_LOAD_PIN6, 0); } void ResistiveLoad::nop1K0(unsigned int duration_ms) |