Skip to content

Commit fc0578d

Browse files
authored
Merge pull request #9 from parallaxinc/fix-issue-8-by-adding-i2c-repeat-block
I2C Repeat Block Added and Value for I2C State Machine Uncommented
2 parents af6d670 + 554a755 commit fc0578d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cbcore.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ namespace cyberbot {
121121
export const IR_DETECT = 31
122122
export const PWM_OUT = 32
123123
export const QTI_READ = 33
124-
//const HANDSHAKE = 99
124+
export const I2C_REPEAT = 40
125+
const HANDSHAKE = 99
125126
//const PWR_LED_WARN = 25
126127
//const PWR_BRN_DET = 24
127128

@@ -447,6 +448,21 @@ namespace cyberbot {
447448
return read_r();
448449
}
449450

451+
/**
452+
* Connects a pair of cyber:bot board I/O pins to the micro:bit module's I2C bus.
453+
* @param pinSCL The cyber:bot board pin that connects to the micro:bit module's I2C SCL (serial clock) line.
454+
* @param pinSDA The cyber:bot board pin that connects to the micro:bit module's I2C SDA (serial data) line.
455+
* @param f The frequency of the IR light being sent out.
456+
*/
457+
//% blockId="cyberbot_i2cRepeat"
458+
//% block="I2C Repeat on with clock signal on pin %pinSCL data on %pinSDA"
459+
//% inlineInputMode="external"
460+
//% group="Other"
461+
//% weight=350
462+
export function i2cRepeat(pinSCL: BotPin, pinSDA: BotPin) {
463+
sendCommand( 0, 0, I2C_REPEAT,null,pinSCL, pinSDA);
464+
}
465+
450466
/**
451467
* Reads the length of a pulse received at a desired pin.
452468
* @param pin The desired pin.

0 commit comments

Comments
 (0)