Skip to content

Commit e1a1d81

Browse files
committed
Change I2C speed depending on the kind of write
- Long writes are slow to prevent errors mid-sequence (flickering) * This is likely to have something to do with the PWM registers - Short writes are fast to prevent noise during page setup - Leaving zero pages and send page as short writes (seem to error just like the short register writes)
1 parent 0acb3e8 commit e1a1d81

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: Scan/Devices/ISSILed/i2c.c

-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,6 @@ void i2c_isr( uint8_t ch )
650650
#if defined(_kinetis_)
651651
*I2C_D = element;
652652
#elif defined(_sam_)
653-
// while (! (status & TWI_SR_TXRDY));
654653
if (!(status & TWI_SR_TXRDY)) return;
655654
twi_dev->TWI_THR = element;
656655
#endif

Diff for: Scan/Devices/ISSILed/led_scan.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,6 @@ void LED_reset()
666666
GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup );
667667
}
668668

669-
// Initialize I2C in slow mode
670-
i2c_setup(0);
671-
672669
// Force PixelMap to be ready for the next frame
673670
Pixel_FrameState = FrameState_Update;
674671

@@ -818,12 +815,18 @@ inline void LED_setup()
818815
uint8_t LED_chipSend;
819816
void LED_linkedSend()
820817
{
818+
// Initialize I2C in slow mode
819+
i2c_setup(0);
820+
821821
// Check if we've updated all the ISSI chips for this frame
822822
if ( LED_chipSend >= ISSI_Chips_define )
823823
{
824824
// Now ready to update the frame buffer
825825
Pixel_FrameState = FrameState_Update;
826826

827+
// Initialize I2C in fast mode
828+
i2c_setup(1);
829+
827830
// Finished sending the buffer, exit linked send
828831
return;
829832
}

0 commit comments

Comments
 (0)