Skip to content

Commit

Permalink
Change I2C speed depending on the kind of write
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
haata committed Mar 21, 2020
1 parent 0acb3e8 commit e1a1d81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion Scan/Devices/ISSILed/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ void i2c_isr( uint8_t ch )
#if defined(_kinetis_)
*I2C_D = element;
#elif defined(_sam_)
// while (! (status & TWI_SR_TXRDY));
if (!(status & TWI_SR_TXRDY)) return;
twi_dev->TWI_THR = element;
#endif
Expand Down
9 changes: 6 additions & 3 deletions Scan/Devices/ISSILed/led_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,6 @@ void LED_reset()
GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup );
}

// Initialize I2C in slow mode
i2c_setup(0);

// Force PixelMap to be ready for the next frame
Pixel_FrameState = FrameState_Update;

Expand Down Expand Up @@ -818,12 +815,18 @@ inline void LED_setup()
uint8_t LED_chipSend;
void LED_linkedSend()
{
// Initialize I2C in slow mode
i2c_setup(0);

// Check if we've updated all the ISSI chips for this frame
if ( LED_chipSend >= ISSI_Chips_define )
{
// Now ready to update the frame buffer
Pixel_FrameState = FrameState_Update;

// Initialize I2C in fast mode
i2c_setup(1);

// Finished sending the buffer, exit linked send
return;
}
Expand Down

0 comments on commit e1a1d81

Please sign in to comment.