Skip to content

Split out rewrite() from current resend() #60

Open
@2bndy5

Description

@2bndy5

Currently resend() is designed to be used like send() without uploading a payload. I think it would help user code that is async-oriented if rewrite() is abstracted from resend() (similar to how write() is a helper to send()).

Pseudo code

def resend() -> bool:
    if not rewrite():
         return False
    while not self._status & 0x70:
        self.update()
    return self.irq_ds

def rewrite() -> bool:
    if self.fifo(about_tx=true, check_empty=True):
        return False  # return early if nothing in TX FIFO
    self._ce_pin = False
    self.clear_status_flags()
    # self._reg_write_bytes(0xE3, b"")  # dont't issue REUSE_TX_PL command
    self._ce_pin.value = True
    # CircuitPython is slow enough to skip the mandatory 10us delay on CE pin
    # time.sleep(0.00001)

Of course, there is more nuance in the current implementation for resend() where it can return a payload from the ACK packet (if that feature is enabled).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions