Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for spi.read() second argument #207

Closed
microbit-carlos opened this issue May 2, 2024 · 2 comments
Closed

Missing documentation for spi.read() second argument #207

microbit-carlos opened this issue May 2, 2024 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@microbit-carlos
Copy link
Contributor

Present in V1 and V2, it essentially writes to the SPI out the value of the second argument, for as long as it is reading data.

V1: https://github.com/bbcmicrobit/micropython/blob/v1.1.1/source/microbit/microbitspi.cpp#L111-L117

V2:

uint8_t byte_out = 0;
if (n_args == 3) {
byte_out = mp_obj_get_int(args[2]);
}
memset(vstr.buf, byte_out, vstr.len);
int ret = microbit_hal_spi_transfer(vstr.len, (uint8_t *)vstr.buf, (uint8_t *)vstr.buf);

@microbit-carlos microbit-carlos added the documentation Improvements or additions to documentation label May 2, 2024
@microbit-carlos microbit-carlos self-assigned this May 2, 2024
@microbit-carlos microbit-carlos added this to the 2.2.0-beta.2 milestone May 2, 2024
@microbit-carlos
Copy link
Contributor Author

@microbit-carlos
Copy link
Contributor Author

Docs PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant