From 0e29bcc4ab192f6744c8e24f6eccb7d78eb5e054 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 7 Jul 2018 10:39:24 +1000 Subject: [PATCH] AP_IOMCU: use thread_create() API --- libraries/AP_IOMCU/AP_IOMCU.cpp | 19 +++---------------- libraries/AP_IOMCU/AP_IOMCU.h | 1 - 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index 42fb3a50bc..b13829a35d 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -133,26 +133,13 @@ void AP_IOMCU::init(void) if (!boardconfig || boardconfig->io_enabled() == 1) { check_crc(); } - - thread_ctx = chThdCreateFromHeap(NULL, - THD_WORKING_AREA_SIZE(1024), - "IOMCU", - 183, - thread_start, - this); - if (thread_ctx == nullptr) { + + if (!hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&AP_IOMCU::thread_main, void), "IOMCU", + 1024, AP_HAL::Scheduler::PRIORITY_BOOST, 1)) { AP_HAL::panic("Unable to allocate IOMCU thread"); } } -/* - static function to enter thread_main() - */ -void AP_IOMCU::thread_start(void *ctx) -{ - ((AP_IOMCU *)ctx)->thread_main(); -} - /* handle event failure */ diff --git a/libraries/AP_IOMCU/AP_IOMCU.h b/libraries/AP_IOMCU/AP_IOMCU.h index 1f21c9eb84..69c76df29b 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.h +++ b/libraries/AP_IOMCU/AP_IOMCU.h @@ -87,7 +87,6 @@ public: private: AP_HAL::UARTDriver &uart; - static void thread_start(void *ctx); void thread_main(void); // read count 16 bit registers