avr-rust / ruduino

Reusable components for the Arduino Uno.
Apache License 2.0
704 stars 50 forks source link

Always inline disabling interrupts #24

Closed shepmaster closed 4 years ago

shepmaster commented 4 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 4 years ago

Released in 0.2.4.

Restioson commented 4 years ago

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

shepmaster commented 4 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.