Giter Club home page Giter Club logo

Comments (3)

bradfordboyle avatar bradfordboyle commented on August 27, 2024
 source/common.c |    5 +++--
 source/py_adc.c |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/source/common.c b/source/common.c
index a5b6e3d..9d6dbec 100644
--- a/source/common.c
+++ b/source/common.c
@@ -339,7 +339,8 @@ int load_device_tree(const char *name)

     file = fopen(slots, "r+");
     if (!file) {
-        return -1;
+        PyErr_SetFromErrnoWithFilename(PyExc_IOError, slots);
+        return 0;
     }

     while (fgets(line, sizeof(line), file)) {
@@ -392,4 +393,4 @@ int unload_device_tree(const char *name)
     fclose(file);

     return 1;
-}
\ No newline at end of file
+}
diff --git a/source/py_adc.c b/source/py_adc.c
index ccdb742..d208ef9 100644
--- a/source/py_adc.c
+++ b/source/py_adc.c
@@ -38,9 +38,9 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args)
 // python function setup()
 static PyObject *py_setup_adc(PyObject *self, PyObject *args)
 {
-    adc_setup();
-
-    Py_RETURN_NONE;
+    if (adc_setup())
+        Py_RETURN_NONE;
+    return NULL;
 }

 // python function read(channel)
@@ -152,4 +152,4 @@ PyMODINIT_FUNC initADC(void)
 #else
     return;
 #endif
-}
\ No newline at end of file
+}
-- 
1.7.10.4

from adafruit-beaglebone-io-python.

jwcooper avatar jwcooper commented on August 27, 2024

Thanks! I'll get this merged in the next release.

from adafruit-beaglebone-io-python.

jwcooper avatar jwcooper commented on August 27, 2024

This is included in 0.0.14, and has been expanded to include PWM, and UART for the error handling.

from adafruit-beaglebone-io-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.