kulbhushanchand / MCP4251

Arduino library for MCP4251 Digital Potentiometer
https://kulbhushanchand.github.io/MCP4251/
GNU General Public License v3.0
13 stars 1 forks source link

Feat add support for other two pots #3

Open SpyrosCpt opened 2 years ago

SpyrosCpt commented 2 years ago

Context: I noticed that when using this library I could only control 2/4 Potentiometers. I have added support for the other two.

Important mentions:

  1. All bools have now been replaced with uint8_t's
  2. I have added an extra function to access TCON1
  3. Some code was cleaned up
  4. There was a mismatch in type for DigitalPotSetWiperPosition, this caused code not to compile on Platformio I have made it a uint16_t
kulbhushanchand commented 2 years ago

Thank you for the proposed features.

The proposed features are suitable for a 4 channel potentiometer. This library is for MCP4251 which is a 2 channel potentiometer. If the proposed features are to be merged, then the name of the library needed to be changed to generic term like MCP4X51. Changing name of the library to incorporate new features after publishing may not be a good idea.

Better idea would be to create a new library with generic terminology (MCP4XXX) or for the specific 4 channel pot (e.g. MCP4451) which will cover all the use cases for potentiometer 1 to 4.

Also, one of the commit is directly relevant to issue at https://github.com/kulbhushanchand/MCP4251/issues/2#issuecomment-1126255878 which is still pending due to my other commitments.