intercom: Disable rx while doing tx. Avoids local RS485 half-duplex echo.
Signed-off-by: Michael Moon <triffid.hunter@gmail.com>
This commit is contained in:
parent
959bae2f4a
commit
e41e659e66
|
|
@ -28,6 +28,7 @@ void io_init(void) {
|
||||||
//Enable the RS485 transceiver
|
//Enable the RS485 transceiver
|
||||||
SET_OUTPUT(RX_ENABLE_PIN);
|
SET_OUTPUT(RX_ENABLE_PIN);
|
||||||
SET_OUTPUT(TX_ENABLE_PIN);
|
SET_OUTPUT(TX_ENABLE_PIN);
|
||||||
|
WRITE(RX_ENABLE_PIN,0);
|
||||||
disable_transmit();
|
disable_transmit();
|
||||||
|
|
||||||
#ifdef HEATER_PIN
|
#ifdef HEATER_PIN
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,15 @@
|
||||||
#define _INTERCOM_H
|
#define _INTERCOM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); WRITE(RX_ENABLE_PIN,0); } while(0)
|
#ifdef HOST
|
||||||
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); WRITE(RX_ENABLE_PIN,0); } while(0)
|
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); UCSR1B &= ~MASK(RXEN1); } while(0)
|
||||||
|
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); UCSR1B |= MASK(RXEN1); } while(0)
|
||||||
|
#else
|
||||||
|
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); UCSR0B &= ~MASK(RXEN0); } while(0)
|
||||||
|
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); UCSR0B |= MASK(RXEN0); } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialise serial subsystem
|
// initialise serial subsystem
|
||||||
void intercom_init(void);
|
void intercom_init(void);
|
||||||
|
|
|
||||||
10
intercom.h
10
intercom.h
|
|
@ -2,9 +2,15 @@
|
||||||
#define _INTERCOM_H
|
#define _INTERCOM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); WRITE(RX_ENABLE_PIN,0); } while(0)
|
#ifdef HOST
|
||||||
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); WRITE(RX_ENABLE_PIN,0); } while(0)
|
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); UCSR1B &= ~MASK(RXEN1); } while(0)
|
||||||
|
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); UCSR1B |= MASK(RXEN1); } while(0)
|
||||||
|
#else
|
||||||
|
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); UCSR0B &= ~MASK(RXEN0); } while(0)
|
||||||
|
#define disable_transmit() do { WRITE(TX_ENABLE_PIN,0); UCSR0B |= MASK(RXEN0); } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialise serial subsystem
|
// initialise serial subsystem
|
||||||
void intercom_init(void);
|
void intercom_init(void);
|
||||||
|
|
|
||||||
1
mendel.c
1
mendel.c
|
|
@ -126,6 +126,7 @@ void io_init(void) {
|
||||||
// Enable the RS485 transceiver
|
// Enable the RS485 transceiver
|
||||||
SET_OUTPUT(RX_ENABLE_PIN);
|
SET_OUTPUT(RX_ENABLE_PIN);
|
||||||
SET_OUTPUT(TX_ENABLE_PIN);
|
SET_OUTPUT(TX_ENABLE_PIN);
|
||||||
|
WRITE(RX_ENABLE_PIN,0);
|
||||||
disable_transmit();
|
disable_transmit();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue