You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/12/03 12:42:25 UTC

[mynewt-core] 14/15: hw/drivers/led: Add bus driver support

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 4884055e70a25773617fc17710a2a6a7e3f03b37
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Nov 23 17:42:18 2018 +0100

    hw/drivers/led: Add bus driver support
---
 hw/drivers/led/include/led/led_itf.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/hw/drivers/led/include/led/led_itf.h b/hw/drivers/led/include/led/led_itf.h
index f61e5f2..d24f326 100644
--- a/hw/drivers/led/include/led/led_itf.h
+++ b/hw/drivers/led/include/led/led_itf.h
@@ -24,6 +24,8 @@
 extern "C" {
 #endif
 
+#include "syscfg/syscfg.h"
+
 /**
  * LED interfaces
  */
@@ -35,7 +37,10 @@ extern "C" {
  * LED interface
  */
 struct led_itf {
-
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+    /* Device */
+    struct os_dev *li_dev;
+#else
     /* LED interface type */
     uint8_t li_type;
 
@@ -50,6 +55,7 @@ struct led_itf {
 
     /* Mutex for shared interface access */
     struct os_mutex *li_lock;
+#endif
 };
 
 /**
@@ -63,7 +69,9 @@ struct led_itf {
 static inline int
 led_itf_lock(struct led_itf *li, uint32_t timeout)
 {
-
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+    return 0;
+#else
     int rc;
     os_time_t ticks;
 
@@ -82,6 +90,7 @@ led_itf_lock(struct led_itf *li, uint32_t timeout)
     }
 
     return (rc);
+#endif
 }
 
 /**
@@ -94,11 +103,13 @@ led_itf_lock(struct led_itf *li, uint32_t timeout)
 static inline void
 led_itf_unlock(struct led_itf *li)
 {
+#if !MYNEWT_VAL(BUS_DRIVER_PRESENT)
     if (!li->li_lock) {
         return;
     }
 
     os_mutex_release(li->li_lock);
+#endif
 }
 
 #endif