-
Notifications
You must be signed in to change notification settings - Fork 23
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
Support of slice for Program code #55
Comments
As pio programs are only a few bytes long, I wonder if it's worth to spend effort on optimizing memory usage. |
Hello, @jannic. Your indication is correct; the performance problem is not so significant. However, I think that is more convenient since slice is available as a primitive type.
The code I first confront this issue is like this: fn main() {
//
pio0.install(&PROGRAM).unwrap();
//
}
// Here the program is compile-time-static value
// but this approach is not available.
static PROGRAM: Program<32> = pio_proc::pio_asm![
".wrap_target",
" set pins, 1",
" set pins, 0",
".wrap",
].program; I get some errors because ArrayVec does not work in statics. |
Now
Program::code
isArrayVec
type, which contains its own data.I think almost all of use cases are to program "static" one, and it is not necessary to allocate memory every time.
So I suggest to add slice support for
Program::code
.Furthermore, I want pio_proc assembler macros to support slice as well.
The macros returns
ProgramWithDefines<>
type, which has dynamic type parameter, so it is not possible to use it as static variable.I am able to work with this change, but I am not sure if it is good idea or not.
The text was updated successfully, but these errors were encountered: