Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for spi-mode in cmdline #273

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions luma/core/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def spi(self):
device=self.opts.spi_device,
bus_speed_hz=self.opts.spi_bus_speed,
transfer_size=self.opts.spi_transfer_size,
spi_mode=self.opts.spi_mode,
reset_hold_time=self.opts.gpio_reset_hold_time,
reset_release_time=self.opts.gpio_reset_release_time,
gpio_DC=self.opts.gpio_data_command,
Expand All @@ -166,6 +167,7 @@ def gpio_cs_spi(self):
bus_speed_hz=self.opts.spi_bus_speed,
cs_high=self.opts.spi_cs_high,
transfer_size=self.opts.spi_transfer_size,
spi_mode=self.opts.spi_mode,
reset_hold_time=self.opts.gpio_reset_hold_time,
reset_release_time=self.opts.gpio_reset_release_time,
gpio_DC=self.opts.gpio_data_command,
Expand Down Expand Up @@ -305,6 +307,7 @@ def create_parser(description):
spi_group.add_argument('--spi-device', type=int, default=0, help='SPI device')
spi_group.add_argument('--spi-bus-speed', type=int, default=8000000, help='SPI max bus speed (Hz)')
spi_group.add_argument('--spi-transfer-size', type=int, default=4096, help='SPI bus max transfer unit (bytes)')
spi_group.add_argument('--spi-mode', type=int, default=None, help='SPI mode (0-3)')
spi_group.add_argument('--spi-cs-high', type=bool, default=False, help='SPI chip select is high (gpio_cs_spi driver only)')

ftdi_group = parser.add_argument_group('FTDI')
Expand Down
1 change: 1 addition & 0 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

class test_spi_opts(object):
spi_port = 0
spi_mode = 0
spi_device = 0
spi_bus_speed = 8000000
spi_transfer_size = 4096
Expand Down