AP_HAL_Linux: added UART port for second GPS

This commit is contained in:
Staroselskii Georgii 2015-02-12 13:00:52 +03:00 committed by Andrew Tridgell
parent da6316ed4c
commit dff430e136
2 changed files with 8 additions and 2 deletions

View File

@ -22,6 +22,7 @@ static LinuxSPIUARTDriver uartBDriver;
static LinuxUARTDriver uartBDriver(false);
#endif
static LinuxUARTDriver uartCDriver(false);
static LinuxUARTDriver uartEDriver(false);
static LinuxSemaphore i2cSemaphore;
static LinuxI2CDriver i2cDriver(&i2cSemaphore, "/dev/i2c-1");
@ -97,7 +98,7 @@ HAL_Linux::HAL_Linux() :
&uartBDriver,
&uartCDriver,
NULL, /* no uartD */
NULL, /* no uartE */
&uartEDriver,
&i2cDriver,
&spiDeviceManager,
&analogIn,
@ -126,7 +127,7 @@ void HAL_Linux::init(int argc,char* const argv[]) const
/*
parse command line options
*/
while ((opt = getopt(argc, argv, "A:B:C:h")) != -1) {
while ((opt = getopt(argc, argv, "A:B:C:E:h")) != -1) {
switch (opt) {
case 'A':
uartADriver.set_device_path(optarg);
@ -137,6 +138,9 @@ void HAL_Linux::init(int argc,char* const argv[]) const
case 'C':
uartCDriver.set_device_path(optarg);
break;
case 'E':
uartEDriver.set_device_path(optarg);
break;
case 'h':
_usage();
exit(0);
@ -152,6 +156,7 @@ void HAL_Linux::init(int argc,char* const argv[]) const
rcout->init(NULL);
rcin->init(NULL);
uartA->begin(115200);
uartE->begin(115200);
spi->init(NULL);
analogin->init(NULL);
utilInstance.init(argc, argv);

View File

@ -338,6 +338,7 @@ void *LinuxScheduler::_uart_thread(void* arg)
((LinuxUARTDriver *)hal.uartA)->_timer_tick();
((LinuxUARTDriver *)hal.uartB)->_timer_tick();
((LinuxUARTDriver *)hal.uartC)->_timer_tick();
((LinuxUARTDriver *)hal.uartE)->_timer_tick();
}
return NULL;
}