Skip to content

Target: STM i2c_byte_write returns value not consistent with documentation #9447

@omdathetkan

Description

@omdathetkan

Description

    /** Write to an I2C slave
     *
     * Performs a complete write transaction. The bottom bit of
     * the address is forced to 0 to indicate a write.
     *
     *  @param address 8-bit I2C slave address [ addr | 0 ]
     *  @param data Pointer to the byte-array data to send
     *  @param length Number of bytes to send
     *  @param repeated Repeated start, true - do not send stop at end
     *         default value is false.
     *
     *  @returns
     *       0 on success (ack),
     *       nonzero on failure (nack)
     */
int write(int address, const char *data, int length, bool repeated = false);
int I2C::write(int data) {
    lock();
    int ret = i2c_byte_write(&_i2c, data);
    unlock();
    return ret;
}

Then in i2c_byte_write it always returns 1;

ACK should be checked and the result should be returned

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions