10#ifndef AT25040B_REGISTERS_HPP
11#define AT25040B_REGISTERS_HPP
20using detail::operator
""_u8;
24inline constexpr uint8_t
kWren = 0x06;
25inline constexpr uint8_t
kWrdi = 0x04;
26inline constexpr uint8_t
kRdsr = 0x05;
27inline constexpr uint8_t
kWrsr = 0x01;
28inline constexpr uint8_t
kRead = 0x03;
29inline constexpr uint8_t
kWrite = 0x02;
51using StatusBp = detail::Field<uint8_t, kStatusBpShift, 2U>;
52static_assert(StatusBp::kMask ==
kStatusBpMask,
"BP1:BP0 are bits 3 and 2 (Table 6-2)");
63 return (
static_cast<uint32_t
>(status) &
68 "WEN and BP1:BP0 may be set when idle");
70 "busy, an echoed RDSR opcode and a set unused bit are not idle");
Compile-time helpers of the AT25040B driver: exact hook matching, typed register fields and enumerati...
Opcodes and bit masks of the chip, as constexpr values.
Definition at25040b_registers.hpp:18
constexpr uint8_t kWrite
WRITE: write data to the array.
Definition at25040b_registers.hpp:29
constexpr uint8_t kRdsr
RDSR: read the status register.
Definition at25040b_registers.hpp:26
constexpr uint8_t kStatusBpMask
BP1 and BP0 together.
Definition at25040b_registers.hpp:45
constexpr uint8_t kStatusRdy
RDY: 1 while a write cycle runs.
Definition at25040b_registers.hpp:41
detail::Field< uint8_t, kStatusBpShift, 2U > StatusBp
BP1:BP0 as a field of the status byte (Table 6-4): two bits from bit 2.
Definition at25040b_registers.hpp:51
constexpr uint8_t kStatusBpShift
Position of BP0.
Definition at25040b_registers.hpp:46
constexpr uint8_t kStatusBp0
BP0: block protection, low bit.
Definition at25040b_registers.hpp:43
constexpr uint16_t kAddressMax
The highest address any part of the family decodes (A8 to A0, AT25040B).
Definition at25040b_registers.hpp:38
constexpr uint16_t kAddressLowMask
Address bits A7 to A0: the address byte of READ and WRITE (Figures 7-6 and 7-7).
Definition at25040b_registers.hpp:36
constexpr uint16_t kAddressA8
Address bit that goes into the opcode instead of the address byte.
Definition at25040b_registers.hpp:34
constexpr uint8_t kOpcodeA8
Bit of a READ or WRITE opcode that carries address bit A8 (AT25040B only, Table 6-1 note 1).
Definition at25040b_registers.hpp:32
constexpr uint8_t kRead
READ: read data from the array.
Definition at25040b_registers.hpp:28
constexpr uint8_t kWrdi
WRDI: reset the write enable latch.
Definition at25040b_registers.hpp:25
constexpr uint8_t kStatusUnused
Bits 7 to 4: 0 when no write cycle runs.
Definition at25040b_registers.hpp:47
constexpr bool IsIdleStatus(uint8_t status) noexcept
True for a status byte an idle chip can return: bits 7 to 4 clear and RDY clear (Table 6-3)....
Definition at25040b_registers.hpp:62
constexpr uint8_t kStatusBp1
BP1: block protection, high bit.
Definition at25040b_registers.hpp:44
constexpr uint8_t kWrsr
WRSR: write the status register (BP1, BP0).
Definition at25040b_registers.hpp:27
constexpr uint8_t kStatusWen
WEN: 1 when the write enable latch is set.
Definition at25040b_registers.hpp:42
constexpr uint8_t kStatusBusyByte
Every bit reads 1 during a write cycle.
Definition at25040b_registers.hpp:48
constexpr uint8_t kWren
WREN: set the write enable latch.
Definition at25040b_registers.hpp:24