mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things

Home Page:https://mbed.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I2C write byte is not sending bytes

lefebvresam opened this issue · comments

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

Hmm, are any of those I2C calls returning an error code?