diff options
author | fishsoupisgood <github@madingley.org> | 2020-05-26 14:33:34 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-05-26 14:33:34 +0100 |
commit | f0d941bef6a9b6e3af78cfc68e1f82d6b47ccb2f (patch) | |
tree | 22a88d00cb28e075b5397ff5db586d548023f2f2 /stm32/app/pic.c | |
download | heating-f0d941bef6a9b6e3af78cfc68e1f82d6b47ccb2f.tar.gz heating-f0d941bef6a9b6e3af78cfc68e1f82d6b47ccb2f.tar.bz2 heating-f0d941bef6a9b6e3af78cfc68e1f82d6b47ccb2f.zip |
happy
Diffstat (limited to 'stm32/app/pic.c')
-rw-r--r-- | stm32/app/pic.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/stm32/app/pic.c b/stm32/app/pic.c new file mode 100644 index 0000000..b478766 --- /dev/null +++ b/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(); + +} + + |