From 9d87c925a9eaa4fc256be3173c14a20d1469472d Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Wed, 9 Sep 2020 11:53:37 +0100 Subject: everything, mostly, working --- boiler-monster/stm32/app/pic.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 boiler-monster/stm32/app/pic.c (limited to 'boiler-monster/stm32/app/pic.c') diff --git a/boiler-monster/stm32/app/pic.c b/boiler-monster/stm32/app/pic.c new file mode 100644 index 0000000..b478766 --- /dev/null +++ b/boiler-monster/stm32/app/pic.c @@ -0,0 +1,52 @@ +#include "project.h" + +#define PIC_RESET GPIO1 +#define PIC_RESET_PORT GPIOB + + +static void pic_reset (void) +{ + SET (PIC_RESET); + delay_ms (1); + CLEAR (PIC_RESET); +} + + +void pic_passthru (void) +{ + uint8_t c; + + printf ("\r\nPIC MODE\r\n"); + usart1_drain(); + block_stdio = 1; + + while (!ring_read_byte (&rx3_ring, &c)); + + pic_reset(); + + + for (;;) { + if (!ring_read_byte (&rx1_ring, &c)) + usart3_queue (c); + + if (!ring_read_byte (&rx3_ring, &c)) + usart1_queue (c); + + } +} + + + + + + + +void pic_init (void) +{ + MAP_OUTPUT_PP (PIC_RESET); + + pic_reset(); + +} + + -- cgit v1.2.3