adafruit / Adafruit_Protomatter

RGB matrix library for Arduino
70 stars 24 forks source link

SAMD51: adjustable pixel clock duty cycle #64

Closed PaintYourDragon closed 1 year ago

PaintYourDragon commented 1 year ago

This PR allows a slight degree of adjustment to the duty cycle of the HUB75 pixel clock signal. Currently only SAMD51 incorporates this change. This may help in supporting a wider range of RGB matrices, some of which are persnickety about the shape of the clock signal. Default settings should work for the current P4 64x32 matrices. Older matrices might want slightly higher settings.

Duty can be adjusted with a call to: matrix.setDuty(n); where 'n' is (for different F_CPU settings):

'n' is related to CPU clock cycles but the percentage range of duty cycles isn't the same for each F_CPU. Best to experiment through trial and error. Adding the following in one’s loop() function may help:

  int c = Serial.read();
  if (c >= '0') matrix.setDuty(c - '0');

Or this might just be a huge boondoggle, in which case changes should be reverted to an earlier release (with a bumped version number to encourage updating).

PaintYourDragon commented 1 year ago

Pinging @ladyada @dhalbert @jepler just so y’all know a change has occurred. No review needed, so kludgey it would probably just cause a migraine.