Comments (4)
Error details:
Traceback (most recent call last):
File "my_demo.py", line 40, in <module>
lcd.custom_char(0, happy_face)
File "/home/pi/py/python_lcd_clach04/lcd/lcd_api.py", line 170, in custom_char
self.hal_sleep_us(40)
File "/home/pi/py/python_lcd_clach04/lcd/lcd_api.py", line 208, in hal_sleep_us
time.sleep_us(usecs)
AttributeError: module 'time' has no attribute 'sleep_us'
from python_lcd.
The intent is that lcd_api.py should be independent of the platform. So it shouldn't have a sleep or a sleep_us in it. sleep_us is used so that you don't need to have floating point enabled (not all micropython port provide support for floating point operations).
Unfortunately, the sleep stuff came in fairly late in the development, so I added a "default" implementation in lcd_api.py so as not to break the existing implementations.
Specific hal layers can override this if desired. circuitpython, for example, also doesn't support sleep_us so it provides a hal_sleep_us function like this:
python_lcd/lcd/circuitpython_i2c_lcd.py
Lines 84 to 86 in 4376476
It looks like i2c_lcd.py (which is intended for CPython use) should provide a similar hal_sleep_us function.
from python_lcd.
I think that adding some comments to the hal_sleep_us function implemented in lcd_api.py would also help.
from python_lcd.
Thanks for taking the time to explain this, really helpful. I posted a PR that resolves the issue and should help with other platforms. It may benefit from further comments/hints.
from python_lcd.
Related Issues (20)
- Don't work in esp32 HOT 2
- BBB install error HOT 1
- LCD hangs at initialization
- Putting this code on my Nodemcu V3 HOT 2
- Need driver for chip SPLC780D1 HOT 3
- print backslash to LCD HOT 1
- Unable to get 16x2 LCD working with STM32F401RE Nucleo HOT 2
- Unable to print in LCD - GPIO HOT 8
- 16x4 LCD have 3rd and 4th line shifted by 4 chars HOT 4
- One linefeed too many, in case the line is filled up to the last character (4x20 display) / CircuitPython Port HOT 2
- rp2 PIO variant HOT 1
- add seeed studio Grove - 16x2 LCD support - any chance? HOT 4
- How to add extra commands? HOT 2
- PyCom WiPy 3 with 20x4 LCD HOT 1
- ESP32 library for displays 1602, 2004 (I2C interface) with Russian letters (Cyrillic) HOT 1
- putchar() canβt display custom chars HOT 1
- Could you please add a new class to i2c_lcd.py? HOT 2
- Reduce code size and memory footprint HOT 6
- Python_LCD HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python_lcd.