Closed Jake-Carter closed 2 days ago
I recommend designated initializers instead of runtime. That way you don't need any runtime operations after and need to manage more global state.
#define NUM_MEMBERS 4
typedef struct
{
int32_t a , b, c;
}example_t;
example_t test[NUM_MEMBERS] = {
[0 ... NUM_MEMBERS - 1] = {.a = -1, .b = -1, .c = -1}
};
I recommend designated initializers instead of runtime. That way you don't need any runtime operations after and need to manage more global state.
#define NUM_MEMBERS 4 typedef struct { int32_t a , b, c; }example_t; example_t test[NUM_MEMBERS] = { [0 ... NUM_MEMBERS - 1] = {.a = -1, .b = -1, .c = -1} };
Thanks @EricB-ADI, I was looking for this type of syntax. Just updated the PR
@EricB-ADI ready for final review
Description
Fixes #998
As the internal UART state struct was only initialized per used UART instance, attempting to use UART1 (or higher) with DMA auto handlers would never trigger the user's callback functions. The state struct's DMA channel values would be initialized to 0 instead of -1, which the drivers would assume was a valid channel acquisition.
This PR fixes the bug by initializing the UART state array correctly.
Checklist Before Requesting Review