avr-rust / ruduino

Reusable components for the Arduino Uno.
Apache License 2.0
695 stars 49 forks source link

Always inline disabling interrupts #24

Closed shepmaster closed 3 years ago

shepmaster commented 3 years ago

It never makes sense to call a function for these two instructions.

Additionally, I use this at system boot time to configure the stack pointer itself. If this becomes a function call, then everything is broken!

dylanmckay commented 3 years ago

Released in 0.2.4.

Restioson commented 3 years ago

Relatedly, is there a reason for the PhantomData<()> in DisableInterrupts?

shepmaster commented 3 years ago

That’s probably an artifact of me being overzealous. The type needs to contain something to prevent it from being instantiated without calling the new function. That could probably be a simple empty tuple. The PhantomData is only used as a belt-and-suspenders technique to make sure that it doesn’t take up any size.