Added support to turn inversion off for UART1
will need to look at controlling it within configuration once param groups are in place.
This commit is contained in:
parent
0e8d375a1c
commit
0a9beee25d
|
@ -27,11 +27,16 @@
|
|||
|
||||
#include "inverter.h"
|
||||
|
||||
static const IO_t pin = DEFIO_IO(INVERTER);
|
||||
/*
|
||||
TODO: move this to support multiple inverters on different UARTs etc
|
||||
possibly move to put it in the UART driver itself.
|
||||
*/
|
||||
static IO_t pin = IO_NONE;
|
||||
|
||||
void initInverter(void)
|
||||
{
|
||||
IOInit(pin, OWNER_INVERTER, RESOURCE_OUTPUT, 0);
|
||||
pin = IOGetByTag(IO_TAG(INVERTER));
|
||||
IOInit(pin, OWNER_INVERTER, RESOURCE_OUTPUT, 1);
|
||||
IOConfigGPIO(pin, IOCFG_OUT_PP);
|
||||
|
||||
inverterSet(false);
|
||||
|
|
|
@ -58,13 +58,26 @@ void detectHardwareRevision(void)
|
|||
if (!IORead(pin1)) {
|
||||
if (!IORead(pin2)) {
|
||||
hardwareRevision = BJF4_REV3A;
|
||||
return;
|
||||
}
|
||||
hardwareRevision = BJF4_REV3;
|
||||
return;
|
||||
}
|
||||
|
||||
hardwareRevision = BJF4_REV2;
|
||||
if (hardwareRevision == UNKNOWN) {
|
||||
hardwareRevision = BJF4_REV2;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
enable the UART1 inversion PC9
|
||||
|
||||
TODO: once param groups are in place, inverter outputs
|
||||
can be moved to be simple IO outputs, and merely set them
|
||||
HI or LO in configuration.
|
||||
*/
|
||||
IO_t uart1invert = IOGetByTag(IO_TAG(PC9));
|
||||
IOInit(uart1invert, OWNER_INVERTER, RESOURCE_OUTPUT, 2);
|
||||
IOConfigGPIO(uart1invert, IOCFG_AF_PP);
|
||||
IOLo(uart1invert);
|
||||
}
|
||||
|
||||
void updateHardwareRevision(void)
|
||||
|
|
Loading…
Reference in New Issue