]> mj.ucw.cz Git - home-hw.git/commitdiff
test-shutters: Add second SSR
authorMartin Mares <mj@ucw.cz>
Sat, 22 Jul 2023 16:53:07 +0000 (18:53 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 22 Jul 2023 16:53:07 +0000 (18:53 +0200)
test-shutters/README
test-shutters/main.c

index cc38070209590977c0c1bde8ea03f2582ad98cf4..c57ff7115ad0874afd7cc586160a2edc3bdfe29a 100644 (file)
@@ -13,9 +13,9 @@ TIM4  timing of IR remote control
 BluePill LED           | PC13           GND |
                        | PC14            5V |
                        | PC15           PB9 |
-                       | PA0            PB8 |
-                       | PA1            PB7 |
-                       | PA2            PB6 |
+current sense (OC)     | PA0            PB8 |
+                       | PA1            PB7 |  SSR2 (active low)
+                       | PA2            PB6 |  SSR1 (active low)
                        | PA3            PB5 |
                        | PA4            PB4 |
                        | PA5            PB3 |
@@ -24,9 +24,9 @@ BluePill LED          | PC13           GND |
                        | PB0           PA11 |
                        | PB1           PA10 |  RXD1 - debugging console
                        | PB10           PA9 |  TXD1 - debugging console
-                       | PB11           PA8 |  IR remote control output (via optocoupler, negated)
-                       | RESET         PB15 |  MOSI2 - LED driver data input (via optocoupler, negated)
-                       | 3.3 V         PB14 |  MISO2 - unused
-                       | GND           PB13 |  SCK2 - LED driver clock (via optocoupler, negated)
-                       | GND           PB12 |  SS2 - unused
+                       | PB11           PA8 |
+                       | RESET         PB15 |
+                       | 3.3 V         PB14 |
+                       | GND           PB13 |
+                       | GND           PB12 |
                        +--------------------+
index fd7b72858ac390d87fb3bcc5a7c9b952c27fa42d..10d4da03372b28c4086636fca94d3556dc84251e 100644 (file)
@@ -52,9 +52,9 @@ static void gpio_init(void)
        gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
        gpio_clear(GPIOC, GPIO13);
 
-       // PB6 = SSR (active low)
-       gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO6);
-       gpio_set(GPIOB, GPIO6);
+       // PB6, PB7 = SSR (active low)
+       gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7);
+       gpio_set(GPIOB, GPIO6 | GPIO7);
 
        // PA0 = current sense
        gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO0);
@@ -254,6 +254,10 @@ static enum usbd_request_return_codes control_cb(
                                        gpio_clear(GPIOB, GPIO6);
                                else
                                        gpio_set(GPIOB, GPIO6);
+                               if (value & 2)
+                                       gpio_clear(GPIOB, GPIO7);
+                               else
+                                       gpio_set(GPIOB, GPIO7);
                                break;
                        default:
                                return USBD_REQ_NOTSUPP;