Pi4J / pi4j-v2

Pi4J Version 2.0
Apache License 2.0
273 stars 57 forks source link

SPI mode1 on spi0. Also flags overwritten #235

Closed taartspi closed 1 year ago

taartspi commented 2 years ago

I need mode1 on spi0. The SPI Provider prevents this. The spi provider comment states " // SPI MODE_1 and MODE_2 are not supported on the AUX SPI BUS_1 by PiGPIO" The code does not agree so a simple change let me create the spi.

  1. Need to confirm the comments are correct and make two changes in the if test to conform to the comments
  2. The flags are cleared by flags = (flags & (0xFFFFFFFF ^ SPI_BUS_MASK)) & SPI_BUS_MASK; // clear AUX bit
  3. MODE and BUS appear to use a default value if none supplied by the application. These overwrite what is in the flags.
    A) should these two attributes be required B) use a != null check and only overwrite the flags if they were supplied. This would allow the user to set flags that may not function and create debug nightmare, so I think they being required is better but requires existing user to update code when moving this code level.
taartspi commented 2 years ago

I created a pull request #236 It contains code changes for items 1 and 2. If you agree with this please move it thru the process as I know a user will want this when I provide the ADS1256 code.

Separately item 3. If you agree changes are needed describe which way you prefer and I will do that with another pull request.

thanks Tom

@eitch @FDelporte

taartspi commented 1 year ago

item 3 fixed with PR 248

All items now resolved/integrated