Overview
Comment: | Allow user to configure SPI parameters |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
831f49e1437ab4568fc783b473681d72 |
User & Date: | rkeene on 2020-04-27 13:44:49 |
Other Links: | manifest | tags |
Context
2020-04-28
| ||
17:39 | Fixed some bugs and made a few changes check-in: 88cba7a2f5 user: rkeene tags: trunk | |
2020-04-27
| ||
13:44 | Allow user to configure SPI parameters check-in: 831f49e143 user: rkeene tags: trunk | |
13:38 | Allow user to configure multi-transmit delay check-in: a1662e7ae5 user: rkeene tags: trunk | |
Changes
Modified __init__.py from [db9b618ade] to [8b552dec0f].
︙ | |||
218 219 220 221 222 223 224 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - - | ] def __init__(self, spi_bus, spi_dev, config = None): spi = spidev.SpiDev() spi.open(spi_bus, spi_dev) self.__spi = spi |
︙ | |||
255 256 257 258 259 260 261 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - - - - - - - - - - | if reg_string.isnumeric(): return int(reg_string) for reg_number, reg_info in enumerate(self.__register_map): if reg_info['name'] == reg_string: return reg_number raise NameError("Invalid register value {}".format(reg_string_orig)) |
︙ | |||
402 403 404 405 406 407 408 409 410 411 412 413 414 415 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | + + + + + + | def configure(self, config): self.__config = config if config is None: return None self.__spi.max_speed_hz = self.__config.get('frequency', 4000000) self.__spi.bits_per_word = self.__config.get('bits_per_word', 8) self.__spi.cshigh = self.__config.get('csigh', False) self.__spi.no_cs = self.__config.get('no_cs', False) self.__spi.lsbfirst = self.__config.get('lsbfirst', False) self.__spi.threewire = self.__config.get('threewire', False) self.__spi.mode = self.__config.get('mode', 1) return None def initialize(self): self.__reset_device() self.__set_defaults() |
︙ |