I am driving a P-MOSFET (IRLML6402) with ATtiny24A microcontroller. This is a battery powered system; that's why ATtiny is always on sleep. I originally configured a BJT which is driven by the microcontroller to pull P-MOSFET gate low when necessary, this requires pin to be driven high only when I want to turn on the system under P-MOSFET. But now I think of connecting ATtiny directly to P-MOSFET to keep the pin HIGH until I want the system to be on. System is 99.99% off that's why in this case, pin will always be high. Would keeping the pin always high cause power waste?
Also before putting the system to sleep, I must pull all pins to either low or high to reduce current consumption, which one should I do? It is easy to pull pins high by configuring them as
input_pullup but I can also define them as outputs and set them "LOW" afterwards. I will reconfigure pins after waking up.
The question is asked for unused pins, used pins can't be configured as HIGH.
I have no pins floating already, details explained in comment. This is my code, no pins will be floating after configuring the pins as this once at startup:
DDRA |= (1<<LEDButtonPin) || (1<<AlarmPin) || (1<<FlashorPin) || (1<<PotEnablePin) || (1<<BuzzerPin); //Set "A" output pins PORTA &= ~((1<<LEDButtonPin) || (1<<AlarmPin) || (1<<FlashorPin) || (1<<PotEnablePin) || (1<<BuzzerPin)); // Set the outputs LOW DDRA &= ~((1 << ButtonPin) || (1<<pot_DEL_pin) || (1<<pot_DUR_pin)); // Set "A" input pins DDRB &= ~((1 << PIRPin) || (1 << PB0) || (1 << PB1) || (1 << PB3)); // Set "B" input pins PORTB |= (1 << PB0) || (1 << PB1) || (1 << PB3); // Set internal pullups for "B" pins