From: Martin Mares Date: Sat, 22 Jul 2023 16:53:07 +0000 (+0200) Subject: test-shutters: Add second SSR X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ca191a443197d19214b40ee34fb6c7b2267b8066;p=home-hw.git test-shutters: Add second SSR --- diff --git a/test-shutters/README b/test-shutters/README index cc38070..c57ff71 100644 --- a/test-shutters/README +++ b/test-shutters/README @@ -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 | +--------------------+ diff --git a/test-shutters/main.c b/test-shutters/main.c index fd7b728..10d4da0 100644 --- a/test-shutters/main.c +++ b/test-shutters/main.c @@ -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;