#include "common.h"
#include "bus/mosfet.h"

// XXX: This might be too much specificity for something where
// a generic digital output implementation would be adequate.

int MOS_Init(void)
{
	// PB0: MOSFET #1 Peltier
	DDRB |= BIT(PB0);    // Output
	PORTB &= ~BIT(PB0);  // Low

	// PB1: MOSFET #2 Heating
	DDRB |= BIT(PB1);    // Output
	PORTB &= ~BIT(PB1);  // Low

	// PB2: MOSFET #3 Lights
	DDRB |= BIT(PB2);    // Output
	PORTB &= ~BIT(PB2);  // Low

	return 0;
}

void MOS_Enable(int port)
{
	if (port != MOS01 && port != MOS02 && port != MOS03)
		return; // Invalid port

	PORTB |= BIT(port);
}

void MOS_Disable(int port)
{
	if (port != MOS01 && port != MOS02 && port != MOS03)
		return; // Invalid port

	PORTB &= ~BIT(port);
}
