89
89
_MCP23008_LCD_D7 = const (6 )
90
90
_MCP23008_LCD_BACKLIGHT = const (7 )
91
91
92
- # 74LS595 SPI backpack pin mapping from LCD logical pin to 74LS595 pin.
93
- _74LS595_LCD_RS = const (1 )
94
- _74LS595_LCD_EN = const (2 )
95
- _74LS595_LCD_D4 = const (6 )
96
- _74LS595_LCD_D5 = const (5 )
97
- _74LS595_LCD_D6 = const (4 )
98
- _74LS595_LCD_D7 = const (3 )
99
- _74LS595_LCD_BACKLIGHT = const (7 )
92
+ # 74HC595 SPI backpack pin mapping from LCD logical pin to 74HC595 pin.
93
+ _74HC595_LCD_RS = const (1 )
94
+ _74HC595_LCD_EN = const (2 )
95
+ _74HC595_LCD_D4 = const (6 )
96
+ _74HC595_LCD_D5 = const (5 )
97
+ _74HC595_LCD_D6 = const (4 )
98
+ _74HC595_LCD_D7 = const (3 )
99
+ _74HC595_LCD_BACKLIGHT = const (7 )
100
100
101
101
#pylint: enable-msg=bad-whitespace
102
102
@@ -389,17 +389,17 @@ def __init__(self, spi, latch, cols, lines):
389
389
columns and lines on the display.
390
390
"""
391
391
# See comment above on I2C class for why this is imported here:
392
- import adafruit_character_lcd .shift_reg_74ls595 as shift_reg_74ls595
393
- self ._sr = shift_reg_74ls595 . ShiftReg74LS595 (spi , latch )
392
+ import adafruit_character_lcd .shift_reg_74hc595 as shift_reg_74hc595
393
+ self ._sr = shift_reg_74hc595 . ShiftReg74HC595 (spi , latch )
394
394
# Setup pins for SPI backpack, see diagram:
395
395
# https://learn.adafruit.com/assets/35681
396
- reset = self ._sr .DigitalInOut (_74LS595_LCD_RS , self ._sr )
397
- enable = self ._sr .DigitalInOut (_74LS595_LCD_EN , self ._sr )
398
- dl4 = self ._sr .DigitalInOut (_74LS595_LCD_D4 , self ._sr )
399
- dl5 = self ._sr .DigitalInOut (_74LS595_LCD_D5 , self ._sr )
400
- dl6 = self ._sr .DigitalInOut (_74LS595_LCD_D6 , self ._sr )
401
- dl7 = self ._sr .DigitalInOut (_74LS595_LCD_D7 , self ._sr )
402
- backlight = self ._sr .DigitalInOut (_74LS595_LCD_BACKLIGHT , self ._sr )
396
+ reset = self ._sr .DigitalInOut (_74HC595_LCD_RS , self ._sr )
397
+ enable = self ._sr .DigitalInOut (_74HC595_LCD_EN , self ._sr )
398
+ dl4 = self ._sr .DigitalInOut (_74HC595_LCD_D4 , self ._sr )
399
+ dl5 = self ._sr .DigitalInOut (_74HC595_LCD_D5 , self ._sr )
400
+ dl6 = self ._sr .DigitalInOut (_74HC595_LCD_D6 , self ._sr )
401
+ dl7 = self ._sr .DigitalInOut (_74HC595_LCD_D7 , self ._sr )
402
+ backlight = self ._sr .DigitalInOut (_74HC595_LCD_BACKLIGHT , self ._sr )
403
403
# Call superclass initializer with shift register pins.
404
404
super ().__init__ (reset , enable , dl4 , dl5 , dl6 , dl7 , cols , lines ,
405
405
backlight = backlight )
@@ -410,24 +410,24 @@ def _write8(self, value, char_mode=False):
410
410
# slow with overhead of SPI communication).
411
411
gpio = self ._sr .gpio
412
412
# Make sure enable is low.
413
- gpio = _set_bit (gpio , _74LS595_LCD_EN , False )
413
+ gpio = _set_bit (gpio , _74HC595_LCD_EN , False )
414
414
# Set character/data bit. (charmode = False).
415
- gpio = _set_bit (gpio , _74LS595_LCD_RS , char_mode )
415
+ gpio = _set_bit (gpio , _74HC595_LCD_RS , char_mode )
416
416
# Set upper 4 bits.
417
- gpio = _set_bit (gpio , _74LS595_LCD_D4 , ((value >> 4 ) & 1 ) > 0 )
418
- gpio = _set_bit (gpio , _74LS595_LCD_D5 , ((value >> 5 ) & 1 ) > 0 )
419
- gpio = _set_bit (gpio , _74LS595_LCD_D6 , ((value >> 6 ) & 1 ) > 0 )
420
- gpio = _set_bit (gpio , _74LS595_LCD_D7 , ((value >> 7 ) & 1 ) > 0 )
417
+ gpio = _set_bit (gpio , _74HC595_LCD_D4 , ((value >> 4 ) & 1 ) > 0 )
418
+ gpio = _set_bit (gpio , _74HC595_LCD_D5 , ((value >> 5 ) & 1 ) > 0 )
419
+ gpio = _set_bit (gpio , _74HC595_LCD_D6 , ((value >> 6 ) & 1 ) > 0 )
420
+ gpio = _set_bit (gpio , _74HC595_LCD_D7 , ((value >> 7 ) & 1 ) > 0 )
421
421
self ._sr .gpio = gpio
422
422
# Send command.
423
423
self ._pulse_enable ()
424
424
# Now repeat for lower 4 bits.
425
425
gpio = self ._sr .gpio
426
- gpio = _set_bit (gpio , _74LS595_LCD_EN , False )
427
- gpio = _set_bit (gpio , _74LS595_LCD_RS , char_mode )
428
- gpio = _set_bit (gpio , _74LS595_LCD_D4 , (value & 1 ) > 0 )
429
- gpio = _set_bit (gpio , _74LS595_LCD_D5 , ((value >> 1 ) & 1 ) > 0 )
430
- gpio = _set_bit (gpio , _74LS595_LCD_D6 , ((value >> 2 ) & 1 ) > 0 )
431
- gpio = _set_bit (gpio , _74LS595_LCD_D7 , ((value >> 3 ) & 1 ) > 0 )
426
+ gpio = _set_bit (gpio , _74HC595_LCD_EN , False )
427
+ gpio = _set_bit (gpio , _74HC595_LCD_RS , char_mode )
428
+ gpio = _set_bit (gpio , _74HC595_LCD_D4 , (value & 1 ) > 0 )
429
+ gpio = _set_bit (gpio , _74HC595_LCD_D5 , ((value >> 1 ) & 1 ) > 0 )
430
+ gpio = _set_bit (gpio , _74HC595_LCD_D6 , ((value >> 2 ) & 1 ) > 0 )
431
+ gpio = _set_bit (gpio , _74HC595_LCD_D7 , ((value >> 3 ) & 1 ) > 0 )
432
432
self ._sr .gpio = gpio
433
433
self ._pulse_enable ()
0 commit comments