Using I2C in BBC Basic on Pi Pico

Another challenge .... does somebody have an example for I2C on the Pi Pico with BBC Basic? Searches on the internet only come up with micropython or C examples.

This is a part of an example program I found:
int main() {
    // Pins
    const uint sda_pin = 16;
    const uint scl_pin = 17;

    // Ports
    i2c_inst_t *i2c = i2c0;          <----- how do I do this in BBC Basic?

    //Initialize I2C port at 400 kHz
    i2c_init(i2c, 400 * 1000);

    // Initialize I2C pins
    gpio_set_function(sda_pin, GPIO_FUNC_I2C);
    gpio_set_function(scl_pin, GPIO_FUNC_I2C);

So for example ... how can I initiate the i2c instance just like the marked line in BBC Basic. The other functions will probably be sys-calls like
sda_pin%=16
sdc_pin%=17
SYS "gpio_set_function", sda_pin, GPIO_FUNC_I2C 

And replace GPIO_FUNC_I2C with it's value, whatever that may be.... (probably 3). Are there any examples for this?

Comments