MZachmann / LightLora_MicroPython

Lightweight Interrupt-driven Semtech SX127x Library for MicroPython
MIT License
22 stars 10 forks source link

AttributeError: 'module' object has no attribute 'SpiControl' #3

Closed skylin008 closed 6 years ago

skylin008 commented 6 years ago

I test this code to pyboard,but some error info as follow show:

from LightLora import sx127x from LightLora import spicontrol from LightLora import lorautil l = lorautil.LoraUtil() Traceback (most recent call last): File "", line 1, in File "LightLora/lorautil.py", line 32, in init AttributeError: 'module' object has no attribute 'SpiControl'

How to solve this issue.Thanks!

MZachmann commented 6 years ago

That uninformative message means (usually) that the SpiControl object didn't construct. You can manually try to create one as in spictrl=spicontrol.SpiControl() and see what message you get... but I just took a look at the pyboard and the SPI interface, not surprisingly is different from the micropython's i'm using.

I don't have a pyboard to test with but looking at the doc you'll need to (a) from pyb import SPI (b) init it differently (see spicontrol.py line 17) and (c) use send_recv and send instead of write and write_readinto. And... the Pin definition is different - which affects spicontrol and the irq handling in sx127x.py.

I don't currently have plans to get a pyboard.

skylin008 commented 6 years ago

Thanks kindly supported .Yes.I had modified the GPIO define to be used the pyboard hardware SPI interface. I want to porting the sx127x driver to pyboard and reaiability testing.Thanks!

MZachmann commented 6 years ago

You're welcome. Good luck.