spicmds: Rework spi config commands

Rework the spi_config commands so that bus configuration and shutdown
message configuration is done separately from the main "config_spi"
command.  This makes the spi configuration more flexible.  It's now
possible to use software spi without a CS pin.  It's now possible to
define multiple SPI messages to send on a shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-06 11:44:29 -04:00
parent 30bd7c0e47
commit c2a08962b7
9 changed files with 115 additions and 116 deletions

View file

@ -201,8 +201,8 @@ class Replicape:
if not self.host_mcu.is_fileoutput() and os.path.exists(
'/sys/devices/platform/ocp/481a0000.spi/spi_master/spi2'):
sr_spi_bus = "spidev2.1"
self.sr_spi = bus.MCU_SPI(self.host_mcu, sr_spi_bus,
None, 0, 50000000, self.sr_disabled)
self.sr_spi = bus.MCU_SPI(self.host_mcu, sr_spi_bus, None, 0, 50000000)
self.sr_spi.setup_shutdown_msg(self.sr_disabled)
self.sr_spi.spi_send(self.sr_disabled)
def note_pwm_start_value(self, channel, start_value, shutdown_value):
self.mcu_pwm_start_value |= not not start_value