Async/DMA Peripheral Example Improvements & Doc Updates
The example projects for many of the peripherals (such as SPI, I2C, UART, etc) which leverage the mxc_
A problem with the examples is the request structure is on the stack for main(). This isn't a problem for the examples since main never exits, but should a user go create a real application, if the request structure is on the stack, once the function exits, there is a high chance the request data is corrupted due to the stack space being reused. The peripherals only store the pointer to the provided request, not make a copy. At a minimum the examples should be modified to move the request struct into global scope to get it off the stack with comments explaining why. Also, the peripheral documentation should be updated to indicate the structure needs to be preserved during the duration of the transaction.
Alternatively, the peripheral could make a copy of the request, but that may or may not be wasted memory usage.