/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef ECXX_PLATFORM_COMMON_TWI_CONSTANT_H
#define ECXX_PLATFORM_COMMON_TWI_CONSTANT_H


namespace eCxx {


//
// Default TWI clock frequency
//
constexpr uint32_t DefaultTWIFrequency = 100000UL;


//
// TWI result codes
//
enum class TWIResultCode : uint8_t {
    NoError     = 0, // No error
    DataTooLong = 1, // The length of the data to be transmitted is too long for the internal buffer
    TimeOut     = 2, // The process has taken too long
    NotSlaveTx  = 3, // Not a slave transmitter
    AddressNACK = 4, // SLA+RW transmitted, NACK received
    DataNACK    = 5, // Data   transmitted, NACK received
    OtherError  = 6  // Arbitration lost in SLA+RW
                     // Bus error/busy (illegal start or stop condition)
};


} // namespace eCxx


#endif
