denisff / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

Drivers for RTC chips DS1307, DS1337, DS1338, DS3231 and MCP7940 available #116

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

as already been announced in my WebIOPi driver guide here is the driver code 
for the chips above. The drivers expose the RTC and (for the chips that have 
it) also the SDRAM features. This comes along with new hardware abstraction 
packages for Clock and Memory. To use the drivers two new device subpackage 
directories have to be created in the WebIOPi Python source directory tree, 
namely devices/clock and devices/memory.

The files "clock__init__.py", "dsrtc.py" and "mcprtc.py" have to be put into 
the /clock directory. "clock__init__.py" has there to be renamed to standard 
"__init__.py".

The files "memory__init__.py" and "filememory.py" have to be put into the 
/memory directory. "memory__init__.py" has there to be renamed to standard 
"__init__.py". "filememory.py" contains an experimental driver to store some 
bytes on disk using standard Python pickle files.

"mananger.py" and "setup.py" as well as "webiopi.js" just replace their current 
counterparts.

Please do not forget to call "sudo ./setup.sh skip-apt" to make the updates 
active.

For usage instructions and device parameters look at the comments within the 
driver sources, I tried to make them informative.

Andreas

Original issue reported on code.google.com by andreas....@googlemail.com on 29 Aug 2014 at 10:38

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

if have updated the drivers and the abstraction code a bit.

- The clock package contains now a new driver that allows to use the (Python) 
system clock (only for reading).
- The memory package has got some optimizations and now also has non-REST 
Python methods to read/write memory bytes very flexible. This may be used to 
control the RAM memory of e.g. display chips.

The usage instructions remain the same as above, the file "osrtc.py" goes into 
the /clock directory.

Andreas

Original comment by andreas....@googlemail.com on 23 Sep 2014 at 3:23

Attachments:

GoogleCodeExporter commented 9 years ago
Just updated webiopi.js so that the problem with "banks" within GPIOPort does 
not occur any more. This was a remainder of my work for PCA9698 ...

Original comment by andreas....@googlemail.com on 17 Nov 2014 at 8:36

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I tested a DS1307 and encountered the following error: 

2015-06-21 15:21:13 - WebIOPi - ERROR - [Errno 16] Device or resource busy
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/__main__.py", line 75, in <module>
    main(sys.argv)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/__main__.py", line 69, in main
    server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/server/__init__.py", line 66, in __init__
    manager.addDevice(name, driver, args)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/devices/manager.py", line 28, in addDevice
    dev = devClass()
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/devices/clock/dsrtc.py", line 190, in __init__
    DSclock.__init__(self, control)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/devices/clock/dsrtc.py", line 66, in __init__
    I2C.__init__(self, 0x68)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv6l.egg/webiopi/devices/i2c.py", line 54, in __init__
    if fcntl.ioctl(self.fd, I2C_SLAVE, self.slave):
IOError: [Errno 16] Device or resource busy

Any suggestions?

Original comment by ruud.mee...@gmail.com on 21 Jun 2015 at 3:41

GoogleCodeExporter commented 9 years ago
Solved: i2cdetect showed UU for the device. I ran "echo 0x68 > 
/sys/class/i2c-adapter/i2c-1/delete_device" to revert it back to 68. Now it 
works fine.

Original comment by ruud.mee...@gmail.com on 21 Jun 2015 at 4:56