17.8.2.3.2 Workflow

  1. Write packet to slave.
    wr_packet.address     = SLAVE_ADDRESS;
    wr_packet.data_length = DATA_LENGTH;
    wr_packet.data        = wr_buffer;
    
  2. Infinite while loop, while waiting for interaction with slave.
    while (true) {
        /* Infinite loop */
        if (!port_pin_get_input_level(BUTTON_0_PIN)) {
            while (!port_pin_get_input_level(BUTTON_0_PIN)) {
                /* Waiting for button steady */ 
            }
            /* Send every other packet with reversed data */
            if (wr_packet.data[0] == 0x00) {
                wr_packet.data = &wr_buffer_reversed[0];
            } else {
                wr_packet.data = &wr_buffer[0];
            }
            i2c_master_write_packet_job(&i2c_master_instance, &wr_packet);
        }
    }