RGB and Gesture Sensor - APDS-9960

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
gcarver
Posts: 34
Joined: Sun Oct 26, 2014 4:07 am
Location: New Market, Maryland
Contact:

Re: RGB and Gesture Sensor - APDS-9960

Post by gcarver » Mon Feb 26, 2018 3:33 pm

End of line...

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: RGB and Gesture Sensor - APDS-9960

Post by pythoncoder » Tue Feb 27, 2018 10:50 am

That's quite an involved driver. Impressive.

One thing that comes to mind is that you could save over 300 bytes of RAM by renaming some constants so that all of them start with an underscore - see Constants.
Peter Hinch
Index to my micropython libraries.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: RGB and Gesture Sensor - APDS-9960

Post by OutoftheBOTS_ » Tue Feb 27, 2018 9:32 pm

I have ordered a little break out board for the APDS-9960 and was going to write my own driver then this thread has come up.

What licensing is your code??

User avatar
gcarver
Posts: 34
Joined: Sun Oct 26, 2014 4:07 am
Location: New Market, Maryland
Contact:

Re: RGB and Gesture Sensor - APDS-9960

Post by gcarver » Wed Feb 28, 2018 5:25 pm

Thanks pythoncoder. I'll make the _ change. I had forgotten about that rule. As for licensing. I'm not going to add MIT license header and just bloat the file. But that's what I'd go with. Oh, and I should also note that the gesture reading code doesn't work very well. I'm not using it at the moment and simply using the proximity data. But eventually I plan to get back to improving it. It's based on the Adafruit arduino library gesture method which I find theoretically better than the Sparkfun arduino library.
End of line...

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: RGB and Gesture Sensor - APDS-9960

Post by OutoftheBOTS_ » Wed Feb 28, 2018 8:36 pm

Thanks gcarver :)

I only want to use it as a distance sensor, it is much smaller than a ultra sonic sensor and it also can read distance in an array of directions :)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Licensing

Post by pythoncoder » Thu Mar 01, 2018 7:48 am

gcarver wrote:
Wed Feb 28, 2018 5:25 pm
...I'm not going to add MIT license header and just bloat the file...
IANAL but I've noticed that many developers have a 2-line comment of the form

Code: Select all

# Copyright Guy Carver 2018
# Released under the MIT license
with the full text in LICENSE.md.
I'd be interested to hear from anyone who does have legal knowledge whether this is adequate.

As a retired hobbyist licensing is not a major preoccupation. Except that I don't want a letter from a company lawyer saying "Our clients used your code in their safety critical system and it seems to have killed a few hundred litigious Americans.".
Peter Hinch
Index to my micropython libraries.

dubaleeiro
Posts: 7
Joined: Mon Feb 12, 2018 9:52 pm

Re: RGB and Gesture Sensor - APDS-9960

Post by dubaleeiro » Sat Apr 28, 2018 9:43 am

hello gcarver , thanks a lot for your good work !

could you please give me some tips to adapt the code to the ESP8266 ?

I have changed the "import! line from "import pyb" to "from machine import Pin, I2C", but I am a litte bit consusef on the following part:

def __init__( self, aLoc ) :
'''aLoc I2C pin location is either 1, 'X', 2 or'Y'.'''
self._i2c = pyb.I2C(aLoc, pyb.I2C.MASTER)

as far as I could undestand from the User-Documentarion, on the ESP8266 it is not possible to especify a Bus line, right? Instead, we need to configure the SCL and SDA pins. How should the code look like?

thanks a lot and sorry for such a basic question...

Post Reply