Skip to content

I2C write byte is not sending bytes #236

Open
@lefebvresam

Description

@lefebvresam

When I try this:

RetCode_t RA8875::GT911_WriteConfig(GTConfig *config){
    // char address[2] = { 0 };
    // address[0] = GTP_REG_CONFIG_DATA >> 8; // add H
    // address[1] = GTP_REG_CONFIG_DATA & 0xFF; // add L
    // int err = m_i2c->write(m_addr, address, 2, true);
    // if (err) {
    //     ERR("I2C result: %d", err);
    // }
    INFO("GTConfig size: %u", sizeof(GTConfig));
    m_i2c->lock();
    m_i2c->start();
    m_i2c->write_byte((uint8_t)(m_addr+1));
    m_i2c->write_byte((uint8_t)GTP_REG_CONFIG_DATA >> 8);
    m_i2c->write_byte((uint8_t)GTP_REG_CONFIG_DATA & 0xFF);
    for (int i = 0; i < sizeof(GTConfig); i++) {
        int err = m_i2c->write_byte(*((uint8_t*)config+i));
        if (err) {
            ERR("I2C result: %d", err);
        }  
    }  
    m_i2c->stop();
    m_i2c->unlock();
    // err = m_i2c->write(m_addr, (char*)config, sizeof(GTConfig));
    return noerror;
}

I get this:

New25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions