AT25040B Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
at25040b_types.hpp File Reference

Public types of the AT25040B driver: errors, Result<T>, variants, block protection and configuration. More...

#include <cstddef>
#include <cstdint>
#include "at25040b_detail.hpp"
#include "at25040b_version.h"

Go to the source code of this file.

Classes

struct  at25040b::Result< T >
 The value of a call, or why there is none. More...
 
struct  at25040b::Result< void >
 The result of a call that returns no value. More...
 
struct  at25040b::Status
 The status register, decoded (Tables 6-2 and 6-3). More...
 
struct  at25040b::Config
 What the driver is told about the board. The chip itself has nothing to configure: its only setting, the block protection, is non-volatile and set with SetBlockProtection(). More...
 

Namespaces

namespace  at25040b
 The AT25040B driver: everything it declares lives here; internals in detail.
 

Enumerations

enum class  at25040b::Error : uint8_t {
  at25040b::Error::Ok = 0 , at25040b::Error::NotInitialized = 1 , at25040b::Error::InvalidArgument = 2 , at25040b::Error::Bus = 3 ,
  at25040b::Error::Timeout = 4 , at25040b::Error::DeviceIdMismatch = 5 , at25040b::Error::Crc = 6 , at25040b::Error::Busy = 7 ,
  at25040b::Error::DeviceFault = 8 , at25040b::Error::Unsupported = 9 , at25040b::Error::NoDevice = 16 , at25040b::Error::BusNoise = 17 ,
  at25040b::Error::WriteProtected = 18 , at25040b::Error::BlockProtected = 19 , at25040b::Error::WriteMismatch = 20 , at25040b::Error::Pin = 21
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  at25040b::LogLevel : uint8_t { at25040b::LogLevel::Error = 0 , at25040b::LogLevel::Warning , at25040b::LogLevel::Info , at25040b::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  at25040b::Variant : uint8_t { at25040b::Variant::At25010b = 0 , at25040b::Variant::At25020b = 1 , at25040b::Variant::At25040b = 2 }
 Which part of the family is fitted. The chip cannot tell its size, so it is configured. More...
 
enum class  at25040b::BlockProtect : uint8_t { at25040b::BlockProtect::None = 0 , at25040b::BlockProtect::UpperQuarter = 1 , at25040b::BlockProtect::UpperHalf = 2 , at25040b::BlockProtect::All = 3 }
 Block write protection level, BP1:BP0 in the status register (Table 6-4). More...
 
enum class  at25040b::Verify : uint8_t { at25040b::Verify::None = 0 , at25040b::Verify::ReadBack = 1 }
 Extra verification for one Read() or Write() call, chosen per call. More...
 

Functions

constexpr const char * at25040b::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr std::size_t at25040b::CapacityBytes (Variant variant) noexcept
 Array size of a variant.
 
constexpr std::size_t at25040b::ProtectedFrom (Variant variant, BlockProtect level) noexcept
 First protected address of a protection level (Table 6-4).
 
constexpr Error at25040b::Validate (const Config &config) noexcept
 Check a configuration without touching the chip.
 
constexpr const char * at25040b::GetDriverVersion () noexcept
 
constexpr uint32_t at25040b::GetDriverVersionMajor () noexcept
 
constexpr uint32_t at25040b::GetDriverVersionMinor () noexcept
 
constexpr uint32_t at25040b::GetDriverVersionPatch () noexcept
 

Variables

constexpr std::size_t at25040b::kPageSizeBytes = 8
 Bytes per page: a WRITE never crosses an 8-byte page (section 6, "Write Sequence").
 
constexpr std::size_t at25040b::kReadChunkBytes = 16
 Data bytes per READ transfer: Read() splits longer requests into transfers of at most this many data bytes.
 
constexpr std::size_t at25040b::kMaxTransferBytes = 2 + kReadChunkBytes
 Longest transfer the driver asks of the port: opcode, address byte and kReadChunkBytes.
 
constexpr uint32_t at25040b::kWriteCycleMaxUs = 5000
 Longest self-timed write cycle t_WC, in microseconds (Table 4-3, maximum, every supply).
 
constexpr uint32_t at25040b::kPollIntervalUs = 100
 Time between two status reads while the driver waits for a write cycle, in microseconds.
 
constexpr uint32_t at25040b::kWriteTimeoutMaxUs = 1000000
 Longest Config::write_timeout_us the driver accepts, in microseconds (one second).
 
constexpr std::size_t at25040b::kIdentityReadBytes = 8
 Bytes from address 0 that EnsureInitialized() reads twice when check_write_enable is off.
 

Detailed Description

Public types of the AT25040B driver: errors, Result<T>, variants, block protection and configuration.

Everything here is plain data with no platform dependency, so handlers, tests and tools can include it without the driver template. Section and table numbers refer to the AT25010B/020B/040B datasheet, Atmel-8707F (01/2015).