Hi Anthony, On 02/22/2017 05:17 PM, Anthony Merlino wrote: > I'm trying to understand a few things. In the <radio>_setup command, > how should I copy the default value struct into the overall params if > the radio_params pointer member is const. Should I use memcpy? Or > should I create a new struct on the stack and initialize it with the > correct pointer before copying it to the dev->params?
Usually the setup() function gets a state struct and the params as parameters, e.g., device_setup(device_t *state_struct, const device_params_t *params); Usually we double all fields that are needed after setup into the state struct, or put a pointer in the state struct pointing to params. (On some MCU's there's a small speed penalty for reading values from flash. Depending on the device and how often a value is read, that's tolarable.) > Also, I'm trying to understand how to achieve your comment: "In the > default case, all parameters end up in flash." I meant that if the params struct and the "default advanced settings" struct are const, they'd end up in flash, although it is still possible to use runtime-generated versions (in RAM) and use them for initializing the device. Kaspar _______________________________________________ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel