Expand description
The SPI transactions the SX1302 answers.
Every transfer starts with a target byte, because the concentrator sits in front of the radios and passes a transfer through to whichever the first byte names. After that comes a command byte carrying the access bit and the top seven bits of the address, then the low eight bits, then the data.
A read costs two bytes more than a write: the chip needs a byte to turn the bus around, so the host clocks out a dummy and reads the answer in the last byte it receives.
These functions build the bytes and read them back. They touch no bus, so a caller can check a frame against the datasheet, or replay one captured from a working gateway, without any hardware present.
Constants§
- BURST_
CHUNK - The most bytes one burst carries before the host starts another.
- BURST_
READ_ HEADER_ LEN - How many bytes the header of a burst read takes, before the data.
- BURST_
WRITE_ HEADER_ LEN - How many bytes the header of a burst write takes, before the data.
- CLOCK_
HZ - The clock the concentrator is driven at, in hertz.
- READ_
ACCESS - The access bit for a read, which is the absence of the write bit.
- READ_
LEN - How many bytes a single-byte read transfer takes.
- TARGET_
CONCENTRATOR - The concentrator itself, rather than a radio behind it.
- TARGET_
RADIO_ A - The radio on the first chain, reached through the concentrator.
- TARGET_
RADIO_ B - The radio on the second chain.
- WRITE_
ACCESS - The access bit for a write, the top bit of the command byte.
- WRITE_
LEN - How many bytes a single-byte write transfer takes.
Functions§
- burst_
read_ header - Builds the header that precedes the data of a burst read.
- burst_
write_ header - Builds the header that precedes the data of a burst write.
- chunks
- Walks a long transfer as the chunks it actually goes out in.
- field
- Reads the bits a register holds out of the byte it lives in.
- read
- Builds the transfer that reads one byte from a register.
- read_
value - Takes the byte a read transfer brought back.
- with_
field - Puts a value into the bits a register holds, leaving the rest of the byte alone.
- write
- Builds the transfer that writes one byte to a register.