@@ -162,6 +162,10 @@ export class RPI2C extends BasePeripheral implements Peripheral {
162
162
rxThreshold = 0 ;
163
163
txThreshold = 0 ;
164
164
control = IC_SLAVE_DISABLE | IC_RESTART_EN | ( I2CSpeed . FastMode << SPEED_SHIFT ) | MASTER_MODE ;
165
+ ssClockHighPeriod = 0x0028 ;
166
+ ssClockLowPeriod = 0x002f ;
167
+ fsClockHighPeriod = 0x0006 ;
168
+ fsClockLowPeriod = 0x000d ;
165
169
targetAddress = 0x55 ;
166
170
slaveAddress = 0x55 ;
167
171
abortSource = 0 ;
@@ -176,6 +180,14 @@ export class RPI2C extends BasePeripheral implements Peripheral {
176
180
return ( ( this . control >> SPEED_SHIFT ) & SPEED_MASK ) as I2CSpeed ;
177
181
}
178
182
183
+ get sclLowPeriod ( ) {
184
+ return this . speed === I2CSpeed . Standard ? this . ssClockLowPeriod : this . fsClockLowPeriod ;
185
+ }
186
+
187
+ get sclHighPeriod ( ) {
188
+ return this . speed === I2CSpeed . Standard ? this . ssClockHighPeriod : this . fsClockHighPeriod ;
189
+ }
190
+
179
191
get masterBits ( ) {
180
192
return this . control & IC_10BITADDR_MASTER ? 10 : 7 ;
181
193
}
@@ -349,6 +361,14 @@ export class RPI2C extends BasePeripheral implements Peripheral {
349
361
}
350
362
this . clearInterrupts ( R_RX_FULL ) ;
351
363
return this . rxFIFO . pull ( ) ;
364
+ case IC_SS_SCL_HCNT :
365
+ return this . ssClockHighPeriod ;
366
+ case IC_SS_SCL_LCNT :
367
+ return this . ssClockLowPeriod ;
368
+ case IC_FS_SCL_HCNT :
369
+ return this . fsClockHighPeriod ;
370
+ case IC_FS_SCL_LCNT :
371
+ return this . fsClockLowPeriod ;
352
372
case IC_INTR_STAT :
353
373
return this . intStatus ;
354
374
case IC_INTR_MASK :
@@ -453,6 +473,22 @@ export class RPI2C extends BasePeripheral implements Peripheral {
453
473
}
454
474
return ;
455
475
476
+ case IC_SS_SCL_HCNT :
477
+ this . ssClockHighPeriod = value & 0xffff ;
478
+ return ;
479
+
480
+ case IC_SS_SCL_LCNT :
481
+ this . ssClockLowPeriod = value & 0xffff ;
482
+ return ;
483
+
484
+ case IC_FS_SCL_HCNT :
485
+ this . fsClockHighPeriod = value & 0xffff ;
486
+ return ;
487
+
488
+ case IC_FS_SCL_LCNT :
489
+ this . fsClockLowPeriod = value & 0xffff ;
490
+ return ;
491
+
456
492
case IC_RX_TL :
457
493
this . rxThreshold = value & 0xff ;
458
494
if ( this . rxThreshold > this . rxFIFO . size ) {
0 commit comments