#avr Logs

Apr 14 2020

#avr Calendar

12:10 AM evidlo2: I have a DSP algorithm which is called every time a sample is available. I'd like to move it into a function call in a separate header file so I can write tests for x86. It has about 8 state variables. Does it make sense to pass this function a struct pointer containing the state variables every time it is called?
12:28 AM PoppaVic: depends on who else ever accesses it, and how often you call it, and the sizes, and the phase of the moon
12:40 AM evidlo2: PoppaVic: I'll call it 100 times a second. The struct contains mostly uint32 and uint16
12:42 AM evidlo2: I just want to know if this is a terrible idea
12:43 AM PoppaVic: <shrug> It's your code, not a multiprogrammer project or library, etc? Just use the one & only object as a global.
12:43 AM evidlo2: by object you mean struct?
12:43 AM PoppaVic: if shit has to read&write from different places.... if there are multiple copies... Then stick to the pointer
12:43 AM PoppaVic: struct, int - "objectL the thing"
12:44 AM PoppaVic: the item, the widget - object.
12:44 AM evidlo2: the external function is the only thing which modifies the struct
12:44 AM PoppaVic: Remember: there is an overhead to passing anything in and out of a func
12:45 AM PoppaVic: OK, so then you just access your private object. No one else needs to know
12:46 AM evidlo2: but I need to read certain values from this struct in the main loop
12:46 AM evidlo2: should I maybe split the struct into internal/external structs?
12:47 AM PoppaVic: ahh.. You could write accessors, or sure: a public struct/object and a private struct/object. Now you also have to look out for "volatile" and friends.
04:02 AM Santh_ is now known as Santh
04:20 AM Santh_ is now known as Santh
06:38 AM megal0maniac: Nice to see this place is still around :)
08:41 AM Smidge204_: Here's an odd question; Looking at the interrupt vector table of the ATtiny814, there is no vector 5
08:41 AM Smidge204_: So since each vector is 2 bytes, does that mean vector 4 is 4 bytes or they just skipped a number for some reason?
08:45 AM LeoNerd: They're placed at predictable indexes
08:45 AM LeoNerd: If there is no 5 then there's just a gap, probably accounting for some missing hardware that some other chip does have
08:45 AM LeoNerd: The entire 1-series are designed to be very interchangeable, so sometimes there's gaps in some chip where something in a bigger chip goes
08:46 AM Smidge204_: Makes sense to me
08:47 AM Smidge204_: So the actual memory addresses would still be 2x the vector number, being 2 bytes each, and there's just an extra two bytes where 5 would be
11:48 PM day_ is now known as day