/* Read a value from the printer port via DLPortIO.
   During init, all the outputs of the printer port are set high so they can be used to pull up
   signals from a relay.
*/

#include <windows.h>
#include <stdio.h>
#include <io.h>
#include "dlportio.h"
#include "HLPRXPrinterPort.h"
#include "NDTSErrorInternal.h"

unsigned long baseAddress;

NDTS_Boolean CALL_CONV HLPRX_InitialisePrinterPort(unsigned long baseAddressParam)
{
	baseAddress = baseAddressParam;
	// Set the data lines high to provide power.
	DlPortWritePortUchar(baseAddress, 0xff);
	return NDTS_BTrue;
}


HLPRX_API NDTS_Boolean CALL_CONV HLPRX_GetPrinterPortInput(unsigned int *value)
{
	*value = DlPortReadPortUchar(baseAddress + 1);
	return NDTS_BTrue;
}
