//************************************************************************************
//**  
//**  Source name:   C:\Flowcode10\Projekter\NewSun.fcfx
//**  Title:         
//**  Description:   
//**  Device:        ESP.ESP32.ESP32_DEVKITV1
//**  
//**  Generated by:  Flowcode v10.0.1.18
//**  Date:          Sunday, March 12, 2023 13:02:42
//**  Users:         1
//**  Registered to: jgu1 (43418841)
//**  Licence key: UBG57W
//**  
//**  
//**  https://www.flowcode.co.uk
//**  
//************************************************************************************


#include "C:\Flowcode10\Projekter\NewSun.h"


/*========================================================================*\
   Use :TypeConversionsFree1
       :GUID: 
       :Location: 
       :Version:  (0x0)
       :Timestamp: 
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Sets a single 16-bit INT value.
       :Index is in little endian, 0 is the LSW and 1 is the MSW
       :
       :Parameters for macro SetInt:
       :  Index : Range: 0-1
       :  Value : Range: 0-65535
\*=----------------------------------------------------------------------=*/
void FCD_02571_TypeConversionsFree1__SetInt(MX_UINT8 FCL_INDEX, MX_UINT16 FCL_VALUE)
{


	if (FCL_INDEX < 2)
	{

		MX_Conv_Var.AsInt[FCL_INDEX] = FCL_VALUE;

	// } else {

	}

}

/*=----------------------------------------------------------------------=*\
   Use :Sets a single 32-bit LONG value
       :
       :Parameters for macro SetLong:
       :  Value : Range: 0-4294967295
\*=----------------------------------------------------------------------=*/
void FCD_02571_TypeConversionsFree1__SetLong(MX_UINT32 FCL_VALUE)
{


	MX_Conv_Var.AsLong = FCL_VALUE;

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single 32-bit FLOAT value
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_02571_TypeConversionsFree1__GetFloat()
{
	//Local variable definitions
	MX_FLOAT FCR_RETVAL;



	FCR_RETVAL = MX_Conv_Var.AsFloat;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single 32-bit LONG value
       :
       :Returns : MX_UINT32
\*=----------------------------------------------------------------------=*/
MX_UINT32 FCD_02571_TypeConversionsFree1__GetLong()
{
	//Local variable definitions
	MX_UINT32 FCR_RETVAL;



	FCR_RETVAL = MX_Conv_Var.AsLong;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single 16-bit INT value
       :Index is in little endian, 0 is the LSW and 1 is the MSW
       :
       :Parameters for macro GetInt:
       :  Index : Range: 0-1
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_02571_TypeConversionsFree1__GetInt(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	if (FCL_INDEX < 2)
	{

		FCR_RETVAL = MX_Conv_Var.AsInt[FCL_INDEX];

	} else {

		// .Return = 0
		FCR_RETVAL = 0;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Sets a single 8-bit BYTE value
       :Index is in little endian, 0 is the LSB and 3 is the MSB
       :
       :Parameters for macro SetByte:
       :  Index : Range: 0-3
       :  Value : Range: 0-255
\*=----------------------------------------------------------------------=*/
void FCD_02571_TypeConversionsFree1__SetByte(MX_UINT8 FCL_INDEX, MX_UINT8 FCL_VALUE)
{


	if (FCL_INDEX < 4)
	{

		MX_Conv_Var.AsByte[FCL_INDEX] = FCL_VALUE;

	// } else {

	}

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single 8-bit BYTE value.
       :Index is in little endian, 0 is the LSB and 3 is the MSB
       :
       :Parameters for macro GetByte:
       :  Index : Range: 0-3
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_02571_TypeConversionsFree1__GetByte(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	if (FCL_INDEX < 4)
	{

		FCR_RETVAL = MX_Conv_Var.AsByte[FCL_INDEX];

	} else {

		// .Return = 0
		FCR_RETVAL = 0;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Sets a single 32-bit FLOAT value
       :
       :Parameters for macro SetFloat:
       :  Value : Range: 0-4294967295
\*=----------------------------------------------------------------------=*/
void FCD_02571_TypeConversionsFree1__SetFloat(MX_FLOAT FCL_VALUE)
{


	MX_Conv_Var.AsFloat = FCL_VALUE;

}


/*========================================================================*\
   Use :eeprom1
       :GUID: dcbf571f-a6fa-402d-bdd4-be00cca4070f
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\eeprom.fcpx
       :Version: 4.0 (0x100228)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Writes a 32-bit float value starting at the specified address.
       :A 32-bit float will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device.
       :
       :Parameters for macro WriteFloat:
       :  StartAddress : Initial EE location to start reading
       :  Value : Floating point value to write
       :  MSBFirst : 0=LSB First, 1=MSB First
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__WriteFloat(MX_UINT16 FCL_STARTADDRESS, MX_FLOAT FCL_VALUE, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;



	FCD_02571_TypeConversionsFree1__SetFloat(FCL_VALUE);

	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		for (FCL_IDX=0; (FCL_IDX)<(2); (FCL_IDX)++)
		{

			if (FCL_MSBFIRST)
			{

				FCL_VAL = FCD_02571_TypeConversionsFree1__GetInt(1 - FCL_IDX);

			} else {

				FCL_VAL = FCD_02571_TypeConversionsFree1__GetInt(FCL_IDX);

			}

			FCD_06651_eeprom1__Write(FCL_STARTADDRESS + FCL_IDX, FCL_VAL);


		}

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a 16-bit int value starting from the specified address.
       :A 16-bit int will consume 2 bytes which will be 2 locations on an 8-bit device or 1 location on a 16-bit device.
       :
       :Parameters for macro ReadInt:
       :  StartAddress : Initial EE location to start reading
       :  MSBFirst : 0=LSB First, 1=MSB First
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_06651_eeprom1__ReadInt(MX_UINT16 FCL_STARTADDRESS, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;
	MX_UINT16 FCR_RETVAL;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		FCR_RETVAL = FCD_06651_eeprom1__Read(FCL_STARTADDRESS);

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a 32-bit float value starting from the specified address.
       :A 32-bit float will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device.
       :
       :Parameters for macro ReadFloat:
       :  StartAddress : Initial EE location to start reading
       :  MSBFirst : 0=LSB First, 1=MSB First
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_06651_eeprom1__ReadFloat(MX_UINT16 FCL_STARTADDRESS, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;
	MX_FLOAT FCR_RETVAL;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		for (FCL_IDX=0; (FCL_IDX)<(2); (FCL_IDX)++)
		{

			FCL_VAL = FCD_06651_eeprom1__Read(FCL_STARTADDRESS + FCL_IDX);

			if (FCL_MSBFIRST)
			{

				FCD_02571_TypeConversionsFree1__SetInt(1 - FCL_IDX, FCL_VAL);

			} else {

				FCD_02571_TypeConversionsFree1__SetInt(FCL_IDX, FCL_VAL);

			}


		}

	#endif

	FCR_RETVAL = FCD_02571_TypeConversionsFree1__GetFloat();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a 8-bit byte value to the specified address.
       :A 8-bit byte will consume 1 bytes which will be 1 locations on an 8-bit device or half a location on a 16-bit device.
       :
       :Parameters for macro WriteByte:
       :  ByteAddress : Byte address, EEADDR on 8-bit device or EEADDR/2 on a 16-bit device
       :  Value : Floating point value to write
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__WriteByte(MX_UINT16 FCL_BYTEADDRESS, MX_UINT8 FCL_VALUE)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		FCL_VAL = FCD_06651_eeprom1__Read((FCL_BYTEADDRESS >> 1));

		if (FCL_BYTEADDRESS & 1)
		{

			// .Val = .Val & 0x00FF
			// .Val = .Val | (.Value << 8)
			FCL_VAL = FCL_VAL & 0x00FF;
			FCL_VAL = FCL_VAL | (FCL_VALUE << 8);

		} else {

			// .Val = .Val & 0xFF00
			// .Val = .Val | .Value
			FCL_VAL = FCL_VAL & 0xFF00;
			FCL_VAL = FCL_VAL | FCL_VALUE;

		}

		FCD_06651_eeprom1__Write((FCL_BYTEADDRESS >> 1), FCL_VAL);

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a 16-bit int value starting at the specified address.
       :A 16-bit int will consume 2 bytes which will be 2 locations on an 8-bit device or 1 location on a 16-bit device.
       :
       :Parameters for macro WriteInt:
       :  StartAddress : Initial EE location to start reading
       :  Value : Floating point value to write
       :  MSBFirst : 0=LSB First, 1=MSB First
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__WriteInt(MX_UINT16 FCL_STARTADDRESS, MX_UINT16 FCL_VALUE, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		FCD_06651_eeprom1__Write(FCL_STARTADDRESS, FCL_VALUE);

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a string of data from the EE memory starting at the specified address.
       :8-bit EE memory stores a character into each memory location.
       :16-bit EE memory stores two characters into each memory location.
       :
       :Parameters for macro ReadString:
       :  StartAddress : EE Address of the first character in the string
       :  MaxChars : The maximum number of characters to try and read plus null termination
       :
       :Returns : MX_CHAR*
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__ReadString(MX_CHAR *FCR_RETVAL, MX_UINT16 FCRsz_RETVAL, MX_UINT16 FCL_STARTADDRESS, MX_UINT8 FCL_MAXCHARS)
{
	//Local variable definitions
	MX_UINT8 FCL_IDX = (0x0);
	MX_UINT16 FCL_VAL;



	// .val = 0
	FCL_VAL = 0;

	while (FCL_IDX < (FCL_MAXCHARS - 1))
	{

		#if (0) // 16 == 8

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_IDX & 1)
			{

				// .val = .val >> 8
				FCL_VAL = FCL_VAL >> 8;

			} else {

				FCL_VAL = FCD_06651_eeprom1__Read(FCL_STARTADDRESS + (FCL_IDX >> 1));

			}

		#endif

		// .Return[.idx] = .val & 0xFF
		FCR_RETVAL[FCL_IDX] = FCL_VAL & 0xFF;

		if (FCR_RETVAL[FCL_IDX] == 0)
		{

			goto FCC_ReadString_A;

		// } else {

		}

		// .idx = .idx + 1
		FCL_IDX = FCL_IDX + 1;


	}

	// .Return[.idx] = 0
	FCR_RETVAL[FCL_IDX] = 0;

FCC_ReadString_A:
	;

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a packet of bits from the EEPROM
       :The number of bits read is 8 or 16, depending on the platform
       :
       :Parameters for macro Read:
       :  Address : The address, in elements, to read the data from
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_06651_eeprom1__Read(MX_UINT16 FCL_ADDRESS)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		FCR_RETVAL = FC_CAL_EE_Read(FCL_ADDRESS);

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a 32-bit long value starting from the specified address.
       :A 32-bit long will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device.
       :
       :Parameters for macro ReadLong:
       :  StartAddress : Initial EE location to start reading
       :  MSBFirst : 0=LSB First, 1=MSB First
       :
       :Returns : MX_UINT32
\*=----------------------------------------------------------------------=*/
MX_UINT32 FCD_06651_eeprom1__ReadLong(MX_UINT16 FCL_STARTADDRESS, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;
	MX_UINT32 FCR_RETVAL;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		for (FCL_IDX=0; (FCL_IDX)<(2); (FCL_IDX)++)
		{

			FCL_VAL = FCD_06651_eeprom1__Read(FCL_STARTADDRESS + FCL_IDX);

			if (FCL_MSBFIRST)
			{

				FCD_02571_TypeConversionsFree1__SetInt(1 - FCL_IDX, FCL_VAL);

			} else {

				FCD_02571_TypeConversionsFree1__SetInt(FCL_IDX, FCL_VAL);

			}


		}

	#endif

	FCR_RETVAL = FCD_02571_TypeConversionsFree1__GetLong();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a string of data to the EE memory starting at the specified address.
       :8-bit EE memory stores a character into each memory location.
       :16-bit EE memory stores two characters into each memory location.
       :
       :Parameters for macro WriteString:
       :  StartAddress : EE Address of the first character in the string
       :  MaxChars : The maximum number of characters to try and read plus null termination
       :  DataString[20] : MX_CHAR (by-ref)
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__WriteString(MX_UINT16 FCL_STARTADDRESS, MX_UINT8 FCL_MAXCHARS, MX_CHAR *FCL_DATASTRING, MX_UINT16 FCLsz_DATASTRING)
{
	//Local variable definitions
	MX_UINT8 FCL_IDX = (0x0);
	MX_UINT16 FCL_VAL;



	// .val = 0
	FCL_VAL = 0;

	while (FCL_IDX < (FCL_MAXCHARS - 1))
	{

		#if (0) // 16 == 8

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_IDX & 1)
			{

				// .Val = .Val + (.DataString[.idx] << 8)
				FCL_VAL = FCL_VAL + (FCL_DATASTRING[FCL_IDX] << 8);

				FCD_06651_eeprom1__Write(FCL_STARTADDRESS + (FCL_IDX >> 1), FCL_VAL);

			} else {

				// .Val = .DataString[.idx]
				FCL_VAL = FCL_DATASTRING[FCL_IDX];

			}

		#endif

		if (FCL_DATASTRING[FCL_IDX] == 0)
		{

			#if (1) // 16 == 16

				if (FCL_IDX == 0)
				{

					FCD_06651_eeprom1__Write(FCL_STARTADDRESS + (FCL_IDX >> 1), FCL_VAL);

				// } else {

				}

			// #else

			//Code has been optimised out by the pre-processor
			#endif

			goto FCC_WriteString_A;

		// } else {

		}

		// .Idx = .Idx + 1
		FCL_IDX = FCL_IDX + 1;


	}

	#if (1) // 16 == 16

		if (FCL_IDX == 0)
		{

			FCD_06651_eeprom1__Write(FCL_STARTADDRESS + (FCL_IDX >> 1), 0);

		} else {

			FCD_06651_eeprom1__Write(FCL_STARTADDRESS + (FCL_IDX >> 1), FCL_VAL);

		}

	#else

	//Code has been optimised out by the pre-processor
	#endif

FCC_WriteString_A:
	;

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a packet of bits from the EEPROM
       :The number of bits written is 8 or 16, depending on the platform
       :
       :Parameters for macro Sim_Write:
       :  Address : The address, in elements, to read the data from
       :  Value : The 8 or 16 bit value to store in EEPROM
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__Sim_Write(MX_UINT16 FCL_ADDRESS, MX_UINT16 FCL_VALUE)
{


	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a packet of bits from the EEPROM
       :The number of bits written is 8 or 16, depending on the platform
       :
       :Parameters for macro Write:
       :  Address : The address, in elements, to write the data to
       :  Value : The 8 or 16 bit value to store in EEPROM
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__Write(MX_UINT16 FCL_ADDRESS, MX_UINT16 FCL_VALUE)
{


	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		FC_CAL_EE_Write(FCL_ADDRESS, FCL_VALUE);

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a 8-bit byte value starting from the specified address.
       :A 8-bit byte will consume 1 byte which will be 1 locations on an 8-bit device or half a location on a 16-bit device.
       :
       :Parameters for macro ReadByte:
       :  ByteAddress : Byte address, EEADDR on 8-bit device or EEADDR/2 on a 16-bit device
       :  MSBFirst : 0=LSB First, 1=MSB First
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_06651_eeprom1__ReadByte(MX_UINT16 FCL_BYTEADDRESS, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		FCL_VAL = FCD_06651_eeprom1__Read((FCL_BYTEADDRESS >> 1));

		if (FCL_BYTEADDRESS & 1)
		{

			// .Return = .Val >> 8
			FCR_RETVAL = FCL_VAL >> 8;

		} else {

			// .Return = .Val & 0xFF
			FCR_RETVAL = FCL_VAL & 0xFF;

		}

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a packet of bits from the EEPROM
       :The number of bits read is 8 or 16, depending on the platform
       :
       :Parameters for macro Sim_Read:
       :  Address : The address, in elements, to read the data from
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_06651_eeprom1__Sim_Read(MX_UINT16 FCL_ADDRESS)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		// .Return = 0xFFFF
		FCR_RETVAL = 0xFFFF;

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a 32-bit long value starting at the specified address.
       :A 32-bit long will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device.
       :
       :Parameters for macro WriteLong:
       :  StartAddress : Initial EE location to start reading
       :  Value : Floating point value to write
       :  MSBFirst : 0=LSB First, 1=MSB First
\*=----------------------------------------------------------------------=*/
void FCD_06651_eeprom1__WriteLong(MX_UINT16 FCL_STARTADDRESS, MX_UINT32 FCL_VALUE, MX_BOOL FCL_MSBFIRST)
{
	//Local variable definitions
	MX_UINT16 FCL_VAL;
	MX_UINT8 FCL_IDX;



	FCD_02571_TypeConversionsFree1__SetLong(FCL_VALUE);

	#if (0) // 16 == 8

	//Code has been optimised out by the pre-processor
	#else

		for (FCL_IDX=0; (FCL_IDX)<(2); (FCL_IDX)++)
		{

			if (FCL_MSBFIRST)
			{

				FCL_VAL = FCD_02571_TypeConversionsFree1__GetInt(1 - FCL_IDX);

			} else {

				FCL_VAL = FCD_02571_TypeConversionsFree1__GetInt(FCL_IDX);

			}

			FCD_06651_eeprom1__Write(FCL_STARTADDRESS + FCL_IDX, FCL_VAL);


		}

	#endif

}


/*========================================================================*\
   Use :cal_i2c1
       :GUID: ed3a5141-43bb-43e0-86b0-2243fd1147ca
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\cal_i2c.fcpx
       :Version: 6.0 (0x200028)
       :Timestamp: 23\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Send text to the console
       :
       :Parameters for macro Prv_TextConsole:
       :  str[20] : MX_CHAR (by-ref)
       :  Colour : MX_UINT8
       :  AppendTimestamp : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_07da1_cal_i2c1__Prv_TextConsole(MX_CHAR *FCL_STR, MX_UINT16 FCLsz_STR, MX_UINT8 FCL_COLOUR, MX_UINT8 FCL_APPENDTIMESTAMP)
{
	//Local variable definitions
#define FCLsz_TSTR 20
	MX_CHAR FCL_TSTR[FCLsz_TSTR];



	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_TSTR
}


/*========================================================================*\
   Use :AmbientLight1
       :GUID: e08872a7-6962-4b61-bcca-71389f8ed8d7
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\AmbientLight.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Powers up and starts the continous measurement mode.
       :Delays in between measurements readings must be provided by the user,
       :
       :Parameters for macro ContinuousMeasurement:
       :  Resolution : 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__ContinuousMeasurement(MX_UINT8 FCL_RESOLUTION)
{


	FCD_0f391_AmbientLight1__PowerUp();

	switch (FCL_RESOLUTION)
	{
		case 0:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x10);

			break;
		}
		case 1:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x11);

			break;
		}
		case 2:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x13);

			break;
		}
		// default:

	}

}

/*=----------------------------------------------------------------------=*\
   Use :Power Up the Device Ready for Measurement Command
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__PowerUp()
{


	FCD_0f391_AmbientLight1__WriteCommand(0x01);

}

/*=----------------------------------------------------------------------=*\
   Use :Powers up and starts a single measurement before returning to power down mode.
       :Waits for the measurement to be ready and returns the value.
       :
       :Parameters for macro OneTimeMeasurement:
       :  Resolution : 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_0f391_AmbientLight1__OneTimeMeasurement(MX_UINT8 FCL_RESOLUTION)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	FCD_0f391_AmbientLight1__PowerUp();

	switch (FCL_RESOLUTION)
	{
		case 0:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x20);

			FCI_DELAYBYTE_MS(120);

			break;
		}
		case 1:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x21);

			FCI_DELAYBYTE_MS(120);

			break;
		}
		case 2:
		{
			FCD_0f391_AmbientLight1__WriteCommand(0x23);

			FCI_DELAYBYTE_MS(16);

			break;
		}
		// default:

	}

	FCR_RETVAL = FCD_0f391_AmbientLight1__ReadMeasurement();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Power Down the Device
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__PowerDown()
{


	FCD_0f391_AmbientLight1__WriteCommand(0x00);

}

/*=----------------------------------------------------------------------=*\
   Use :Adjusts the measurement result to counteract influence of the optical window.
       :
       :Parameters for macro ChangeMeasurementTime:
       :  Sensitvity : Range: 31-254 / Default: 69
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__ChangeMeasurementTime(MX_UINT8 FCL_SENSITVITY)
{


	if (FCL_SENSITVITY < 31)
	{

		// .Sensitvity = 31
		FCL_SENSITVITY = 31;

	// } else {

	}

	if (FCL_SENSITVITY > 254)
	{

		// .Sensitvity = 254
		FCL_SENSITVITY = 254;

	// } else {

	}

	FCD_0f391_AmbientLight1__WriteCommand(0x40 | (FCL_SENSITVITY >> 5));

	FCD_0f391_AmbientLight1__WriteCommand(0x60 | (FCL_SENSITVITY & 0x1F));

}

/*=----------------------------------------------------------------------=*\
   Use :Writes a command to the Light Sensor
       :
       :Parameters for macro WriteCommand:
       :  OpCode : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__WriteCommand(MX_UINT8 FCL_OPCODE)
{
	//Local variable definitions
#define FCLsz_DATA 1
	MX_UINT8 FCL_DATA[FCLsz_DATA];



	// .Data[0] = .OpCode
	FCL_DATA[0] = FCL_OPCODE;

	FC_CAL_I2C_Transaction_Write_1(FCL_DATA, 1, 1);

	//Local variable definitions
#undef FCLsz_DATA
}

/*=----------------------------------------------------------------------=*\
   Use :Reads data from the Light Sensor as a 16-bit value.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_0f391_AmbientLight1__ReadMeasurement()
{
	//Local variable definitions
#define FCLsz_DATA 2
	MX_UINT8 FCL_DATA[FCLsz_DATA];
	MX_UINT16 FCR_RETVAL;



	// .Data[0] = 0
	// .Data[1] = 0
	FCL_DATA[0] = 0;
	FCL_DATA[1] = 0;

	FC_CAL_I2C_Transaction_Read_1(FCL_DATA, 2, 2);

	// .Return = (.Data[0] << 8) | .Data[1]
	FCR_RETVAL = (FCL_DATA[0] << 8) | FCL_DATA[1];

	return (FCR_RETVAL);

	//Local variable definitions
#undef FCLsz_DATA
}

/*=----------------------------------------------------------------------=*\
   Use :Resets the device measurement register,
       :Must be in the powered up state to do this.
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__ResetMeasurement()
{


	FCD_0f391_AmbientLight1__WriteCommand(0x07);

}

/*=----------------------------------------------------------------------=*\
   Use :Stes up the I2C bus and initialises the termperature sensor ready for use.
\*=----------------------------------------------------------------------=*/
void FCD_0f391_AmbientLight1__Initialise()
{
	//Local variable definitions
	MX_UINT8 FCL_TEMP;
	MX_UINT16 FCL_PROM;



	// DVIPin = 0
	SET_PORT_PIN(B, 0, 0);

	FC_CAL_I2C_Master_Init_1();

	FC_CAL_I2C_Transaction_Init_1(35);

	FCI_DELAYBYTE_MS(1);

	// DVIPin = 1
	SET_PORT_PIN(B, 0, 1);

	FCI_DELAYBYTE_MS(1);

}


/*========================================================================*\
   Use :adc_base
       :GUID: 7aad74d6-b24e-4dab-91eb-5d72a973f12d
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\adc_base.fcpx
       :Version: 6.0 (0x100328)
       :Timestamp: 06\03\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Background call to read the ADC as a byte average sample over time
       :Call Enable() before this
       :
       :Parameters for macro RawAverageByte:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f42_adc_base__RawAverageByte(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT16 FCL_AVERAGE = (0x0);
	MX_UINT8 FCL_COUNT = (0x0);
	MX_UINT8 FCR_RETVAL;



	if (FCL_DELAYUS > 0)
	{

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_2(35, 3, 0, FCL_DELAYUS);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Byte)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_2(0);
			FCL_COUNT = FCL_COUNT + 1;


		}

	} else {

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_2(35, 3, 0, 40);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Byte)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_2(0);
			FCL_COUNT = FCL_COUNT + 1;


		}

	}

	// .Return = .average / .count
	FCR_RETVAL = FCL_AVERAGE / FCL_COUNT;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the ADC as a direct voltage and returns as a string
       :
       :Returns : MX_CHAR*
\*=----------------------------------------------------------------------=*/
void FCD_08f42_adc_base__GetString(MX_CHAR *FCR_RETVAL, MX_UINT16 FCRsz_RETVAL)
{
	//Local variable definitions
	MX_FLOAT FCL_SAMPLE;



	FCL_SAMPLE = FCD_08f42_adc_base__GetVoltage();

	// .Return = FloatToString$ (.sample)
	FCI_FLOAT_TO_STRING(FCL_SAMPLE, FCV_PRECISION, FCR_RETVAL, FCRsz_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Function call to read the ADC as a byte average sample over time
       :
       :Parameters for macro GetAverageByte:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f42_adc_base__GetAverageByte(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	FCR_RETVAL = FCD_08f42_adc_base__RawAverageByte(FCL_NUMSAMPLES, FCL_DELAYUS);

	FC_ADC_Disable_2();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Background call to read the ADC as a full width average sample over time
       :Call Enable() before this
       :
       :Parameters for macro RawAverageInt:
       :  NumSamples : MX_UINT8
       :  DelayUs : MX_UINT8
       :
       :Returns : MX_SINT16
\*=----------------------------------------------------------------------=*/
MX_SINT16 FCD_08f42_adc_base__RawAverageInt(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT32 FCL_AVERAGE = (0x0);
	MX_UINT8 FCL_COUNT = (0x0);
	MX_SINT16 FCR_RETVAL;



	if (FCL_DELAYUS > 0)
	{

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_2(35, 3, 0, FCL_DELAYUS);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Full)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_2(1);
			FCL_COUNT = FCL_COUNT + 1;


		}

	} else {

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_2(35, 3, 0, 40);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Full)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_2(1);
			FCL_COUNT = FCL_COUNT + 1;


		}

	}

	// .Return = .average / .count
	FCR_RETVAL = FCL_AVERAGE / FCL_COUNT;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Function call to read the ADC as a full width average sample over time
       :
       :Parameters for macro GetAverageInt:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_08f42_adc_base__GetAverageInt(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	FCR_RETVAL = FCD_08f42_adc_base__RawAverageInt(FCL_NUMSAMPLES, FCL_DELAYUS);

	FC_ADC_Disable_2();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the ADC as a direct voltage
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_08f42_adc_base__GetVoltage()
{
	//Local variable definitions
	MX_UINT16 FCL_SAMPLE;
	MX_FLOAT FCR_RETVAL;



	FC_ADC_Enable_2(35, 3, 0, 40);

	FCL_SAMPLE = FC_ADC_Sample_2(1);

	// .Return = .sample * bitmul
	FCR_RETVAL = flt_mul(flt_fromi(FCL_SAMPLE), 0.001221);

	FC_ADC_Disable_2();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Blocking call to read the ADC at full bit depth
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_08f42_adc_base__GetInt()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	FC_ADC_Enable_2(35, 3, 0, 40);

	FCR_RETVAL = FC_ADC_Sample_2(1);

	FC_ADC_Disable_2();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Blocking call to read the ADC as a byte
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f42_adc_base__GetByte()
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	FC_ADC_Enable_2(35, 3, 0, 40);

	FCR_RETVAL = FC_ADC_Sample_2(0);

	FC_ADC_Disable_2();

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :IsSim1
       :GUID: 5f7b77e5-e979-4010-93f1-e6d98f83bd71
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\IsSim.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Returns 0 if running on an embedded target or 1 if running in simulation runtime.
       :
       :Returns : MX_BOOL
\*=----------------------------------------------------------------------=*/
MX_BOOL FCD_0b4c1_IsSim1__Check()
{
	//Local variable definitions
	MX_BOOL FCR_RETVAL;



	// .Return = Sim
	FCR_RETVAL = 0;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :adc_base1
       :GUID: 7aad74d6-b24e-4dab-91eb-5d72a973f12d
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\adc_base.fcpx
       :Version: 6.0 (0x100328)
       :Timestamp: 06\03\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Background call to read the ADC as a byte average sample over time
       :Call Enable() before this
       :
       :Parameters for macro RawAverageByte:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f41_adc_base1__RawAverageByte(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT16 FCL_AVERAGE = (0x0);
	MX_UINT8 FCL_COUNT = (0x0);
	MX_UINT8 FCR_RETVAL;



	if (FCL_DELAYUS > 0)
	{

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_1(37, 0, 0, FCL_DELAYUS);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Byte)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_1(0);
			FCL_COUNT = FCL_COUNT + 1;


		}

	} else {

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_1(37, 0, 0, 200);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Byte)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_1(0);
			FCL_COUNT = FCL_COUNT + 1;


		}

	}

	// .Return = .average / .count
	FCR_RETVAL = FCL_AVERAGE / FCL_COUNT;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the ADC as a direct voltage and returns as a string
       :
       :Returns : MX_CHAR*
\*=----------------------------------------------------------------------=*/
void FCD_08f41_adc_base1__GetString(MX_CHAR *FCR_RETVAL, MX_UINT16 FCRsz_RETVAL)
{
	//Local variable definitions
	MX_FLOAT FCL_SAMPLE;



	FCL_SAMPLE = FCD_08f41_adc_base1__GetVoltage();

	// .Return = FloatToString$ (.sample)
	FCI_FLOAT_TO_STRING(FCL_SAMPLE, FCV_PRECISION, FCR_RETVAL, FCRsz_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Function call to read the ADC as a byte average sample over time
       :
       :Parameters for macro GetAverageByte:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f41_adc_base1__GetAverageByte(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	FCR_RETVAL = FCD_08f41_adc_base1__RawAverageByte(FCL_NUMSAMPLES, FCL_DELAYUS);

	FC_ADC_Disable_1();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Background call to read the ADC as a full width average sample over time
       :Call Enable() before this
       :
       :Parameters for macro RawAverageInt:
       :  NumSamples : MX_UINT8
       :  DelayUs : MX_UINT8
       :
       :Returns : MX_SINT16
\*=----------------------------------------------------------------------=*/
MX_SINT16 FCD_08f41_adc_base1__RawAverageInt(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT32 FCL_AVERAGE = (0x0);
	MX_UINT8 FCL_COUNT = (0x0);
	MX_SINT16 FCR_RETVAL;



	if (FCL_DELAYUS > 0)
	{

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_1(37, 0, 0, FCL_DELAYUS);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Full)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_1(1);
			FCL_COUNT = FCL_COUNT + 1;


		}

	} else {

		while (FCL_COUNT < FCL_NUMSAMPLES)
		{

			FC_ADC_Enable_1(37, 0, 0, 200);

			// .average = .average + cal_adc :: Sample (cal_adc :: Sample_Full)
			// .count = .count + 1
			FCL_AVERAGE = FCL_AVERAGE + FC_ADC_Sample_1(1);
			FCL_COUNT = FCL_COUNT + 1;


		}

	}

	// .Return = .average / .count
	FCR_RETVAL = FCL_AVERAGE / FCL_COUNT;

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Function call to read the ADC as a full width average sample over time
       :
       :Parameters for macro GetAverageInt:
       :  NumSamples : MX_UINT8
       :  DelayUs : Number of micro seconds in between taking each sample
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_08f41_adc_base1__GetAverageInt(MX_UINT8 FCL_NUMSAMPLES, MX_UINT8 FCL_DELAYUS)
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	FCR_RETVAL = FCD_08f41_adc_base1__RawAverageInt(FCL_NUMSAMPLES, FCL_DELAYUS);

	FC_ADC_Disable_1();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the ADC as a direct voltage
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_08f41_adc_base1__GetVoltage()
{
	//Local variable definitions
	MX_UINT16 FCL_SAMPLE;
	MX_FLOAT FCR_RETVAL;



	FC_ADC_Enable_1(37, 0, 0, 200);

	FCL_SAMPLE = FC_ADC_Sample_1(1);

	// .Return = .sample * bitmul
	FCR_RETVAL = flt_mul(flt_fromi(FCL_SAMPLE), 0.001343);

	FC_ADC_Disable_1();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Blocking call to read the ADC at full bit depth
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_08f41_adc_base1__GetInt()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	FC_ADC_Enable_1(37, 0, 0, 200);

	FCR_RETVAL = FC_ADC_Sample_1(1);

	FC_ADC_Disable_1();

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Blocking call to read the ADC as a byte
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_08f41_adc_base1__GetByte()
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	FC_ADC_Enable_1(37, 0, 0, 200);

	FCR_RETVAL = FC_ADC_Sample_1(0);

	FC_ADC_Disable_1();

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ACS7xx_Current_Sensor1
       :GUID: aa85a268-ba47-4a33-bdad-04f51b716cdf
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\ACS712_Current_Sensor.fcpx
       :Version: 6.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_0f961_ACS7xx_Current_Sensor1__CalculateAverageVoltage()
{
	//Local variable definitions
	MX_FLOAT FCL_VOLTAGE = (0.0);
	MX_FLOAT FCL_AVERAGEVOLTAGE = (0.0);
	MX_FLOAT FCR_RETVAL;



	for (FCLV_LOOP9=0; (FCLV_LOOP9)<(60); (FCLV_LOOP9)++)
	{

		FCL_VOLTAGE = FCD_08f41_adc_base1__GetVoltage();

		// .Voltage = fround (.Voltage,2)
		// .AverageVoltage = .AverageVoltage + .Voltage
		FCL_VOLTAGE = fround(FCL_VOLTAGE, 2);
		FCL_AVERAGEVOLTAGE = flt_add(FCL_AVERAGEVOLTAGE, FCL_VOLTAGE);


	}

	// .Return = .AverageVoltage / 60.0
	FCR_RETVAL = flt_div(FCL_AVERAGEVOLTAGE, 60.0);

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Current reading in amps
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_0f961_ACS7xx_Current_Sensor1__Current()
{
	//Local variable definitions
	MX_FLOAT FCL_CURRENT = (0.0);
	MX_FLOAT FCR_RETVAL;



	FCV_0f961_ACS7xx_Current_Sensor1__ISSIM = FCD_0b4c1_IsSim1__Check();

	if (FCV_0f961_ACS7xx_Current_Sensor1__ISSIM)
	{

		// .Current=SensorLibraryComponent1::GetValue(0)

		// .Current = ((.Current * (Sensitivity / 10000.0)) + OffsetVoltage)
		FCL_CURRENT = (flt_add((flt_mul(FCL_CURRENT, (flt_div(990, 10000.0)))), 0.908500));

	} else {

		FCL_CURRENT = FCD_0f961_ACS7xx_Current_Sensor1__CalculateAverageVoltage();

		// .Current = .Current - (5.0 / VDD * OffsetVoltage - OffsetVoltage)
		FCL_CURRENT = flt_sub(FCL_CURRENT, (flt_sub(flt_mul(flt_div(5.0, 5.500000), 0.908500), 0.908500)));

	}

	// .Return = (.Current - OffsetVoltage) / ((FLOAT Sensitivity) / 10000.0) + OffsetCurrentAdjust
	FCR_RETVAL = flt_add(flt_div((flt_sub(FCL_CURRENT, 0.908500)), (flt_div((990), 10000.0))), 0.000000);

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the Voltage of the ADC pin for diagnostic purposes.
       :With no current flowing through the sensor, the voltage reading should be 2.50V. If that is out, then enter precise VDD within properties
       :
       :Returns : MX_FLOAT
\*=----------------------------------------------------------------------=*/
MX_FLOAT FCD_0f961_ACS7xx_Current_Sensor1__VoltgeADC()
{
	//Local variable definitions
	MX_FLOAT FCL_VOLTAGE = (0.0);
	MX_FLOAT FCR_RETVAL;



	FCV_0f961_ACS7xx_Current_Sensor1__ISSIM = FCD_0b4c1_IsSim1__Check();

	if (FCV_0f961_ACS7xx_Current_Sensor1__ISSIM)
	{

		// .Voltage=SensorLibraryComponent1::GetValue(0)

		// .Voltage = (Sensitivity / 10000.0) * .Voltage + OffsetVoltage
		FCL_VOLTAGE = flt_add(flt_mul((flt_div(990, 10000.0)), FCL_VOLTAGE), 0.908500);

	} else {

		FCL_VOLTAGE = FCD_0f961_ACS7xx_Current_Sensor1__CalculateAverageVoltage();

	}

	// .Return = .Voltage
	FCR_RETVAL = FCL_VOLTAGE;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :cal_spi
       :GUID: c67171df-0ad6-4b11-8361-cfe14b072847
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\cal_spi.fcpx
       :Version: 7.0 (0x200128)
       :Timestamp: 08\03\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Outputs a low signal to the chip select pin to select the remote slave device.
\*=----------------------------------------------------------------------=*/
void FCD_01532_cal_spi__Master_Enable_CS()
{
	//Local variable definitions
#define FCLsz_STR 20
	MX_CHAR FCL_STR[FCLsz_STR];



	#if (1)

		#if (1) // 0 == 0

			#if (1)

				#if (0)

				//Code has been optimised out by the pre-processor
				// #else

				#endif

				// SS = CSPolarity
				SET_PORT_PIN(A, 4, 0);

			// #else

			//Code has been optimised out by the pre-processor
			#endif

		// #else

		//Code has been optimised out by the pre-processor
		#endif

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	//Local variable definitions
#undef FCLsz_STR
}

/*=----------------------------------------------------------------------=*\
   Use :Send text to the SPI console.
       :Exposed as part of the CAL_SPI component to allow none AutoCS pins and other.
       :
       :Parameters for macro Prv_TextConsole:
       :  str[20] : MX_CHAR (by-ref)
       :  Colour : 0=Default, 1=TX, 2=RX
       :  AppendTimestamp : 0=Don't Append / 1=Do Append
\*=----------------------------------------------------------------------=*/
void FCD_01532_cal_spi__Prv_TextConsole(MX_CHAR *FCL_STR, MX_UINT16 FCLsz_STR, MX_UINT8 FCL_COLOUR, MX_UINT8 FCL_APPENDTIMESTAMP)
{
	//Local variable definitions
#define FCLsz_TSTR 20
	MX_CHAR FCL_TSTR[FCLsz_TSTR];



	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_TSTR
}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro Prv_SimShowWaveform:
       :  RXData : MX_UINT8
       :  TXData : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01532_cal_spi__Prv_SimShowWaveform(MX_UINT8 FCL_RXDATA, MX_UINT16 FCL_TXDATA)
{


	#if (1)

		for (FCLV_LOOP8=0; (FCLV_LOOP8)<(8); (FCLV_LOOP8)++)
		{

			#if (0) // (2 & 0x02) == 0

			//Code has been optimised out by the pre-processor
			// #else

			#endif

			if (FCL_TXDATA & 0x80)
			{

				// MOSI = 1
				SET_PORT_PIN(A, 21, 1);

			} else {

				// MOSI = 0
				SET_PORT_PIN(A, 21, 0);

			}

			#if (1) // (2 & 0x04) == 0

				if (FCL_RXDATA & 0x80)
				{

					// MISO = 1
					SET_PORT_PIN(A, 5, 1);

				} else {

					// MISO = 0
					SET_PORT_PIN(A, 5, 0);

				}

			// #else

			//Code has been optimised out by the pre-processor
			#endif

			FCI_DELAYBYTE_US(0);

			#if (1) // (2 & 0x02) == 2

				#if (1) // (2 & 0x01) == 0

					// CLK = 1
					SET_PORT_PIN(A, 17, 1);

				#else

				//Code has been optimised out by the pre-processor
				#endif

			#else

			//Code has been optimised out by the pre-processor
			#endif

			#if (0) // (2 & 0x04) == 4

			//Code has been optimised out by the pre-processor
			// #else

			#endif

			FCI_DELAYBYTE_US(0);

			#if (1) // (2 & 0x02) == 2

				#if (1) // (2 & 0x01) == 0

					// CLK = 0
					SET_PORT_PIN(A, 17, 0);

				#else

				//Code has been optimised out by the pre-processor
				#endif

			// #else

			//Code has been optimised out by the pre-processor
			#endif

			// .TXData = .TXData << 1
			// .RXData = .RXData << 1
			FCL_TXDATA = FCL_TXDATA << 1;
			FCL_RXDATA = FCL_RXDATA << 1;


		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Outputs a high signal to the chip select pin to deselect the remote slave device.
\*=----------------------------------------------------------------------=*/
void FCD_01532_cal_spi__Master_Disable_CS()
{
	//Local variable definitions
#define FCLsz_STR 20
	MX_CHAR FCL_STR[FCLsz_STR];



	#if (1)

		#if (1) // 0 == 0

			#if (1)

				#if (0)

				//Code has been optimised out by the pre-processor
				// #else

				#endif

				// SS = 1 - CSPolarity
				SET_PORT_PIN(A, 4, 1 - 0);

			// #else

			//Code has been optimised out by the pre-processor
			#endif

		// #else

		//Code has been optimised out by the pre-processor
		#endif

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	//Local variable definitions
#undef FCLsz_STR
}


/*========================================================================*\
   Use :XPT2046
       :GUID: ab872cc0-e6fe-4d30-a7cb-a1efc6ae87a6
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\XPT2046.fcpx
       :Version: 7.0 (0x200028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Samples the touch sensor IC for a single ADC read.
       :
       :Parameters for macro SampleTouch:
       :  Control : Control Byte Value
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_06ae1_XPT2046__SampleTouch(MX_UINT8 FCL_CONTROL)
{
	//Local variable definitions
	MX_UINT8 FCL_B1;
	MX_UINT8 FCL_B2;
	MX_UINT16 FCR_RETVAL;



	FCD_01532_cal_spi__Master_Enable_CS();

	FC_CAL_SPI_Master_Byte_2(FCL_CONTROL);

	FCI_DELAYBYTE_US(1);

	FCL_B1 = FC_CAL_SPI_Master_Byte_2(0x00);

	FCL_B2 = FC_CAL_SPI_Master_Byte_2(0x00);

	FCD_01532_cal_spi__Master_Disable_CS();

	// LibraryComponent1::FlashRx()

	// LibraryComponent1::FlashTx()

	// .Return = .b2 >> 4
	// .Return = .Return | (.b1 << 4)
	FCR_RETVAL = FCL_B2 >> 4;
	FCR_RETVAL = FCR_RETVAL | (FCL_B1 << 4);

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the touch controller and returns true if there is currently a touch in progress.
       :The touch coordinates can be read using the ReadCoord macro.
       :Return 0 = No Touch, 1 = Touch in progress
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_06ae1_XPT2046__SampleSensor()
{
	//Local variable definitions
	MX_UINT8 FCL_CONTROL;
	MX_UINT8 FCR_RETVAL;



	// .control = 0x83
	// .control = .control | (AnMode << 2)
	FCL_CONTROL = 0x83;
	FCL_CONTROL = FCL_CONTROL | (0 << 2);

	FCV_06ae1_XPT2046__PRESSURE = FCD_06ae1_XPT2046__SampleTouch(FCL_CONTROL | (3 << 4));

	FCI_DELAYBYTE_US(100);

	FCV_06ae1_XPT2046__Y = FCD_06ae1_XPT2046__SampleTouch(FCL_CONTROL | (1 << 4));

	FCI_DELAYBYTE_US(100);

	FCV_06ae1_XPT2046__X = FCD_06ae1_XPT2046__SampleTouch(FCL_CONTROL | (5 << 4));

	FCI_DELAYBYTE_US(100);

	if (FCV_06ae1_XPT2046__PRESSURE > 0)
	{

		// .Return = 1
		FCR_RETVAL = 1;

	} else {

		// .Return = 0
		FCR_RETVAL = 0;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads a coordinate returned from the Sample Sensor macro.
       :Coordinate is scaled to the X/Y Pixel bounds specified.
       :
       :Parameters for macro ReadCoord:
       :  Coordinate : 0 = X, 1 = Y, 2 = Pressure
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_06ae1_XPT2046__ReadCoord(MX_UINT8 FCL_COORDINATE)
{
	//Local variable definitions
	MX_FLOAT FCL_FVAR;
	MX_UINT16 FCR_RETVAL;



	switch (FCL_COORDINATE)
	{
		case 1:
		{
			// .fvar = FLOAT Y / 2048.0
			// .fvar = .fvar * Ypix
			FCL_FVAR = flt_div(flt_fromi(FCV_06ae1_XPT2046__Y), 2048.0);
			FCL_FVAR = flt_mul(FCL_FVAR, 480);

			// .Return = float2int (.fvar)
			FCR_RETVAL = flt_toi(FCL_FVAR);

			#if (0)

			//Code has been optimised out by the pre-processor
			// #else

			#endif

			break;
		}
		case 2:
		{
			// .Return = Pressure
			FCR_RETVAL = FCV_06ae1_XPT2046__PRESSURE;

			break;
		}
		default:
		{
			// .fvar = FLOAT X / 2048.0
			// .fvar = .fvar * Xpix
			FCL_FVAR = flt_div(flt_fromi(FCV_06ae1_XPT2046__X), 2048.0);
			FCL_FVAR = flt_mul(FCL_FVAR, 320);

			// .Return = float2int (.fvar)
			FCR_RETVAL = flt_toi(FCL_FVAR);

			#if (0)

			//Code has been optimised out by the pre-processor
			// #else

			#endif

		}
	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Activates the SPI peripheral and claims control over the I/O pins.
\*=----------------------------------------------------------------------=*/
void FCD_06ae1_XPT2046__Initialise()
{


	FC_CAL_SPI_Master_Init_2();

}


/*========================================================================*\
   Use :cal_spi1
       :GUID: c67171df-0ad6-4b11-8361-cfe14b072847
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\cal_spi.fcpx
       :Version: 7.0 (0x200128)
       :Timestamp: 08\03\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Outputs a low signal to the chip select pin to select the remote slave device.
\*=----------------------------------------------------------------------=*/
void FCD_01531_cal_spi1__Master_Enable_CS()
{
	//Local variable definitions
#define FCLsz_STR 20
	MX_CHAR FCL_STR[FCLsz_STR];



	#if (1)

		#if (1) // 0 == 0

			#if (0)

			//Code has been optimised out by the pre-processor
			// #else

			#endif

		// #else

		//Code has been optimised out by the pre-processor
		#endif

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	//Local variable definitions
#undef FCLsz_STR
}

/*=----------------------------------------------------------------------=*\
   Use :Send text to the SPI console.
       :Exposed as part of the CAL_SPI component to allow none AutoCS pins and other.
       :
       :Parameters for macro Prv_TextConsole:
       :  str[20] : MX_CHAR (by-ref)
       :  Colour : 0=Default, 1=TX, 2=RX
       :  AppendTimestamp : 0=Don't Append / 1=Do Append
\*=----------------------------------------------------------------------=*/
void FCD_01531_cal_spi1__Prv_TextConsole(MX_CHAR *FCL_STR, MX_UINT16 FCLsz_STR, MX_UINT8 FCL_COLOUR, MX_UINT8 FCL_APPENDTIMESTAMP)
{
	//Local variable definitions
#define FCLsz_TSTR 20
	MX_CHAR FCL_TSTR[FCLsz_TSTR];



	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_TSTR
}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro Prv_SimShowWaveform:
       :  RXData : MX_UINT8
       :  TXData : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01531_cal_spi1__Prv_SimShowWaveform(MX_UINT8 FCL_RXDATA, MX_UINT16 FCL_TXDATA)
{


	#if (1)

		for (FCLV_LOOP8=0; (FCLV_LOOP8)<(8); (FCLV_LOOP8)++)
		{

			#if (0) // (7 & 0x02) == 0

			//Code has been optimised out by the pre-processor
			// #else

			#endif

			if (FCL_TXDATA & 0x80)
			{

				// MOSI = 1
				SET_PORT_PIN(A, 23, 1);

			} else {

				// MOSI = 0
				SET_PORT_PIN(A, 23, 0);

			}

			#if (0) // (7 & 0x04) == 0

			//Code has been optimised out by the pre-processor
			// #else

			#endif

			FCI_DELAYBYTE_US(1);

			#if (1) // (7 & 0x02) == 2

				#if (0) // (7 & 0x01) == 0

				//Code has been optimised out by the pre-processor
				#else

					// CLK = 0
					SET_PORT_PIN(A, 18, 0);

				#endif

			#else

			//Code has been optimised out by the pre-processor
			#endif

			#if (1) // (7 & 0x04) == 4

				if (FCL_RXDATA & 0x80)
				{

					// MISO = 1
					SET_PORT_PIN(A, 22, 1);

				} else {

					// MISO = 0
					SET_PORT_PIN(A, 22, 0);

				}

			// #else

			//Code has been optimised out by the pre-processor
			#endif

			FCI_DELAYBYTE_US(1);

			#if (1) // (7 & 0x02) == 2

				#if (0) // (7 & 0x01) == 0

				//Code has been optimised out by the pre-processor
				#else

					// CLK = 1
					SET_PORT_PIN(A, 18, 1);

				#endif

			// #else

			//Code has been optimised out by the pre-processor
			#endif

			// .TXData = .TXData << 1
			// .RXData = .RXData << 1
			FCL_TXDATA = FCL_TXDATA << 1;
			FCL_RXDATA = FCL_RXDATA << 1;


		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Outputs a high signal to the chip select pin to deselect the remote slave device.
\*=----------------------------------------------------------------------=*/
void FCD_01531_cal_spi1__Master_Disable_CS()
{
	//Local variable definitions
#define FCLsz_STR 20
	MX_CHAR FCL_STR[FCLsz_STR];



	#if (1)

		#if (1) // 0 == 0

			#if (0)

			//Code has been optimised out by the pre-processor
			// #else

			#endif

		// #else

		//Code has been optimised out by the pre-processor
		#endif

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	//Local variable definitions
#undef FCLsz_STR
}


/*========================================================================*\
   Use :WidthData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb8_WidthData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 16;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ASCIIData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb7_ASCIIData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 1325;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_Font4
       :GUID: 1b08885c-807e-4631-930e-a4fef06159dc
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\gLCD_Font.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Adds up all the pixels widths before the selected character to get to the start of the pixel data
       :
       :Parameters for macro SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_09e54_gLCD_Font4__SumWidths(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT8 FCL_WIDTH;
	MX_UINT16 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	#if (1) // 0 == 0

		while (FCL_CHARACTER > 0)
		{

			// .Character = .Character - 1
			FCL_CHARACTER = FCL_CHARACTER - 1;

			FCL_WIDTH = FCD_00fb8_WidthData__INTFIXEDLIST(FCL_CHARACTER);

			// .Return = .Return + .width
			FCR_RETVAL = FCR_RETVAL + FCL_WIDTH;


		}

		// .Return = .Return * BytesPerColumn
		FCR_RETVAL = FCR_RETVAL * 5;

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets the width of the ASCII character font data
       :
       :Parameters for macro ReadWidth:
       :  Character : ASCII position so A = 'A'
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e54_gLCD_Font4__ReadWidth(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCL_PWIDTH;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		if ((FCL_CHARACTER < 43) || (FCL_CHARACTER >= (43 + 16)))
		{

			if (FCL_CHARACTER == 32)
			{

				// .Return = SpaceWidth
				FCR_RETVAL = 4;

			} else {

				//Comment:
				//Out of range

				// .Return = 0
				FCR_RETVAL = 0;

			}

		} else {

			// .Character = .Character - FirstChar
			FCL_CHARACTER = FCL_CHARACTER - 43;

			FCR_RETVAL = FCD_00fb8_WidthData__INTFIXEDLIST(FCL_CHARACTER);

		}

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Collects a stat about the selected font
       :
       :Parameters for macro ReadFontStat:
       :  Index : 0=SpaceColumns, 1=CharacterHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e54_gLCD_Font4__ReadFontStat(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	if (FCL_INDEX == 1)
	{

		// .Return = PixelHeight
		FCR_RETVAL = 36;

	} else {

		// .Return = FontSpace
		FCR_RETVAL = 1;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single pixel column byte from the selected ASCII character font data.
       :
       :Parameters for macro ReadASCIILUT:
       :  Character : ASCII position so A = 'A'
       :  ByteIndex : Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e54_gLCD_Font4__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT8 FCL_BYTEINDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	if ((FCL_CHARACTER < 43) || (FCL_CHARACTER >= (43 + 16)))
	{

		if (FCL_CHARACTER == 32)
		{

			// .Return = 0
			FCR_RETVAL = 0;

		} else {

			//Comment:
			//Out of range

			// .Return = 0xAA
			FCR_RETVAL = 0xAA;

		}

	} else {

		// .Character = .Character - FirstChar
		FCL_CHARACTER = FCL_CHARACTER - 43;

		#if (0) // 0 == 1

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_CHARACTER == FCV_09e54_gLCD_Font4__OLDCHAR)
			{

				// .Position = oldposition
				FCL_POSITION = FCV_09e54_gLCD_Font4__OLDPOSITION;

			} else {

				FCL_POSITION = FCD_09e54_gLCD_Font4__SumWidths(FCL_CHARACTER);

				// oldposition = .Position
				// oldchar = .Character
				FCV_09e54_gLCD_Font4__OLDPOSITION = FCL_POSITION;
				FCV_09e54_gLCD_Font4__OLDCHAR = FCL_CHARACTER;

			}

		#endif

		// .Position = .Position + .ByteIndex
		FCL_POSITION = FCL_POSITION + FCL_BYTEINDEX;

		FCR_RETVAL = FCD_00fb7_ASCIIData__INTFIXEDLIST(FCL_POSITION);

	}

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :WidthData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb6_WidthData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 95;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ASCIIData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb5_ASCIIData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 1000;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_Font3
       :GUID: 1b08885c-807e-4631-930e-a4fef06159dc
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\gLCD_Font.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Adds up all the pixels widths before the selected character to get to the start of the pixel data
       :
       :Parameters for macro SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_09e53_gLCD_Font3__SumWidths(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT8 FCL_WIDTH;
	MX_UINT16 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	#if (1) // 0 == 0

		while (FCL_CHARACTER > 0)
		{

			// .Character = .Character - 1
			FCL_CHARACTER = FCL_CHARACTER - 1;

			FCL_WIDTH = FCD_00fb6_WidthData__INTFIXEDLIST(FCL_CHARACTER);

			// .Return = .Return + .width
			FCR_RETVAL = FCR_RETVAL + FCL_WIDTH;


		}

		// .Return = .Return * BytesPerColumn
		FCR_RETVAL = FCR_RETVAL * 2;

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets the width of the ASCII character font data
       :
       :Parameters for macro ReadWidth:
       :  Character : ASCII position so A = 'A'
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e53_gLCD_Font3__ReadWidth(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCL_PWIDTH;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
		{

			if (FCL_CHARACTER == 32)
			{

				// .Return = SpaceWidth
				FCR_RETVAL = 4;

			} else {

				//Comment:
				//Out of range

				// .Return = 0
				FCR_RETVAL = 0;

			}

		} else {

			// .Character = .Character - FirstChar
			FCL_CHARACTER = FCL_CHARACTER - 33;

			FCR_RETVAL = FCD_00fb6_WidthData__INTFIXEDLIST(FCL_CHARACTER);

		}

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Collects a stat about the selected font
       :
       :Parameters for macro ReadFontStat:
       :  Index : 0=SpaceColumns, 1=CharacterHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e53_gLCD_Font3__ReadFontStat(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	if (FCL_INDEX == 1)
	{

		// .Return = PixelHeight
		FCR_RETVAL = 14;

	} else {

		// .Return = FontSpace
		FCR_RETVAL = 1;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single pixel column byte from the selected ASCII character font data.
       :
       :Parameters for macro ReadASCIILUT:
       :  Character : ASCII position so A = 'A'
       :  ByteIndex : Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e53_gLCD_Font3__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT8 FCL_BYTEINDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
	{

		if (FCL_CHARACTER == 32)
		{

			// .Return = 0
			FCR_RETVAL = 0;

		} else {

			//Comment:
			//Out of range

			// .Return = 0xAA
			FCR_RETVAL = 0xAA;

		}

	} else {

		// .Character = .Character - FirstChar
		FCL_CHARACTER = FCL_CHARACTER - 33;

		#if (0) // 0 == 1

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_CHARACTER == FCV_09e53_gLCD_Font3__OLDCHAR)
			{

				// .Position = oldposition
				FCL_POSITION = FCV_09e53_gLCD_Font3__OLDPOSITION;

			} else {

				FCL_POSITION = FCD_09e53_gLCD_Font3__SumWidths(FCL_CHARACTER);

				// oldposition = .Position
				// oldchar = .Character
				FCV_09e53_gLCD_Font3__OLDPOSITION = FCL_POSITION;
				FCV_09e53_gLCD_Font3__OLDCHAR = FCL_CHARACTER;

			}

		#endif

		// .Position = .Position + .ByteIndex
		FCL_POSITION = FCL_POSITION + FCL_BYTEINDEX;

		FCR_RETVAL = FCD_00fb5_ASCIIData__INTFIXEDLIST(FCL_POSITION);

	}

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :WidthData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb4_WidthData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 95;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ASCIIData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb3_ASCIIData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 1222;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_Font2
       :GUID: 1b08885c-807e-4631-930e-a4fef06159dc
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\gLCD_Font.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Adds up all the pixels widths before the selected character to get to the start of the pixel data
       :
       :Parameters for macro SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_09e52_gLCD_Font2__SumWidths(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT8 FCL_WIDTH;
	MX_UINT16 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	#if (1) // 0 == 0

		while (FCL_CHARACTER > 0)
		{

			// .Character = .Character - 1
			FCL_CHARACTER = FCL_CHARACTER - 1;

			FCL_WIDTH = FCD_00fb4_WidthData__INTFIXEDLIST(FCL_CHARACTER);

			// .Return = .Return + .width
			FCR_RETVAL = FCR_RETVAL + FCL_WIDTH;


		}

		// .Return = .Return * BytesPerColumn
		FCR_RETVAL = FCR_RETVAL * 2;

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets the width of the ASCII character font data
       :
       :Parameters for macro ReadWidth:
       :  Character : ASCII position so A = 'A'
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e52_gLCD_Font2__ReadWidth(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCL_PWIDTH;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
		{

			if (FCL_CHARACTER == 32)
			{

				// .Return = SpaceWidth
				FCR_RETVAL = 4;

			} else {

				//Comment:
				//Out of range

				// .Return = 0
				FCR_RETVAL = 0;

			}

		} else {

			// .Character = .Character - FirstChar
			FCL_CHARACTER = FCL_CHARACTER - 33;

			FCR_RETVAL = FCD_00fb4_WidthData__INTFIXEDLIST(FCL_CHARACTER);

		}

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Collects a stat about the selected font
       :
       :Parameters for macro ReadFontStat:
       :  Index : 0=SpaceColumns, 1=CharacterHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e52_gLCD_Font2__ReadFontStat(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	if (FCL_INDEX == 1)
	{

		// .Return = PixelHeight
		FCR_RETVAL = 14;

	} else {

		// .Return = FontSpace
		FCR_RETVAL = 1;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single pixel column byte from the selected ASCII character font data.
       :
       :Parameters for macro ReadASCIILUT:
       :  Character : ASCII position so A = 'A'
       :  ByteIndex : Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e52_gLCD_Font2__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT8 FCL_BYTEINDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
	{

		if (FCL_CHARACTER == 32)
		{

			// .Return = 0
			FCR_RETVAL = 0;

		} else {

			//Comment:
			//Out of range

			// .Return = 0xAA
			FCR_RETVAL = 0xAA;

		}

	} else {

		// .Character = .Character - FirstChar
		FCL_CHARACTER = FCL_CHARACTER - 33;

		#if (0) // 0 == 1

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_CHARACTER == FCV_09e52_gLCD_Font2__OLDCHAR)
			{

				// .Position = oldposition
				FCL_POSITION = FCV_09e52_gLCD_Font2__OLDPOSITION;

			} else {

				FCL_POSITION = FCD_09e52_gLCD_Font2__SumWidths(FCL_CHARACTER);

				// oldposition = .Position
				// oldchar = .Character
				FCV_09e52_gLCD_Font2__OLDPOSITION = FCL_POSITION;
				FCV_09e52_gLCD_Font2__OLDCHAR = FCL_CHARACTER;

			}

		#endif

		// .Position = .Position + .ByteIndex
		FCL_POSITION = FCL_POSITION + FCL_BYTEINDEX;

		FCR_RETVAL = FCD_00fb3_ASCIIData__INTFIXEDLIST(FCL_POSITION);

	}

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :WidthData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb2_WidthData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 95;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ASCIIData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\lut.fcpx
       :Version: 10.0 (0x100728)
       :Timestamp: 20\02\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb1_ASCIIData__GetLUTCount()
{
	//Local variable definitions
	MX_UINT16 FCR_RETVAL;



	// .Return = NumVals
	FCR_RETVAL = 1098;

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_Font1
       :GUID: 1b08885c-807e-4631-930e-a4fef06159dc
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\gLCD_Font.fcpx
       :Version: 5.0 (0x100028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Adds up all the pixels widths before the selected character to get to the start of the pixel data
       :
       :Parameters for macro SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_09e51_gLCD_Font1__SumWidths(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT8 FCL_WIDTH;
	MX_UINT16 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	#if (1) // 0 == 0

		while (FCL_CHARACTER > 0)
		{

			// .Character = .Character - 1
			FCL_CHARACTER = FCL_CHARACTER - 1;

			FCL_WIDTH = FCD_00fb2_WidthData__INTFIXEDLIST(FCL_CHARACTER);

			// .Return = .Return + .width
			FCR_RETVAL = FCR_RETVAL + FCL_WIDTH;


		}

		// .Return = .Return * BytesPerColumn
		FCR_RETVAL = FCR_RETVAL * 2;

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets the width of the ASCII character font data
       :
       :Parameters for macro ReadWidth:
       :  Character : ASCII position so A = 'A'
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadWidth(MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCL_PWIDTH;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
		{

			if (FCL_CHARACTER == 32)
			{

				// .Return = SpaceWidth
				FCR_RETVAL = 4;

			} else {

				//Comment:
				//Out of range

				// .Return = 0
				FCR_RETVAL = 0;

			}

		} else {

			// .Character = .Character - FirstChar
			FCL_CHARACTER = FCL_CHARACTER - 33;

			FCR_RETVAL = FCD_00fb2_WidthData__INTFIXEDLIST(FCL_CHARACTER);

		}

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Collects a stat about the selected font
       :
       :Parameters for macro ReadFontStat:
       :  Index : 0=SpaceColumns, 1=CharacterHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadFontStat(MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	if (FCL_INDEX == 1)
	{

		// .Return = PixelHeight
		FCR_RETVAL = 14;

	} else {

		// .Return = FontSpace
		FCR_RETVAL = 1;

	}

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single pixel column byte from the selected ASCII character font data.
       :
       :Parameters for macro ReadASCIILUT:
       :  Character : ASCII position so A = 'A'
       :  ByteIndex : Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT8 FCL_BYTEINDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	#if (0) // 255 < 255

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	if ((FCL_CHARACTER < 33) || (FCL_CHARACTER >= (33 + 95)))
	{

		if (FCL_CHARACTER == 32)
		{

			// .Return = 0
			FCR_RETVAL = 0;

		} else {

			//Comment:
			//Out of range

			// .Return = 0xAA
			FCR_RETVAL = 0xAA;

		}

	} else {

		// .Character = .Character - FirstChar
		FCL_CHARACTER = FCL_CHARACTER - 33;

		#if (0) // 0 == 1

		//Code has been optimised out by the pre-processor
		#else

			if (FCL_CHARACTER == FCV_09e51_gLCD_Font1__OLDCHAR)
			{

				// .Position = oldposition
				FCL_POSITION = FCV_09e51_gLCD_Font1__OLDPOSITION;

			} else {

				FCL_POSITION = FCD_09e51_gLCD_Font1__SumWidths(FCL_CHARACTER);

				// oldposition = .Position
				// oldchar = .Character
				FCV_09e51_gLCD_Font1__OLDPOSITION = FCL_POSITION;
				FCV_09e51_gLCD_Font1__OLDCHAR = FCL_CHARACTER;

			}

		#endif

		// .Position = .Position + .ByteIndex
		FCL_POSITION = FCL_POSITION + FCL_BYTEINDEX;

		FCR_RETVAL = FCD_00fb1_ASCIIData__INTFIXEDLIST(FCL_POSITION);

	}

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :Base_GLCD
       :GUID: 4384cba9-0bea-4359-8c5b-dcd046aa7778
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\Base_GLCD.fcpx
       :Version: 16.0 (0x300028)
       :Timestamp: 06\03\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Reads the number of pixel columns used in the selected font
       :
       :Parameters for macro ReadFontWidth:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Character : ASCII character to get the pixel width e.g. 'A' or 65
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD__ReadFontWidth(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER)
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	if (FCL_FONT >= 3)
	{

		// .Font = 0
		FCL_FONT = 0;

	// } else {

	}

	if (FCL_FONT == 0)
	{

		FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadWidth(FCL_CHARACTER);

	// } else {

	}

	#if (1) // 3 > 1

		if (FCL_FONT == 1)
		{

			FCR_RETVAL = FCD_09e52_gLCD_Font2__ReadWidth(FCL_CHARACTER);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (1) // 3 > 2

		if (FCL_FONT == 2)
		{

			FCR_RETVAL = FCD_09e53_gLCD_Font3__ReadWidth(FCL_CHARACTER);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (0) // 3 > 3

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a stat from the selected embedded ASCII font data.
       :
       :Parameters for macro ReadFontStat:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Index : 0=SpaceWidth, 1=PixelHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD__ReadFontStat(MX_UINT8 FCL_FONT, MX_UINT8 FCL_INDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	if (FCL_FONT >= 3)
	{

		// .Font = 0
		FCL_FONT = 0;

	// } else {

	}

	if (FCL_FONT == 0)
	{

		FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadFontStat(FCL_INDEX);

	// } else {

	}

	#if (1) // 3 > 1

		if (FCL_FONT == 1)
		{

			FCR_RETVAL = FCD_09e52_gLCD_Font2__ReadFontStat(FCL_INDEX);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (1) // 3 > 2

		if (FCL_FONT == 2)
		{

			FCR_RETVAL = FCD_09e53_gLCD_Font3__ReadFontStat(FCL_INDEX);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (0) // 3 > 3

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a byte from the selected embedded ASCII font data.
       :
       :Parameters for macro ReadFontByte:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Character : ASCII character for example 'A' or 65
       :  ByteIndex : Font column Ranging 0-4
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD__ReadFontByte(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER, MX_UINT8 FCL_BYTEINDEX)
{
	//Local variable definitions
	MX_UINT16 FCL_POSITION;
	MX_UINT8 FCR_RETVAL;



	// .Return = 0
	FCR_RETVAL = 0;

	if (FCL_FONT >= 3)
	{

		// .Font = 0
		FCL_FONT = 0;

	// } else {

	}

	if (FCL_FONT == 0)
	{

		FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadASCIILUT(FCL_CHARACTER, FCL_BYTEINDEX);

	// } else {

	}

	#if (1) // 3 > 1

		if (FCL_FONT == 1)
		{

			FCR_RETVAL = FCD_09e52_gLCD_Font2__ReadASCIILUT(FCL_CHARACTER, FCL_BYTEINDEX);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (1) // 3 > 2

		if (FCL_FONT == 2)
		{

			FCR_RETVAL = FCD_09e53_gLCD_Font3__ReadASCIILUT(FCL_CHARACTER, FCL_BYTEINDEX);

		// } else {

		}

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	#if (0) // 3 > 3

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_ILI9488_SPI1
       :GUID: 3408fde0-f512-487b-8902-74cd56623191
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV10\Components\gLCD_ILI9488_SPI.fcpx
       :Version: 6.0 (0x200028)
       :Timestamp: 20\01\2023
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Sets the backlight enable pin allowing the display backlight to switch on.
       :Switching the backlight on and off at high speed allow the light to be dimmed.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__BacklightOn()
{


	#if (1)

		// led_pin = 1
		SET_PORT_PIN(A, 26, 1);

	// #else

	//Code has been optimised out by the pre-processor
	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Sets a pixel with the current foreground colour at current pixel location.
       :Not compatible with orientations other than 0.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__FastBPlot()
{
	//Local variable definitions
#define FCLsz_COL 3
	MX_UINT8 FCL_COL[FCLsz_COL];



	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	// .col[0] = bg_col_var[0]
	// .col[1] = bg_col_var[1]
	// .col[2] = bg_col_var[2]
	FCL_COL[0] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0];
	FCL_COL[1] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1];
	FCL_COL[2] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2];

	FC_CAL_SPI_Transaction_1(FCL_COL, 3, 3);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_COL
}

/*=----------------------------------------------------------------------=*\
   Use :Allows the fonts to be scaled up by multiplying the number of pixels on the X and Y.
       :
       :Parameters for macro SetFontScaler:
       :  ScaleX : Sets the horizontal scale of the font, default 1
       :  ScaleY : Sets the vertical scale of the font, default 1
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(MX_UINT8 FCL_SCALEX, MX_UINT8 FCL_SCALEY)
{


	if (FCL_SCALEX > 0)
	{

		// ScaleX = .ScaleX
		FCV_01de1_gLCD_ILI9488_SPI1__SCALEX = FCL_SCALEX;

	} else {

		// ScaleX = 1
		FCV_01de1_gLCD_ILI9488_SPI1__SCALEX = 1;

	}

	if (FCL_SCALEY > 0)
	{

		// ScaleY = .ScaleY
		FCV_01de1_gLCD_ILI9488_SPI1__SCALEY = FCL_SCALEY;

	} else {

		// ScaleY = 1
		FCV_01de1_gLCD_ILI9488_SPI1__SCALEY = 1;

	}

}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro LCD_Write_Reg:
       :  data : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(MX_UINT8 FCL_DATA)
{


	// dc_pin = 0
	SET_PORT_PIN(A, 27, 0);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	FC_CAL_SPI_Master_Byte_1(FCL_DATA);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :This macro prints a decimal number to the Graphical LCD.
       :
       :Parameters for macro PrintNumber:
       :  Number : Byte or Integer number to send to the display.
       :  X : X pixel coordinate to set the output string position.
       :  Y : Y pixel coordinate to set the output string position.
       :  Font : Range: 0 to 31 - 0=5x8, 1=10x8, 2=10x16, 3=5x16, 4-31=Extended Sizes
       :  Transparent : Specifies if the background of the text is drawn - 0 = Background colour is drawn, 1 = Background colour not drawn.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(MX_SINT16 FCL_NUMBER, MX_UINT16 FCL_X, MX_UINT16 FCL_Y, MX_UINT8 FCL_FONT, MX_UINT8 FCL_TRANSPARENT)
{
	//Local variable definitions
#define FCLsz_TEMP 8
	MX_CHAR FCL_TEMP[FCLsz_TEMP];



	// .temp = ToString$ (.Number)
	FCI_TOSTRING(FCL_NUMBER, FCL_TEMP,8);

	FCD_01de1_gLCD_ILI9488_SPI1__Print(FCL_TEMP, FCLsz_TEMP, FCL_X, FCL_Y, FCL_FONT, FCL_TRANSPARENT);

	//Local variable definitions
#undef FCLsz_TEMP
}

/*=----------------------------------------------------------------------=*\
   Use :Draws a line with the current foreground colour from pixel location X1, Y1 to pixel location X2, Y2.
       :
       :Parameters for macro DrawLine:
       :  X1 : MX_UINT16
       :  Y1 : MX_UINT16
       :  X2 : MX_UINT16
       :  Y2 : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1, MX_UINT16 FCL_X2, MX_UINT16 FCL_Y2)
{
	//Local variable definitions
	MX_SINT16 FCL_C1;
	MX_SINT16 FCL_M1;
	MX_SINT16 FCL_D1 = (0);
	MX_SINT16 FCL_PIXELX;
	MX_SINT16 FCL_PIXELY;
	MX_SINT16 FCL_YINC = (1);
	MX_SINT16 FCL_XINC = (1);
	MX_SINT16 FCL_X;
	MX_SINT16 FCL_Y;



	// .PixelX = .X2 - .X1
	// .PixelY = .Y2 - .Y1
	FCL_PIXELX = FCL_X2 - FCL_X1;
	FCL_PIXELY = FCL_Y2 - FCL_Y1;

	// .X = .X1
	// .Y = .Y1
	FCL_X = FCL_X1;
	FCL_Y = FCL_Y1;

	if (FCL_PIXELX < 0)
	{

		// .Xinc = -1
		// .PixelX = .PixelX * -1
		FCL_XINC = -1;
		FCL_PIXELX = FCL_PIXELX * -1;

	// } else {

	}

	if (FCL_PIXELY < 0)
	{

		// .Yinc = -1
		// .PixelY = .PixelY * -1
		FCL_YINC = -1;
		FCL_PIXELY = FCL_PIXELY * -1;

	// } else {

	}

	if (FCL_PIXELY <= FCL_PIXELX)
	{

		// .C1 = 2 * .PixelX
		// .M1 = 2 * .PixelY
		FCL_C1 = 2 * FCL_PIXELX;
		FCL_M1 = 2 * FCL_PIXELY;

		while (FCL_X != FCL_X2)
		{

			FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X, FCL_Y);

			// .X = .X + .Xinc
			FCL_X = FCL_X + FCL_XINC;

			// .D1 = .D1 + .M1
			FCL_D1 = FCL_D1 + FCL_M1;

			if (FCL_D1 > FCL_PIXELX)
			{

				// .Y = .Y + .Yinc
				FCL_Y = FCL_Y + FCL_YINC;

				// .D1 = .D1 - .C1
				FCL_D1 = FCL_D1 - FCL_C1;

			// } else {

			}


		}

	} else {

		// .C1 = 2 * .PixelY
		// .M1 = 2 * .PixelX
		FCL_C1 = 2 * FCL_PIXELY;
		FCL_M1 = 2 * FCL_PIXELX;

		while (FCL_Y != FCL_Y2)
		{

			FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X, FCL_Y);

			// .Y = .Y + .Yinc
			FCL_Y = FCL_Y + FCL_YINC;

			// .D1 = .D1 + .M1
			FCL_D1 = FCL_D1 + FCL_M1;

			if (FCL_D1 > FCL_PIXELY)
			{

				// .X = .X + .Xinc
				FCL_X = FCL_X + FCL_XINC;

				// .D1 = .D1 - .C1
				FCL_D1 = FCL_D1 - FCL_C1;

			// } else {

			}


		}

	}

	FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X, FCL_Y);

}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro LCD_Write_Data8:
       :  data : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(MX_UINT8 FCL_DATA)
{


	// dc_pin = 1
	SET_PORT_PIN(A, 27, 1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	FC_CAL_SPI_Master_Byte_1(FCL_DATA);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8()
{
	//Local variable definitions
	MX_UINT8 FCR_RETVAL;



	// dc_pin = 1
	SET_PORT_PIN(A, 27, 1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	FCR_RETVAL = FC_CAL_SPI_Master_Byte_1(0x55);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Draws an ellipse object on the display with the center of the ellipse at the location X,Y
       :
       :Parameters for macro DrawEllipse:
       :  X : X Coordinate for the center of the circle
       :  Y : Y coordinate for the center of the circle
       :  XRadius : Radius of the circle on the X axis specified in pixels
       :  YRadius : Radius of the circle on the Y axis specified in pixels
       :  Transparent : 0=Fill inside circle using background colour / 1=Draw outer circle only
       :  Solid : 0=Use Transparent Setting / 1=Fill with foreground colour
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__DrawEllipse(MX_UINT16 FCL_X, MX_UINT16 FCL_Y, MX_UINT16 FCL_XRADIUS, MX_UINT16 FCL_YRADIUS, MX_UINT8 FCL_TRANSPARENT, MX_UINT8 FCL_SOLID)
{
	//Local variable definitions
	MX_SINT16 FCL_ERR;
	MX_SINT16 FCL_CURX;
	MX_SINT16 FCL_CURY;
	MX_UINT8 FCL_REP = (0x0);
	MX_SINT16 FCL_E2;
	MX_FLOAT FCL_K;
#define FCLsz_BG 3
	MX_UINT8 FCL_BG[FCLsz_BG];
#define FCLsz_FG 3
	MX_UINT8 FCL_FG[FCLsz_FG];



	if (FCL_SOLID == 1)
	{

	FCC_DrawEllipse_A:
		;

		// .CurX = 0
		// .CurY = 0 - .YRadius
		FCL_CURX = 0;
		FCL_CURY = 0 - FCL_YRADIUS;

		// .err = 2 - (2 * .XRadius)
		FCL_ERR = 2 - (2 * FCL_XRADIUS);

		// .K = FLOAT (FLOAT .YRadius / FLOAT .XRadius)
		FCL_K = (flt_div(flt_fromi(FCL_YRADIUS), flt_fromi(FCL_XRADIUS)));

		while (1)
		{

			FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(flt_toi(flt_sub(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y + FCL_CURY, flt_toi(flt_add(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y + FCL_CURY);

			FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(flt_toi(flt_sub(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y - FCL_CURY, flt_toi(flt_add(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y - FCL_CURY);

			// .e2 = .err
			FCL_E2 = FCL_ERR;

			if (FCL_E2 <= FCL_CURX)
			{

				// .CurX = .CurX + 1
				// .err = .err + ((.CurX * 2) + 1)
				FCL_CURX = FCL_CURX + 1;
				FCL_ERR = FCL_ERR + ((FCL_CURX * 2) + 1);

				if ((0 - FCL_CURY == FCL_CURX) && (FCL_E2 <= FCL_CURY))
				{

					// .e2 = 0
					FCL_E2 = 0;

				// } else {

				}

			// } else {

			}

			if (FCL_E2 > FCL_CURY)
			{

				// .CurY = .CurY + 1
				// .err = .err + ((.CurY * 2) + 1)
				FCL_CURY = FCL_CURY + 1;
				FCL_ERR = FCL_ERR + ((FCL_CURY * 2) + 1);

			// } else {

			}


			if ((FCL_CURY <= 0) == 0) break;
		}

	} else {

		if (FCL_TRANSPARENT == 1)
		{

		FCC_DrawEllipse_B:
			;

			// .CurX = 0
			// .CurY = 0 - .YRadius
			FCL_CURX = 0;
			FCL_CURY = 0 - FCL_YRADIUS;

			// .err = 2 - (2 * .XRadius)
			FCL_ERR = 2 - (2 * FCL_XRADIUS);

			// .K = FLOAT (FLOAT .YRadius / FLOAT .XRadius)
			FCL_K = (flt_div(flt_fromi(FCL_YRADIUS), flt_fromi(FCL_XRADIUS)));

			while (1)
			{

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(flt_toi(flt_sub(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y + FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(flt_toi(flt_add(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y + FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(flt_toi(flt_add(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y - FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(flt_toi(flt_sub(flt_fromi(FCL_X), (flt_div(flt_fromi(FCL_CURX), FCL_K)))), FCL_Y - FCL_CURY);

				// .e2 = .err
				FCL_E2 = FCL_ERR;

				if (FCL_E2 <= FCL_CURX)
				{

					// .CurX = .CurX + 1
					// .err = .err + ((.CurX * 2) + 1)
					FCL_CURX = FCL_CURX + 1;
					FCL_ERR = FCL_ERR + ((FCL_CURX * 2) + 1);

					if ((0 - FCL_CURY == FCL_CURX) && (FCL_E2 <= FCL_CURY))
					{

						// .e2 = 0
						FCL_E2 = 0;

					// } else {

					}

				// } else {

				}

				if (FCL_E2 > FCL_CURY)
				{

					// .CurY = .CurY + 1
					// .err = .err + ((.CurY * 2) + 1)
					FCL_CURY = FCL_CURY + 1;
					FCL_ERR = FCL_ERR + ((FCL_CURY * 2) + 1);

				// } else {

				}


				if ((FCL_CURY <= 0) == 0) break;
			}

		} else {

			// .FG[0] = fg_col_var[0]
			// .FG[1] = fg_col_var[1]
			// .FG[2] = fg_col_var[2]
			// .BG[0] = bg_col_var[0]
			// .BG[1] = bg_col_var[1]
			// .BG[2] = bg_col_var[2]
			FCL_FG[0] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0];
			FCL_FG[1] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1];
			FCL_FG[2] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2];
			FCL_BG[0] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0];
			FCL_BG[1] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1];
			FCL_BG[2] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2];

			// fg_col_var[0] = .BG[0]
			// fg_col_var[1] = .BG[1]
			// fg_col_var[2] = .BG[2]
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = FCL_BG[0];
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = FCL_BG[1];
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = FCL_BG[2];

			// .Rep = 1
			FCL_REP = 1;

			goto FCC_DrawEllipse_A;

		}

	}

	if (FCL_REP == 1)
	{

		// .Rep = .Rep + 1
		FCL_REP = FCL_REP + 1;

		// fg_col_var[0] = .FG[0]
		// fg_col_var[1] = .FG[1]
		// fg_col_var[2] = .FG[2]
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = FCL_FG[0];
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = FCL_FG[1];
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = FCL_FG[2];

		goto FCC_DrawEllipse_B;

	// } else {

	}

	//Local variable definitions
#undef FCLsz_BG
#undef FCLsz_FG
}

/*=----------------------------------------------------------------------=*\
   Use :Sets a pixel with the current foreground colour at pixel location X, Y.
       :
       :Parameters for macro Plot:
       :  X1 : MX_UINT16
       :  Y1 : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__Plot(MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1)
{
	//Local variable definitions
#define FCLsz_COL 3
	MX_UINT8 FCL_COL[FCLsz_COL];



	FCD_01de1_gLCD_ILI9488_SPI1__Window(FCL_X1, FCL_Y1, FCL_X1 + 1, FCL_Y1 + 1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	// .col[0] = fg_col_var[0]
	// .col[1] = fg_col_var[1]
	// .col[2] = fg_col_var[2]
	FCL_COL[0] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0];
	FCL_COL[1] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1];
	FCL_COL[2] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2];

	FC_CAL_SPI_Transaction_1(FCL_COL, 3, 3);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_COL
}

/*=----------------------------------------------------------------------=*\
   Use :Sets a pixel with the current foreground colour at current pixel location.
       :Not compatible with orientations other than 0.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__FastPlot()
{
	//Local variable definitions
#define FCLsz_COL 3
	MX_UINT8 FCL_COL[FCLsz_COL];



	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	// .col[0] = fg_col_var[0]
	// .col[1] = fg_col_var[1]
	// .col[2] = fg_col_var[2]
	FCL_COL[0] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0];
	FCL_COL[1] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1];
	FCL_COL[2] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2];

	FC_CAL_SPI_Transaction_1(FCL_COL, 3, 3);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_COL
}

/*=----------------------------------------------------------------------=*\
   Use :Controls the way data is printed out on the display allowing multiple different viewing orientations. Default is 0.
       :
       :Parameters for macro SetDisplayOrientation:
       :  Orientation : 0=Default, 1=90??CW, 2=180??CW, 3=270??CW
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__SetDisplayOrientation(MX_UINT8 FCL_ORIENTATION)
{


	// Orientation = .Orientation
	FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION = FCL_ORIENTATION;

}

/*=----------------------------------------------------------------------=*\
   Use :Clears the backlight enable pin allowing the display backlight to switch off.
       :Switching the backlight on and off at high speed allow the light to be dimmed.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__BacklightOff()
{


	#if (1)

		// led_pin = 0
		SET_PORT_PIN(A, 26, 0);

	// #else

	//Code has been optimised out by the pre-processor
	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :Sets a pixel with the current background colour at pixel location X, Y.
       :
       :Parameters for macro BPlot:
       :  X1 : MX_UINT16
       :  Y1 : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__BPlot(MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1)
{
	//Local variable definitions
#define FCLsz_COL 3
	MX_UINT8 FCL_COL[FCLsz_COL];



	FCD_01de1_gLCD_ILI9488_SPI1__Window(FCL_X1, FCL_Y1, FCL_X1, FCL_Y1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	// .col[0] = bg_col_var[0]
	// .col[1] = bg_col_var[1]
	// .col[2] = bg_col_var[2]
	FCL_COL[0] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0];
	FCL_COL[1] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1];
	FCL_COL[2] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2];

	FC_CAL_SPI_Transaction_1(FCL_COL, 3, 3);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_COL
}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro Window:
       :  X1 : MX_UINT16
       :  Y1 : MX_UINT16
       :  X2 : MX_UINT16
       :  Y2 : MX_UINT16
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__Window(MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1, MX_UINT16 FCL_X2, MX_UINT16 FCL_Y2)
{
	//Local variable definitions
	MX_UINT16 FCL_TEMP;
#define FCLsz_DATA 4
	MX_UINT8 FCL_DATA[FCLsz_DATA];



	switch (FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION)
	{
		case 1:
		{
			// .temp = .Y1
			// .Y1 = .Y2
			// .Y2 = .temp
			FCL_TEMP = FCL_Y1;
			FCL_Y1 = FCL_Y2;
			FCL_Y2 = FCL_TEMP;

			// .temp = pixel_width - (.Y1 + 1)
			// .Y1 = .X1
			// .X1 = .temp
			FCL_TEMP = 320 - (FCL_Y1 + 1);
			FCL_Y1 = FCL_X1;
			FCL_X1 = FCL_TEMP;

			// .temp = pixel_width - (.Y2 + 1)
			// .Y2 = .X2
			// .X2 = .temp
			FCL_TEMP = 320 - (FCL_Y2 + 1);
			FCL_Y2 = FCL_X2;
			FCL_X2 = FCL_TEMP;

			break;
		}
		case 2:
		{
			// .temp = .Y1
			// .Y1 = .Y2
			// .Y2 = .temp
			FCL_TEMP = FCL_Y1;
			FCL_Y1 = FCL_Y2;
			FCL_Y2 = FCL_TEMP;

			// .X1 = pixel_width - (.X1 + 1)
			// .Y1 = pixel_height - (.Y1 + 1)
			FCL_X1 = 320 - (FCL_X1 + 1);
			FCL_Y1 = 480 - (FCL_Y1 + 1);

			// .X2 = pixel_width - (.X2 + 1)
			// .Y2 = pixel_height - (.Y2 + 1)
			FCL_X2 = 320 - (FCL_X2 + 1);
			FCL_Y2 = 480 - (FCL_Y2 + 1);

			break;
		}
		case 3:
		{
			// .temp = .Y1
			// .Y1 = pixel_height - (.X1 + 1)
			// .X1 = .temp
			FCL_TEMP = FCL_Y1;
			FCL_Y1 = 480 - (FCL_X1 + 1);
			FCL_X1 = FCL_TEMP;

			// .temp = .Y2
			// .Y2 = pixel_height - (.X2 + 1)
			// .X2 = .temp
			FCL_TEMP = FCL_Y2;
			FCL_Y2 = 480 - (FCL_X2 + 1);
			FCL_X2 = FCL_TEMP;

			break;
		}
		// default:

	}

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	if ((FCL_X1 == FCL_X2) && (FCL_X1 == FCV_01de1_gLCD_ILI9488_SPI1__COL))
	{

	} else {

		//Comment:
		//Set Column Address

		// dc_pin = 0
		SET_PORT_PIN(A, 27, 0);

		FC_CAL_SPI_Master_Byte_1(0x2A);

		// dc_pin = 1
		SET_PORT_PIN(A, 27, 1);

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_X1 >> 8);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_X1);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_X2 >> 8);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_X2);

#endif // Disabled code

		// .data[0] = .X1 >> 8
		// .data[1] = .X1
		// .data[2] = .X2 >> 8
		// .data[3] = .X2
		FCL_DATA[0] = FCL_X1 >> 8;
		FCL_DATA[1] = FCL_X1;
		FCL_DATA[2] = FCL_X2 >> 8;
		FCL_DATA[3] = FCL_X2;

		FC_CAL_SPI_Transaction_1(FCL_DATA, 4, 4);

		// col = .x1
		FCV_01de1_gLCD_ILI9488_SPI1__COL = FCL_X1;

	}

	if ((FCL_Y1 == FCL_Y2) && (FCL_Y1 == FCV_01de1_gLCD_ILI9488_SPI1__ROW))
	{

	} else {

		//Comment:
		//Set Row Address

		// dc_pin = 0
		SET_PORT_PIN(A, 27, 0);

		FC_CAL_SPI_Master_Byte_1(0x2B);

		// dc_pin = 1
		SET_PORT_PIN(A, 27, 1);

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_Y1 >> 8);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_Y1);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_Y2 >> 8);

#endif // Disabled code

#if 0 // Disabled code
		FC_CAL_SPI_Master_Byte_1(FCL_Y2);

#endif // Disabled code

		// .data[0] = .Y1 >> 8
		// .data[1] = .Y1
		// .data[2] = .Y2 >> 8
		// .data[3] = .Y2
		FCL_DATA[0] = FCL_Y1 >> 8;
		FCL_DATA[1] = FCL_Y1;
		FCL_DATA[2] = FCL_Y2 >> 8;
		FCL_DATA[3] = FCL_Y2;

		FC_CAL_SPI_Transaction_1(FCL_DATA, 4, 4);

		// row = .y1
		FCV_01de1_gLCD_ILI9488_SPI1__ROW = FCL_Y1;

	}

	//Comment:
	//Prep for data

	// dc_pin = 0
	SET_PORT_PIN(A, 27, 0);

	FC_CAL_SPI_Master_Byte_1(0x2C);

	// dc_pin = 1
	SET_PORT_PIN(A, 27, 1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	//Local variable definitions
#undef FCLsz_DATA
}

/*=----------------------------------------------------------------------=*\
   Use :This macro prints a string of characters to the Graphical LCD.
       :
       :Parameters for macro Print:
       :  Str[20] : String of characters to send to the display.
       :  X1 : X pixel coordinate to set the output string position.
       :  Y1 : Y pixel coordinate to set the output string position.
       :  Font : Selects which Font to use Range: 0 to Font Count
       :  Transparent : Specifies if the background of the text is drawn - 0 = Background colour is drawn, 1 = Background colour not drawn.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__Print(MX_CHAR *FCL_STR, MX_UINT16 FCLsz_STR, MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1, MX_UINT8 FCL_FONT, MX_UINT8 FCL_TRANSPARENT)
{
	//Local variable definitions
	MX_UINT8 FCL_BYTESPERCOLUMN;
	MX_UINT8 FCL_CHARACTERCOLUMNS;
	MX_UINT8 FCL_CHARACTERHEIGHT;
	MX_UINT8 FCL_COLUMNINDEX;
	MX_UINT8 FCL_COLUMNSUBINDEX;
	MX_UINT8 FCL_PIXELDATA;
	MX_UINT8 FCL_SPACECOLUMNS;
	MX_UINT8 FCL_IDX;
	MX_UINT8 FCL_LEN_STR;
	MX_UINT8 FCL_YCOUNT;
	MX_UINT8 FCL_YPIX;
	MX_UINT16 FCL_XCOUNT;
	MX_UINT8 FCL_H;



	// .xcount = 0
	// .idx = 0
	FCL_XCOUNT = 0;
	FCL_IDX = 0;

	// .len_str = Length$ (.Str)
	FCL_LEN_STR = FCI_GETLENGTH(FCL_STR, FCLsz_STR);

	FCL_SPACECOLUMNS = FCD_0ba71_Base_GLCD__ReadFontStat(FCL_FONT, 0);

	FCL_CHARACTERHEIGHT = FCD_0ba71_Base_GLCD__ReadFontStat(FCL_FONT, 1);

	// .BytesPerColumn = ((.CharacterHeight - 1) >> 3) + 1
	FCL_BYTESPERCOLUMN = ((FCL_CHARACTERHEIGHT - 1) >> 3) + 1;

	while (FCL_IDX < FCL_LEN_STR)
	{

		FCL_CHARACTERCOLUMNS = FCD_0ba71_Base_GLCD__ReadFontWidth(FCL_FONT, FCL_STR[FCL_IDX]);

		// .ColumnSubIndex = 0
		FCL_COLUMNSUBINDEX = 0;

		while (FCL_COLUMNSUBINDEX < FCL_BYTESPERCOLUMN)
		{

			if (FCL_COLUMNSUBINDEX)
			{

				// .xcount = .xcount - ((.CharacterColumns + .SpaceColumns) * ScaleX)
				FCL_XCOUNT = FCL_XCOUNT - ((FCL_CHARACTERCOLUMNS + FCL_SPACECOLUMNS) * FCV_01de1_gLCD_ILI9488_SPI1__SCALEX);

			// } else {

			}

			// .ColumnIndex = 0
			FCL_COLUMNINDEX = 0;

			while (FCL_COLUMNINDEX < (FCL_CHARACTERCOLUMNS + FCL_SPACECOLUMNS))
			{

				for (FCLV_LOOP1=0; (FCLV_LOOP1)<(FCV_01de1_gLCD_ILI9488_SPI1__SCALEX); (FCLV_LOOP1)++)
				{

					if (FCL_COLUMNINDEX < FCL_CHARACTERCOLUMNS)
					{

						FCL_PIXELDATA = FCD_0ba71_Base_GLCD__ReadFontByte(FCL_FONT, FCL_STR[FCL_IDX], FCL_COLUMNINDEX + (FCL_CHARACTERCOLUMNS * FCL_COLUMNSUBINDEX));

					} else {

						// .PixelData = 0
						FCL_PIXELDATA = 0;

					}

					// .ycount = (.ColumnSubIndex * 8) * ScaleY
					FCL_YCOUNT = (FCL_COLUMNSUBINDEX * 8) * FCV_01de1_gLCD_ILI9488_SPI1__SCALEY;

					if (((FCL_COLUMNSUBINDEX + 1) * 8) < FCL_CHARACTERHEIGHT)
					{

						// .ypix = 0
						FCL_YPIX = 0;

						// .h = 8
						FCL_H = 8;

					} else {

						if (((FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION == 1) || (FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION == 2)) && FCL_TRANSPARENT == 0)
						{

							// .ypix = 0
							FCL_YPIX = 0;

							// .h = .CharacterHeight - (.ColumnSubIndex * 8)
							FCL_H = FCL_CHARACTERHEIGHT - (FCL_COLUMNSUBINDEX * 8);

						} else {

							// .ypix = ((.ColumnSubIndex + 1) * 8) - .CharacterHeight
							FCL_YPIX = ((FCL_COLUMNSUBINDEX + 1) * 8) - FCL_CHARACTERHEIGHT;

							// .h = 8
							FCL_H = 8;

						}

					}

					//Comment:
					//We can only do window and fast plot when transparent = 0

					if (FCL_TRANSPARENT == 0)
					{

						FCD_01de1_gLCD_ILI9488_SPI1__Window(FCL_X1 + FCL_XCOUNT, FCL_Y1 + FCL_YCOUNT, FCL_X1 + FCL_XCOUNT, FCL_Y1 + FCL_YCOUNT + (FCL_H * FCV_01de1_gLCD_ILI9488_SPI1__SCALEY) - 1);

						while (FCL_YPIX < FCL_H)
						{

							for (FCLV_LOOP3=0; (FCLV_LOOP3)<(FCV_01de1_gLCD_ILI9488_SPI1__SCALEY); (FCLV_LOOP3)++)
							{

								if ((FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION == 1) || (FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION == 2))
								{

									if (FCL_PIXELDATA & (0x80 >> FCL_YPIX))
									{

										FCD_01de1_gLCD_ILI9488_SPI1__FastPlot();

									} else {

										if (FCL_TRANSPARENT == 0)
										{

											FCD_01de1_gLCD_ILI9488_SPI1__FastBPlot();

										// } else {

										}

									}

								} else {

									if (FCL_PIXELDATA & (0x01 << FCL_YPIX))
									{

										FCD_01de1_gLCD_ILI9488_SPI1__FastPlot();

									} else {

										if (FCL_TRANSPARENT == 0)
										{

											FCD_01de1_gLCD_ILI9488_SPI1__FastBPlot();

										// } else {

										}

									}

								}

								// .ycount = .ycount + 1
								FCL_YCOUNT = FCL_YCOUNT + 1;


							}

							// .ypix = .ypix + 1
							FCL_YPIX = FCL_YPIX + 1;


						}

					} else {

						while (FCL_YPIX < 8)
						{

							for (FCLV_LOOP2=0; (FCLV_LOOP2)<(FCV_01de1_gLCD_ILI9488_SPI1__SCALEY); (FCLV_LOOP2)++)
							{

								if (FCL_PIXELDATA & (0x01 << FCL_YPIX))
								{

									FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X1 + FCL_XCOUNT, FCL_Y1 + FCL_YCOUNT);

								} else {

									if (FCL_TRANSPARENT == 0)
									{

										FCD_01de1_gLCD_ILI9488_SPI1__BPlot(FCL_X1 + FCL_XCOUNT, FCL_Y1 + FCL_YCOUNT);

									// } else {

									}

								}

								// .ycount = .ycount + 1
								FCL_YCOUNT = FCL_YCOUNT + 1;


							}

							// .ypix = .ypix + 1
							FCL_YPIX = FCL_YPIX + 1;


						}

					}

					// .xcount = .xcount + 1
					FCL_XCOUNT = FCL_XCOUNT + 1;


				}

				// .ColumnIndex = .ColumnIndex + 1
				FCL_COLUMNINDEX = FCL_COLUMNINDEX + 1;


			}

			// .ColumnSubIndex = .ColumnSubIndex + 1
			FCL_COLUMNSUBINDEX = FCL_COLUMNSUBINDEX + 1;


		}

		// .idx = .idx + 1
		FCL_IDX = FCL_IDX + 1;


	}

	#if (0) // 0 == 1

	//Code has been optimised out by the pre-processor
	#else

		// ::Panel.Graphics.DrawEnd()

	#endif

}

/*=----------------------------------------------------------------------=*\
   Use :This macro clears the display of any previous output by overwriting the entire display with the background colour.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay()
{
	//Local variable definitions
	MX_UINT16 FCL_Y = (0x0);
	MX_UINT16 FCL_X = (0x0);
	MX_UINT8 FCL_ORIENTATIONSAVE;
#define FCLsz_BUFF 120
	MX_UINT8 FCL_BUFF[FCLsz_BUFF];
	MX_UINT8 FCL_BUFFIDX;



	// .OrientationSave = Orientation
	// Orientation = 0
	FCL_ORIENTATIONSAVE = FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION;
	FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION = 0;

	FCD_01de1_gLCD_ILI9488_SPI1__Window(0, 0, 320 - 1, 480 - 1);

	// dc_pin = 1
	SET_PORT_PIN(A, 27, 1);

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	while (FCL_Y < 480)
	{

		// .X = 0
		FCL_X = 0;

		while (FCL_X < (320 / 40))
		{

			for (FCL_BUFFIDX=0; (FCL_BUFFIDX)<(40); (FCL_BUFFIDX)++)
			{

				// .Buff[.BuffIdx * 3] = bg_col_var[0]
				// .Buff[(.BuffIdx * 3) + 1] = bg_col_var[1]
				// .Buff[(.BuffIdx * 3) + 2] = bg_col_var[2]
				FCL_BUFF[FCL_BUFFIDX * 3] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0];
				FCL_BUFF[(FCL_BUFFIDX * 3) + 1] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1];
				FCL_BUFF[(FCL_BUFFIDX * 3) + 2] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2];


			}

			FC_CAL_SPI_Transaction_1(FCL_BUFF, 120, 120);

			// .X = .X + 1
			FCL_X = FCL_X + 1;


		}

		// .Y = .Y + 1
		FCL_Y = FCL_Y + 1;


	}

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	// Orientation = .OrientationSave
	FCV_01de1_gLCD_ILI9488_SPI1__ORIENTATION = FCL_ORIENTATIONSAVE;

	//Local variable definitions
#undef FCLsz_BUFF
}

/*=----------------------------------------------------------------------=*\
   Use :Specifies the colour of the background by creating a mixture of red, green and blue.
       :
       :Parameters for macro SetBackgroundColour:
       :  Red : 0 - 255 where 0 = no red and 255 = maximum red
       :  Green : 0 - 255 where 0 = no green and 255 = maximum green
       :  Blue : 0 - 255 where 0 = no blue and 255 = maximum blue
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(MX_UINT8 FCL_RED, MX_UINT8 FCL_GREEN, MX_UINT8 FCL_BLUE)
{


	// bg_col_var[0] = .Red
	// bg_col_var[1] = .Green
	// bg_col_var[2] = .Blue
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0] = FCL_RED;
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1] = FCL_GREEN;
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2] = FCL_BLUE;

}

/*=----------------------------------------------------------------------=*\
   Use :Draws a circle object on the display with the center of the circle at the location X,Y
       :
       :Parameters for macro DrawCircle:
       :  X : X Coordinate for the center of the circle
       :  Y : Y coordinate for the center of the circle
       :  Radius : Radius of the circle specified in pixels
       :  Transparent : 0=Fill inside circle using background colour / 1=Draw outer circle only
       :  Solid : 0=Use Transparent Setting / 1=Fill with foreground colour
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__DrawCircle(MX_UINT16 FCL_X, MX_UINT16 FCL_Y, MX_UINT16 FCL_RADIUS, MX_UINT8 FCL_TRANSPARENT, MX_UINT8 FCL_SOLID)
{
	//Local variable definitions
	MX_SINT16 FCL_D;
	MX_SINT16 FCL_CURX;
	MX_SINT16 FCL_CURY;
	MX_UINT8 FCL_REP = (0x0);
#define FCLsz_BG 3
	MX_UINT8 FCL_BG[FCLsz_BG];
#define FCLsz_FG 3
	MX_UINT8 FCL_FG[FCLsz_FG];



	if (FCL_SOLID == 1)
	{

	FCC_DrawCircle_A:
		;

		// .D = 3 - (.Radius << 1)
		FCL_D = 3 - (FCL_RADIUS << 1);

		// .CurX = 0
		// .CurY = .Radius
		FCL_CURX = 0;
		FCL_CURY = FCL_RADIUS;

		while (FCL_CURX <= FCL_CURY)
		{

			if (FCL_CURY > 0)
			{

				FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X - FCL_CURY, FCL_Y + FCL_CURX, FCL_X + FCL_CURY, FCL_Y + FCL_CURX);

				FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X - FCL_CURY, FCL_Y - FCL_CURX, FCL_X + FCL_CURY, FCL_Y - FCL_CURX);

			// } else {

			}

			if (FCL_CURX > 0)
			{

				FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X - FCL_CURX, FCL_Y - FCL_CURY, FCL_X + FCL_CURX, FCL_Y - FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X - FCL_CURX, FCL_Y + FCL_CURY, FCL_X + FCL_CURX, FCL_Y + FCL_CURY);

			// } else {

			}

			if (FCL_D < 0)
			{

				// .D = .D + ((.CurX << 2) + 6)
				FCL_D = FCL_D + ((FCL_CURX << 2) + 6);

			} else {

				// .D = .D + (((.CurX - .CurY) << 2) + 10)
				FCL_D = FCL_D + (((FCL_CURX - FCL_CURY) << 2) + 10);

				// .CurY = .CurY - 1
				FCL_CURY = FCL_CURY - 1;

			}

			// .CurX = .CurX + 1
			FCL_CURX = FCL_CURX + 1;


		}

	} else {

		if (FCL_TRANSPARENT == 1)
		{

		FCC_DrawCircle_B:
			;

			// .D = 3 - (.Radius << 1)
			FCL_D = 3 - (FCL_RADIUS << 1);

			// .CurX = 0
			// .CurY = .Radius
			FCL_CURX = 0;
			FCL_CURY = FCL_RADIUS;

			while (FCL_CURX <= FCL_CURY)
			{

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X + FCL_CURX, FCL_Y - FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X - FCL_CURX, FCL_Y - FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X + FCL_CURY, FCL_Y - FCL_CURX);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X - FCL_CURY, FCL_Y - FCL_CURX);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X + FCL_CURX, FCL_Y + FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X - FCL_CURX, FCL_Y + FCL_CURY);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X + FCL_CURY, FCL_Y + FCL_CURX);

				FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X - FCL_CURY, FCL_Y + FCL_CURX);

				if (FCL_D < 0)
				{

					// .D = .D + ((.CurX << 2) + 6)
					FCL_D = FCL_D + ((FCL_CURX << 2) + 6);

				} else {

					// .D = .D + (((.CurX - .CurY) << 2) + 10)
					FCL_D = FCL_D + (((FCL_CURX - FCL_CURY) << 2) + 10);

					// .CurY = .CurY - 1
					FCL_CURY = FCL_CURY - 1;

				}

				// .CurX = .CurX + 1
				FCL_CURX = FCL_CURX + 1;


			}

		} else {

			// .FG[0] = fg_col_var[0]
			// .FG[1] = fg_col_var[1]
			// .FG[2] = fg_col_var[2]
			// .BG[0] = bg_col_var[0]
			// .BG[1] = bg_col_var[1]
			// .BG[2] = bg_col_var[2]
			FCL_FG[0] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0];
			FCL_FG[1] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1];
			FCL_FG[2] = FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2];
			FCL_BG[0] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0];
			FCL_BG[1] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1];
			FCL_BG[2] = FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2];

			// fg_col_var[0] = .BG[0]
			// fg_col_var[1] = .BG[1]
			// fg_col_var[2] = .BG[2]
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = FCL_BG[0];
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = FCL_BG[1];
			FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = FCL_BG[2];

			// .Rep = 1
			FCL_REP = 1;

			goto FCC_DrawCircle_A;

		}

	}

	if (FCL_REP == 1)
	{

		// .Rep = .Rep + 1
		FCL_REP = FCL_REP + 1;

		// fg_col_var[0] = .FG[0]
		// fg_col_var[1] = .FG[1]
		// fg_col_var[2] = .FG[2]
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = FCL_FG[0];
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = FCL_FG[1];
		FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = FCL_FG[2];

		goto FCC_DrawCircle_B;

	// } else {

	}

	//Local variable definitions
#undef FCLsz_BG
#undef FCLsz_FG
}

/*=----------------------------------------------------------------------=*\
   Use :Specifies the colour of the foreground by creating a mixture of red, green and blue.
       :
       :Parameters for macro SetForegroundColour:
       :  Red : 0 - 255 where 0 = no red and 255 = maximum red
       :  Green : 0 - 255 where 0 = no green and 255 = maximum green
       :  Blue : 0 - 255 where 0 = no blue and 255 = maximum blue
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(MX_UINT8 FCL_RED, MX_UINT8 FCL_GREEN, MX_UINT8 FCL_BLUE)
{


	// fg_col_var[0] = .Red
	// fg_col_var[1] = .Green
	// fg_col_var[2] = .Blue
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = FCL_RED;
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = FCL_GREEN;
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = FCL_BLUE;

}

/*=----------------------------------------------------------------------=*\
   Use :Draws a rectangle with the current foreground colour from pixel loaction X1, Y1 to pixel location X2, Y2
       :
       :Parameters for macro DrawRectangle:
       :  X1 : MX_UINT16
       :  Y1 : MX_UINT16
       :  X2 : MX_UINT16
       :  Y2 : MX_UINT16
       :  Transparent : Chooses the transparency of the box - 0 = Box contains background colour, 1 = Box contains previous pixel data.
       :  Solid : Chooses to fill the box with colour - 0 = Box contains transparency data, 1 = Box contains foreground colour.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(MX_UINT16 FCL_X1, MX_UINT16 FCL_Y1, MX_UINT16 FCL_X2, MX_UINT16 FCL_Y2, MX_UINT8 FCL_TRANSPARENT, MX_UINT8 FCL_SOLID)
{
	//Local variable definitions
	MX_UINT16 FCL_XMIN;
	MX_UINT16 FCL_XMAX;
	MX_UINT16 FCL_YMIN;
	MX_UINT16 FCL_YMAX;



	FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X1, FCL_Y1, FCL_X2, FCL_Y1);

	FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X2, FCL_Y1, FCL_X2, FCL_Y2);

	FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X1, FCL_Y2, FCL_X2, FCL_Y2);

	FCD_01de1_gLCD_ILI9488_SPI1__DrawLine(FCL_X1, FCL_Y1, FCL_X1, FCL_Y2);

	if (FCL_TRANSPARENT == 0)
	{

		if (FCL_X1 > FCL_X2)
		{

			// .Xmax = .X1
			// .Xmin = .X2 + 1
			FCL_XMAX = FCL_X1;
			FCL_XMIN = FCL_X2 + 1;

		} else {

			// .Xmax = .X2
			// .Xmin = .X1 + 1
			FCL_XMAX = FCL_X2;
			FCL_XMIN = FCL_X1 + 1;

		}

		if (FCL_Y1 > FCL_Y2)
		{

			// .Ymax = .Y1
			// .Ymin = .Y2 + 1
			FCL_YMAX = FCL_Y1;
			FCL_YMIN = FCL_Y2 + 1;

		} else {

			// .Ymax = .Y2
			// .Ymin = .Y1 + 1
			FCL_YMAX = FCL_Y2;
			FCL_YMIN = FCL_Y1 + 1;

		}

		// .Y1 = .Ymin
		FCL_Y1 = FCL_YMIN;

		while (FCL_Y1 < FCL_YMAX)
		{

			// .X1 = .Xmin
			FCL_X1 = FCL_XMIN;

			while (FCL_X1 < FCL_XMAX)
			{

				if (FCL_SOLID)
				{

					FCD_01de1_gLCD_ILI9488_SPI1__Plot(FCL_X1, FCL_Y1);

				} else {

					FCD_01de1_gLCD_ILI9488_SPI1__BPlot(FCL_X1, FCL_Y1);

				}

				// .X1 = .X1 + 1
				FCL_X1 = FCL_X1 + 1;


			}

			// .Y1 = .Y1 + 1
			FCL_Y1 = FCL_Y1 + 1;


		}

	// } else {

	}

}

/*=----------------------------------------------------------------------=*\
   Use :The Init macro must be called once to initialise the Graphical LCD display before any other Graphical LCD component macros are called.
\*=----------------------------------------------------------------------=*/
void FCD_01de1_gLCD_ILI9488_SPI1__Initialise()
{
	//Local variable definitions
	MX_UINT8 FCL_DAT;



	FC_CAL_SPI_Master_Init_1();

	// reset_pin = 1
	SET_PORT_PIN(B, 1, 1);

	FCI_DELAYBYTE_MS(5);

	// reset_pin = 0
	SET_PORT_PIN(B, 1, 0);

	// chip_sel_pin = 1
	SET_PORT_PIN(A, 14, 1);

	FCI_DELAYBYTE_MS(5);

	// dc_pin = 0
	SET_PORT_PIN(A, 27, 0);

	// reset_pin = 1
	SET_PORT_PIN(B, 1, 1);

	FCI_DELAYBYTE_MS(150);

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		// chip_sel_pin = 0
		SET_PORT_PIN(A, 14, 0);

	#endif

	//Comment:
	//Next we write to the display registers to setup the device ready for use

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xE0);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x03);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x09);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x08);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x16);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0A);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x3F);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x78);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x4C);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x09);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0A);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x08);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x16);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x1A);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0F);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xE1);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x16);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x19);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x03);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0F);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x05);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x32);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x45);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x46);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x04);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0E);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0D);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x35);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x37);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x0F);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xC0);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x17);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x15);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xC1);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x47);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xC5);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x12);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x80);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x36);

	// .dat = 0x08
	FCL_DAT = 0x08;

	#if (0)

	//Code has been optimised out by the pre-processor
	// #else

	#endif

	#if (1)

		// .dat = .dat | 0x40
		FCL_DAT = FCL_DAT | 0x40;

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(FCL_DAT);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x3A);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x66);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x51);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0xFF);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x53);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x20);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x56);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xB0);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x00);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xB1);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0xA0);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xB4);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x02);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xB6);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x02);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x02);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x3B);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xB7);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0xC6);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0xF7);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0xA9);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x51);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x2C);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Data8(0x82);

	#if (0)

	//Code has been optimised out by the pre-processor
	#else

		FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x20);

	#endif

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x11);

	FCI_DELAYBYTE_MS(120);

	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x29);

	FCI_DELAYBYTE_MS(25);

#if 0 // Disabled code
	//Comment:
	//----!!!DEBUG!!!----
	//Now read out some data to see what we are dealing with

#endif // Disabled code

#if 0 // Disabled code
	FCI_DELAYBYTE_MS(10);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x04);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCI_DELAYBYTE_MS(2);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x09);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCI_DELAYBYTE_MS(2);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x0A);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCI_DELAYBYTE_MS(2);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Write_Reg(0x0E);

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

#if 0 // Disabled code
	FCD_01de1_gLCD_ILI9488_SPI1__LCD_Read_Data8();

#endif // Disabled code

	//Comment:
	//End of readback

	// fg_col_var[0] = (FGCOL) & 0xFF
	// fg_col_var[1] = (FGCOL >> 8) & 0xFF
	// fg_col_var[2] = (FGCOL >> 16) & 0xFF
	// bg_col_var[0] = (BGCOL) & 0xFF
	// bg_col_var[1] = (BGCOL >> 8) & 0xFF
	// bg_col_var[2] = (BGCOL >> 16) & 0xFF
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[0] = (0) & 0xFF;
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[1] = (0 >> 8) & 0xFF;
	FCV_01de1_gLCD_ILI9488_SPI1__FG_COL_VAR[2] = (0 >> 16) & 0xFF;
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[0] = (16777215) & 0xFF;
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[1] = (16777215 >> 8) & 0xFF;
	FCV_01de1_gLCD_ILI9488_SPI1__BG_COL_VAR[2] = (16777215 >> 16) & 0xFF;

	#if (1)

		FCD_01de1_gLCD_ILI9488_SPI1__BacklightOn();

	// #else

	//Code has been optimised out by the pre-processor
	#endif

	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

}


/*========================================================================*\
   Use :panel
       :GUID: 
       :Location: 
       :Version:  (0x0)
       :Timestamp: 
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_LadeStatus()
{


	//Comment:
	//P? vej til Norge

	// Name: Decision, Type: Decision: FLagSleep = 1?
	if (FCV_FLAGSLEEP == 1)
	{

	} else {

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
		FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Ladning:", 25, 267, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Ladning:", 9, 25, 267, 0, 1);

		// Name: Decision, Type: Decision: FlagLadeStatus = 1?
		if (FCV_FLAGLADESTATUS == 1)
		{

#if 0 // Disabled code
			// Name: Calculation, Type: Calculation:
			// LysCount = 0
			FCV_LYSCOUNT = 0;

#endif // Disabled code

			// Name: Sorger for display kun skifter en gang, Type: Decision: Flagflimfjern = 2?
			if (FCV_FLAGFLIMFJERN == 2)
			{

			} else {

				// Name: Calculation, Type: Calculation:
				// Flagflimfjern = 2
				FCV_FLAGFLIMFJERN = 2;

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("      ", 130, 270, 1, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("      ", 7, 130, 270, 1, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("OFF!", 130, 270, 1, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("OFF!", 5, 130, 270, 1, 1);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

			}

		} else {

			// Name: Decision, Type: Decision: FlagLadeStatus = 0?
			if (FCV_FLAGLADESTATUS == 0)
			{

				// Name: Sorger for display kun skifter en gang, Type: Decision: Flagflimfjern = 1?
				if (FCV_FLAGFLIMFJERN == 1)
				{

				} else {

					// Name: Calculation, Type: Calculation:
					// Flagflimfjern = 1
					FCV_FLAGFLIMFJERN = 1;

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
					FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("      ", 130, 270, 1, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__Print("      ", 7, 130, 270, 1, 0);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("ON!", 130, 270, 1, 1)
					FCD_01de1_gLCD_ILI9488_SPI1__Print("ON!", 4, 130, 270, 1, 1);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
					FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

				}

			// } else {

			}

		}

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
		FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	}

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_TouchTest()
{


	// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

	// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("X", 20, 10, 1, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("X", 2, 20, 10, 1, 0);

	// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Y", 20, 40, 1, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Y", 2, 20, 40, 1, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 120, 150, 170, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 120, 150, 170, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 220, 150, 270, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 220, 150, 270, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Unit 1.", 40, 130, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Unit 1.", 8, 40, 130, 2, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Unit 2.", 40, 230, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Unit 2.", 8, 40, 230, 2, 0);

	// Name: Loop, Type: Loop: While 1
	while (1)
	{

		// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(X, 100, 10, 1, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_X, 100, 10, 1, 1);

		// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(Y, 100, 40, 1, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_Y, 100, 40, 1, 1);

		// Name: Delay, Type: Delay: 1 s
		FCI_DELAYBYTE_S(1);

		// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 90, 10, 1, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 90, 10, 1, 0);

		// Name: Call Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 90, 40, 1, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 90, 40, 1, 0);

		// Name: User Macro, Type: User Macro: Touch()
		FCM_Touch();

#if 0 // Disabled code
		// Name: Calculation, Type: Calculation:
		// X = 0
		// Y = 0
		FCV_X = 0;
		FCV_Y = 0;

#endif // Disabled code


	}

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_CalibrateKnap()
{


	//Comment:
	//X > 30&&X<80&&Y<440&&Y>340

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(20, 245, 140, 300, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(20, 245, 140, 300, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Calibr.", 24, 255, 1, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Calibr.", 8, 24, 255, 1, 1);

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_PlusMinus()
{


	//Comment:
	//X = 50
	//Y = 45

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(30, 240, 80, 285, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(30, 240, 80, 285, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(125, 240, 175, 285, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(125, 240, 175, 285, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(250, 240, 325, 285, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(250, 240, 325, 285, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 255, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 255, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Off.:", 190, 250, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Off.:", 6, 190, 250, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("-", 50, 240, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("-", 2, 50, 240, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("+", 140, 245, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("+", 2, 140, 245, 0, 1);

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Sleep()
{


	// Name: Decision, Type: Decision: FLagSleep = 1?
	if (FCV_FLAGSLEEP == 1)
	{

		// Name: User Macro, Type: User Macro: Touch()
		FCM_Touch();

		// Name: Decision, Type: Decision: X < 230 && X > 100 && Y < 300 && Y > 100?
		if (FCV_X < 230 && FCV_X > 100 && FCV_Y < 300 && FCV_Y > 100)
		{

			// Name: C Code, Type: C Code:
			esp_restart();

		// } else {

		}

	} else {

		// Name: Taeller for hvorn?r den skal g? i sleep, Type: Calculation:
		// LysCount = LysCount + 1
		FCV_LYSCOUNT = FCV_LYSCOUNT + 1;

		// Name: Decision, Type: Decision: LysCount > 300?
		if (FCV_LYSCOUNT > 300)
		{

			// Name: Taeller for hvorn?r den skal g? i sleep, Type: Calculation:
			// FLagSleep = 1
			FCV_FLAGSLEEP = 1;

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 0)
			FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 0);

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
			FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::BacklightOff()
			FCD_01de1_gLCD_ILI9488_SPI1__BacklightOff();

		// } else {

		}

	}

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_NEXT()
{


	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(360, 245, 465, 300, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(360, 245, 465, 300, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("NEXT", 364, 255, 300, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("NEXT", 5, 364, 255, 300, 1);

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Setting()
{


	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(230, 230, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(230, 230, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(4, 4)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(4, 4);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Setting!", 150, 20, 2, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Setting!", 9, 150, 20, 2, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 120, 150, 170, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 120, 150, 170, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 220, 150, 270, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 220, 150, 270, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Unit 1.", 40, 130, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Unit 1.", 8, 40, 130, 2, 0);

#if 0 // Disabled code
	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Test out.", 320, 130, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Test out.", 10, 320, 130, 2, 0);

#endif // Disabled code

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Unit 2.", 40, 230, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Unit 2.", 8, 40, 230, 2, 0);

	// Name: User Macro, Type: User Macro: NEXT()
	FCM_NEXT();

	//Comment:
	//Comment

	// Name: Decision, Type: Decision: FlagUnitOne = 1?
	if (FCV_FLAGUNITONE == 1)
	{

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 225, 130, 2, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 225, 130, 2, 1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("On! ", 225, 130, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("On! ", 5, 225, 130, 2, 0);

	} else {

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 225, 130, 2, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 225, 130, 2, 1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Off!", 225, 130, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Off!", 5, 225, 130, 2, 0);

	}

	// Name: Decision, Type: Decision: FlagUnitTwo = 1?
	if (FCV_FLAGUNITTWO == 1)
	{

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("    ", 225, 230, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("    ", 5, 225, 230, 2, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("On!", 225, 230, 2, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("On!", 4, 225, 230, 2, 1);

	} else {

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("    ", 225, 230, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("    ", 5, 225, 230, 2, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Off!", 225, 230, 2, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Off!", 5, 225, 230, 2, 1);

	}

	// Name: Calculation, Type: Calculation:
	// X = 0
	// Y = 0
	FCV_X = 0;
	FCV_Y = 0;

	// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
	while (1)
	{

		// Name: User Macro, Type: User Macro: Touch()
		FCM_Touch();

		// Name: Unit 1, Type: Decision: Y < 450 && Y > 330 && X < 200 && X > 140?
		if (FCV_Y < 450 && FCV_Y > 330 && FCV_X < 200 && FCV_X > 140)
		{

			// Name: Decision, Type: Decision: FlagUnitOne = 1?
			if (FCV_FLAGUNITONE == 1)
			{

				// Name: Calculation, Type: Calculation:
				// FlagUnitOne = 0
				FCV_FLAGUNITONE = 0;

				// Name: Status hvilke unit output som er aktiv Unit et Adresse10, Type: Component Macro: eeprom1::Write(10, FlagUnitOne)
				FCD_06651_eeprom1__Write(10, FCV_FLAGUNITONE);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 225, 130, 2, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 225, 130, 2, 1);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Off! ", 225, 130, 2, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("Off! ", 6, 225, 130, 2, 0);

				// Name: Delay, Type: Delay: 1 s
				FCI_DELAYBYTE_S(1);

			} else {

				// Name: Calculation, Type: Calculation:
				// FlagUnitOne = 1
				FCV_FLAGUNITONE = 1;

				// Name: Status hvilke unit output som er aktiv Unit et Adresse10, Type: Component Macro: eeprom1::Write(10, FlagUnitOne)
				FCD_06651_eeprom1__Write(10, FCV_FLAGUNITONE);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 225, 130, 2, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 225, 130, 2, 1);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("On! ", 225, 130, 2, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("On! ", 5, 225, 130, 2, 0);

				// Name: Delay, Type: Delay: 1 s
				FCI_DELAYBYTE_S(1);

			}

			// Name: Calculation, Type: Calculation:
			// X = 0
			// Y = 0
			FCV_X = 0;
			FCV_Y = 0;

		// } else {

		}

		// Name: Unit 2, Type: Decision: Y < 450 && Y > 330 && X < 105 && X > 50?
		if (FCV_Y < 450 && FCV_Y > 330 && FCV_X < 105 && FCV_X > 50)
		{

			// Name: Decision, Type: Decision: FlagUnitTwo = 1?
			if (FCV_FLAGUNITTWO == 1)
			{

				// Name: Calculation, Type: Calculation:
				// FlagUnitTwo = 0
				FCV_FLAGUNITTWO = 0;

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("    ", 225, 230, 2, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("    ", 5, 225, 230, 2, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Off!", 225, 230, 2, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("Off!", 5, 225, 230, 2, 1);

				// Name: Status hvilke unit output som er aktiv Unit et Adresse11, Type: Component Macro: eeprom1::Write(11, FlagUnitTwo)
				FCD_06651_eeprom1__Write(11, FCV_FLAGUNITTWO);

				// Name: Delay, Type: Delay: 1 s
				FCI_DELAYBYTE_S(1);

			} else {

				// Name: Calculation, Type: Calculation:
				// FlagUnitTwo = 1
				FCV_FLAGUNITTWO = 1;

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("    ", 225, 230, 2, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("    ", 5, 225, 230, 2, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("On!", 225, 230, 2, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("On!", 4, 225, 230, 2, 1);

				// Name: Status hvilke unit output som er aktiv Unit et Adresse11, Type: Component Macro: eeprom1::Write(11, FlagUnitTwo)
				FCD_06651_eeprom1__Write(11, FCV_FLAGUNITTWO);

				// Name: Delay, Type: Delay: 1 s
				FCI_DELAYBYTE_S(1);

			}

			// Name: Calculation, Type: Calculation:
			// X = 0
			// Y = 0
			FCV_X = 0;
			FCV_Y = 0;

		// } else {

		}


		if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
	}

	// Name: User Macro, Type: User Macro: Test_Out()
	FCM_Test_Out();

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_VoltAmp()
{


	//Comment:
	//0.735000
	//910

	// Name: Component Macro, Type: Component Macro: VoltOffset=eeprom1::Read(1)
	FCV_VOLTOFFSET = FCD_06651_eeprom1__Read(1);

	// Name: Decision, Type: Decision: ScreenFlag = 1?
	if (FCV_SCREENFLAG == 1)
	{

#if 0 // Disabled code
		// Name: Calculation, Type: Calculation:
		// LysCount = 0
		FCV_LYSCOUNT = 0;

#endif // Disabled code

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
		FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
		FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

		// Name: User Macro, Type: User Macro: PlusMinus()
		FCM_PlusMinus();

		// Name: User Macro, Type: User Macro: VoltSaveScaler()
		FCM_VoltSaveScaler();

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
		FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Amp:", 40, 30, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Amp:", 5, 40, 30, 0, 1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(300, 20, 400, 100, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(300, 20, 400, 100, 0, 1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Volt:", 40, 125, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Volt:", 6, 40, 125, 0, 1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(300, 110, 400, 190, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(300, 110, 400, 190, 0, 1);

		// Name: User Macro, Type: User Macro: NEXT()
		FCM_NEXT();

		// Name: Calculation, Type: Calculation:
		// Count = 200
		FCV_COUNT = 200;

		// Name: Calculation, Type: Calculation:
		// Y = 0
		// X = 0
		FCV_Y = 0;
		FCV_X = 0;

		// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
		while (1)
		{

			// Name: Component Macro, Type: Component Macro: AdcIn=slider_plastic1::GetInt()
			FCV_ADCIN = flt_fromi(FCD_0d101_slider_plastic1__GetInt());

			// Name: Calculation, Type: Calculation:
			// //Vooltage = AdcIn * 3.3 / (4094 / 100) * 4
			// Vooltage = AdcIn / 5500 * 30 //* (15942 / 16000)
			// VoltString = FloatToString$ (Vooltage,1) + "   "
			// //Vooltage = AdcIn / 5000 * 27
			// VoltString = FloatToString$ (Vooltage,1)
			{
			MX_CHAR FCI_TMP_STR[MX_MAX_TMPSTR_SIZE];
			FCV_VOOLTAGE = flt_mul(flt_div(FCV_ADCIN, 5500), 30);
			FCI_SHEAD(FCI_FLOAT_TO_STRING(FCV_VOOLTAGE, 1, FCI_TMP_STR, MX_MAX_TMPSTR_SIZE),20, "   ",4, FCV_VOLTSTRING,4);
			FCI_FLOAT_TO_STRING(FCV_VOOLTAGE, 1, FCV_VOLTSTRING, FCVsz_VOLTSTRING);
			}

			// Name: Component Macro, Type: Component Macro: AmpFloat=ACS7xx_Current_Sensor1::Current()
			FCV_AMPFLOAT = FCD_0f961_ACS7xx_Current_Sensor1__Current();

			// Name: Calculation, Type: Calculation:
			// AmpString = FloatToString$ (AmpFloat,1)
			// AmpString = AmpString //+ "    "
			// //Ampstring = ToString$ (AmpAcsInt)
			FCI_FLOAT_TO_STRING(FCV_AMPFLOAT, 1, FCV_AMPSTRING, FCVsz_AMPSTRING);
			FCI_SCOPY(FCV_AMPSTRING,FCVsz_AMPSTRING, FCV_AMPSTRING,FCVsz_AMPSTRING);

			// Name: Decision, Type: Decision: Count >= 200?
			if (FCV_COUNT >= 200)
			{

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 255, 255)
				FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 255, 255);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 320, 40, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 320, 40, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print(AmpString, 320, 40, 0, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print(FCV_AMPSTRING, FCVsz_AMPSTRING, 320, 40, 0, 1);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 255, 255)
				FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 255, 255);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print(" ", 370, 130, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print(" ", 2, 370, 130, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print(VoltString, 320, 130, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print(FCV_VOLTSTRING, FCVsz_VOLTSTRING, 320, 130, 0, 0);

				// Name: Calculation, Type: Calculation:
				// Count = 0
				FCV_COUNT = 0;

				// Name: Decision, Type: Decision: Vooltage > VoltOffset?
				if (flt_gt(FCV_VOOLTAGE, flt_fromi(FCV_VOLTOFFSET)))
				{

					// Name: Ladning OFF, Type: Output: 0 -> pin13
					SET_PORT_PIN(A,13,(0));

				} else {

					// Name: Ladning ON, Type: Output: 1 -> pin13
					SET_PORT_PIN(A,13,(1));

				}

			} else {

				// Name: Calculation, Type: Calculation:
				// Count = Count + 1
				FCV_COUNT = FCV_COUNT + 1;

			}

			// Name: User Macro, Type: User Macro: Touch()
			FCM_Touch();

			// Name: Kalibrering, Type: Decision: X > 40 && X < 90 && Y < 440 && Y > 390?
			if (FCV_X > 40 && FCV_X < 90 && FCV_Y < 440 && FCV_Y > 390)
			{

				// Name: Calculation, Type: Calculation:
				// VoltOffset = VoltOffset - 1
				FCV_VOLTOFFSET = FCV_VOLTOFFSET - 1;

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
				FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 270, 252, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 270, 252, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(VoltOffset, 278, 252, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_VOLTOFFSET, 278, 252, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
				FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

				// Name: Delay, Type: Delay: 500 ms
				FCI_DELAYINT_MS(500);

				// Name: Calculation, Type: Calculation:
				// Y = 0
				// X = 0
				FCV_Y = 0;
				FCV_X = 0;

				// Name: Component Macro, Type: Component Macro: eeprom1::Write(1, VoltOffset)
				FCD_06651_eeprom1__Write(1, FCV_VOLTOFFSET);

			} else {

				// Name: Decision, Type: Decision: X > 40 && X < 90 && Y < 349 && Y > 300?
				if (FCV_X > 40 && FCV_X < 90 && FCV_Y < 349 && FCV_Y > 300)
				{

					// Name: Calculation, Type: Calculation:
					// VoltOffset = VoltOffset + 1
					FCV_VOLTOFFSET = FCV_VOLTOFFSET + 1;

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
					FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 270, 252, 0, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 270, 252, 0, 0);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(VoltOffset, 278, 252, 0, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_VOLTOFFSET, 278, 252, 0, 0);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
					FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

					// Name: Delay, Type: Delay: 500 ms
					FCI_DELAYINT_MS(500);

					// Name: Calculation, Type: Calculation:
					// Y = 0
					// X = 0
					FCV_Y = 0;
					FCV_X = 0;

					// Name: Component Macro, Type: Component Macro: eeprom1::Write(1, VoltOffset)
					FCD_06651_eeprom1__Write(1, FCV_VOLTOFFSET);

				// } else {

				}

			}


			if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
		}

		// Name: Calculation, Type: Calculation:
		// ScreenFlag = 2
		FCV_SCREENFLAG = 2;

	} else {

		// Name: Component Macro, Type: Component Macro: AdcIn=slider_plastic1::GetInt()
		FCV_ADCIN = flt_fromi(FCD_0d101_slider_plastic1__GetInt());

		// Name: Calculation, Type: Calculation:
		// //Vooltage = AdcIn * 3.3 / (4094 / 100) * 4
		// Vooltage = AdcIn / 5500 * 30 //* (15942 / 16000)
		// VoltString = FloatToString$ (Vooltage,1) + "   "
		// //Vooltage = AdcIn / 5000 * 27
		// VoltString = FloatToString$ (Vooltage,1)
		{
		MX_CHAR FCI_TMP_STR[MX_MAX_TMPSTR_SIZE];
		FCV_VOOLTAGE = flt_mul(flt_div(FCV_ADCIN, 5500), 30);
		FCI_SHEAD(FCI_FLOAT_TO_STRING(FCV_VOOLTAGE, 1, FCI_TMP_STR, MX_MAX_TMPSTR_SIZE),20, "   ",4, FCV_VOLTSTRING,4);
		FCI_FLOAT_TO_STRING(FCV_VOOLTAGE, 1, FCV_VOLTSTRING, FCVsz_VOLTSTRING);
		}

		// Name: Component Macro, Type: Component Macro: AmpFloat=ACS7xx_Current_Sensor1::Current()
		FCV_AMPFLOAT = FCD_0f961_ACS7xx_Current_Sensor1__Current();

		// Name: Calculation, Type: Calculation:
		// AmpString = FloatToString$ (AmpFloat,1)
		// AmpString = AmpString //+ "    "
		// //Ampstring = ToString$ (AmpAcsInt)
		FCI_FLOAT_TO_STRING(FCV_AMPFLOAT, 1, FCV_AMPSTRING, FCVsz_AMPSTRING);
		FCI_SCOPY(FCV_AMPSTRING,FCVsz_AMPSTRING, FCV_AMPSTRING,FCVsz_AMPSTRING);

		// Name: Decision, Type: Decision: Vooltage > VoltOffset?
		if (flt_gt(FCV_VOOLTAGE, flt_fromi(FCV_VOLTOFFSET)))
		{

			// Name: Til display info . se LadeStatus, Type: Calculation:
			// FlagLadeStatus = 1
			FCV_FLAGLADESTATUS = 1;

			// Name: Ladning OFF, Type: Output: 0 -> pin13
			SET_PORT_PIN(A,13,(0));

		} else {

			// Name: Calculation, Type: Calculation:
			// FlagLadeStatus = 0
			FCV_FLAGLADESTATUS = 0;

			// Name: Ladning ON, Type: Output: 1 -> pin13
			SET_PORT_PIN(A,13,(1));

		}

		// Name: User Macro, Type: User Macro: LadeStatus()
		FCM_LadeStatus();

	}

	// Name: Calculation, Type: Calculation:
	// Y = 0
	// X = 0
	FCV_Y = 0;
	FCV_X = 0;

	//Comment:
	//P? vej til Norge

	// Name: User Macro, Type: User Macro: Lyssensor()
	FCM_Lyssensor();

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Lysstatus()
{


#if 0 // Disabled code
	// Name: Decision, Type: Decision: FLagSleep = 0?
	if (FCV_FLAGSLEEP == 0)
	{

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Dag/nat:", 25, 270, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Dag/nat:", 9, 25, 270, 0, 1);

	// } else {

	}

#endif // Disabled code

#if 0 // Disabled code
	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Dag!", 130, 270, 1, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Dag!", 5, 130, 270, 1, 1);

#endif // Disabled code

	// Name: Decision, Type: Decision: FlagLysStatus = 1?
	if (FCV_FLAGLYSSTATUS == 1)
	{

		// Name: Sorger for display kun skifter en gang, Type: Decision: FlagLysFlimFjern = 2?
		if (FCV_FLAGLYSFLIMFJERN == 2)
		{

		} else {

			// Name: Calculation, Type: Calculation:
			// FlagLysFlimFjern = 2
			FCV_FLAGLYSFLIMFJERN = 2;

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
			FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("       ", 130, 270, 1, 0)
			FCD_01de1_gLCD_ILI9488_SPI1__Print("       ", 8, 130, 270, 1, 0);

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 0)
			FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 0);

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("NAT!", 130, 270, 1, 1)
			FCD_01de1_gLCD_ILI9488_SPI1__Print("NAT!", 5, 130, 270, 1, 1);

			// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
			FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

		}

	} else {

#if 0 // Disabled code
		// Name: Decision, Type: Decision: FlagLysStatus = 0 && FLagSleep = 0?
		if (FCV_FLAGLYSSTATUS == 0 && FCV_FLAGSLEEP == 0)
		{

			// Name: Sorger for display kun skifter en gang, Type: Decision: FlagLysFlimFjern = 1?
			if (FCV_FLAGLYSFLIMFJERN == 1)
			{

			} else {

				// Name: Calculation, Type: Calculation:
				// FlagLysFlimFjern = 1
				FCV_FLAGLYSFLIMFJERN = 1;

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("      ", 130, 270, 1, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("      ", 7, 130, 270, 1, 0);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("DAG!", 130, 270, 1, 1)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("DAG!", 5, 130, 270, 1, 1);

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 255)
				FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 255);

			}

		// } else {

		}

#endif // Disabled code

	}

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

#if 0 // Disabled code
	// Name: Decision, Type: Decision: FLagSleep = 1?
	if (FCV_FLAGSLEEP == 1)
	{

	// } else {

	}

#endif // Disabled code

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Test_Out()
{


	// Name: Calculation, Type: Calculation:
	// X = 0
	// Y = 0
	FCV_X = 0;
	FCV_Y = 0;

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(230, 230, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(230, 230, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(4, 4)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(4, 4);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Test out!", 150, 20, 2, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Test out!", 10, 150, 20, 2, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 175, 150, 255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 175, 150, 255, 0, 0);

#if 0 // Disabled code
	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(25, 190, 150, 270, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(25, 190, 150, 270, 0, 0);

#endif // Disabled code

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Start!", 30, 190, 2, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Start!", 7, 30, 190, 2, 1);

	// Name: User Macro, Type: User Macro: NEXT()
	FCM_NEXT();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 225, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 225, 0);

	// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
	while (1)
	{

#if 0 // Disabled code
		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(230, 230, 255)
		FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(230, 230, 255);

#endif // Disabled code

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("OFF!", 230, 195, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("OFF!", 5, 230, 195, 2, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawCircle(400, 150, 25, 270, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__DrawCircle(400, 150, 25, 270, 1);

		// Name: Delay, Type: Delay: 1 s
		FCI_DELAYBYTE_S(1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 225, 195, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 225, 195, 2, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("ON!", 235, 195, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("ON!", 4, 235, 195, 2, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawCircle(400, 150, 25, 270, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__DrawCircle(400, 150, 25, 270, 0);

		// Name: Delay, Type: Delay: 1 s
		FCI_DELAYBYTE_S(1);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("    ", 225, 195, 2, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("    ", 5, 225, 195, 2, 0);

		// Name: User Macro, Type: User Macro: Touch()
		FCM_Touch();


		if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
	}

	// Name: User Macro, Type: User Macro: FrontValg()
	FCM_FrontValg();

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Touch()
{


	// Name: Component Macro, Type: Component Macro: Touch=XPT2046::SampleSensor()
	FCV_TOUCH = FCD_06ae1_XPT2046__SampleSensor();

	// Name: Decision, Type: Decision: Touch?
	if (FCV_TOUCH)
	{

		// Name: Component Macro, Type: Component Macro: X=XPT2046::ReadCoord(0)
		FCV_X = FCD_06ae1_XPT2046__ReadCoord(0);

		// Name: Component Macro, Type: Component Macro: Y=XPT2046::ReadCoord(1)
		FCV_Y = FCD_06ae1_XPT2046__ReadCoord(1);

	// } else {

	}

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Lyssensor()
{


	// Name: Component Macro, Type: Component Macro: EpromSave=eeprom1::Read(0)
	FCV_EPROMSAVE = FCD_06651_eeprom1__Read(0);

	// Name: Component Macro, Type: Component Macro: AmbientLight1::ChangeMeasurementTime(69)
	FCD_0f391_AmbientLight1__ChangeMeasurementTime(69);

	// Name: Component Macro, Type: Component Macro: Amb=AmbientLight1::ReadMeasurement()
	FCV_AMB = FCD_0f391_AmbientLight1__ReadMeasurement();

	// Name: Calculation, Type: Calculation:
	// Amb = Amb / 3
	FCV_AMB = FCV_AMB / 3;

	// Name: Decision, Type: Decision: ScreenFlag = 2?
	if (FCV_SCREENFLAG == 2)
	{

		// Name: Component Macro, Type: Component Macro: AmbientLight1::ContinuousMeasurement(0)
		FCD_0f391_AmbientLight1__ContinuousMeasurement(0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 255, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 255, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
		FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(0, 0, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(0, 0, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Lys bits. Value:", 10, 50, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Lys bits. Value:", 17, 10, 50, 0, 1);

#if 0 // Disabled code
		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Lys bits. Min:", 10, 100, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Lys bits. Min:", 15, 10, 100, 0, 1);

#endif // Disabled code

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Lys bits offset:", 10, 150, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__Print("Lys bits offset:", 17, 10, 150, 0, 1);

		// Name: User Macro, Type: User Macro: NEXT()
		FCM_NEXT();

		// Name: User Macro, Type: User Macro: CalibrateKnap()
		FCM_CalibrateKnap();

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
		FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 255, 0)
		FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 255, 0);

		// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(EpromSave, 330, 150, 0, 1)
		FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_EPROMSAVE, 330, 150, 0, 1);

		// Name: Calculation, Type: Calculation:
		// Count = 0
		FCV_COUNT = 0;

		// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
		while (1)
		{

			// Name: Calculation, Type: Calculation:
			// Count = Count + 1
			FCV_COUNT = FCV_COUNT + 1;

			// Name: Count > 100, Type: Decision: Count > 25?
			if (FCV_COUNT > 25)
			{

				// Name: Component Macro, Type: Component Macro: AmbientLight1::ChangeMeasurementTime(69)
				FCD_0f391_AmbientLight1__ChangeMeasurementTime(69);

				// Name: Component Macro, Type: Component Macro: Amb=AmbientLight1::ReadMeasurement()
				FCV_AMB = FCD_0f391_AmbientLight1__ReadMeasurement();

#if 0 // Disabled code
				// Name: User Macro, Type: User Macro: Touch()
				FCM_Touch();

#endif // Disabled code

				// Name: Calculation, Type: Calculation:
				// Count = 0
				// Amb = Amb / 3
				FCV_COUNT = 0;
				FCV_AMB = FCV_AMB / 3;

				// Name: Calculation, Type: Calculation:
				// //Amb = Amb / 10
				// LightString = ToString$ (Amb) + "   "
				{
				MX_CHAR FCI_TMP_STR[MX_MAX_TMPSTR_SIZE];
				FCI_SHEAD(FCI_TOSTRING(FCV_AMB, FCI_TMP_STR,MX_MAX_TMPSTR_SIZE),20, "   ",4, FCV_LIGHTSTRING,20);
				}

#if 0 // Disabled code
				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("        ", 330, 50, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print("        ", 9, 330, 50, 0, 0);

#endif // Disabled code

				// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print(LightString, 330, 50, 0, 0)
				FCD_01de1_gLCD_ILI9488_SPI1__Print(FCV_LIGHTSTRING, FCVsz_LIGHTSTRING, 330, 50, 0, 0);

			} else {

				// Name: Kalibrering, Type: Decision: X > 30 && X < 80 && Y < 440 && Y > 340?
				if (FCV_X > 30 && FCV_X < 80 && FCV_Y < 440 && FCV_Y > 340)
				{

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
					FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

					// Name: Calculation, Type: Calculation:
					// X = 0
					// Y = 0
					FCV_X = 0;
					FCV_Y = 0;

#if 0 // Disabled code
					// Name: Calculation, Type: Calculation:
					// Amb = Amb / 3
					FCV_AMB = FCV_AMB / 3;

#endif // Disabled code

					// Name: Calculation, Type: Calculation:
					// EpromSave = Amb
					FCV_EPROMSAVE = FCV_AMB;

					// Name: Component Macro, Type: Component Macro: eeprom1::WriteByte(0, EpromSave)
					FCD_06651_eeprom1__WriteByte(0, FCV_EPROMSAVE);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Calibratet:", 160, 260, 0, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__Print("Calibratet:", 12, 160, 260, 0, 0);

					// Name: Component Macro, Type: Component Macro: EpromSave=eeprom1::Read(0)
					FCV_EPROMSAVE = FCD_06651_eeprom1__Read(0);

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(EpromSave, 285, 260, 0, 0)
					FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_EPROMSAVE, 285, 260, 0, 0);

					// Name: Delay, Type: Delay: 500 ms
					FCI_DELAYINT_MS(500);

					// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
					while (1)
					{

						// Name: User Macro, Type: User Macro: Touch()
						FCM_Touch();


						if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
					}

					// Name: Calculation, Type: Calculation:
					// X = 0
					// Y = 0
					FCV_X = 0;
					FCV_Y = 0;

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
					FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

					// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
					FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

					// Name: User Macro, Type: User Macro: Lyssensor()
					FCM_Lyssensor();

				// } else {

				}

			}

			// Name: User Macro, Type: User Macro: Touch()
			FCM_Touch();

			// Name: Delay, Type: Delay: 10 ms
			FCI_DELAYBYTE_MS(10);

			// Name: Decision, Type: Decision: Amb < EpromSave?
			if (FCV_AMB < FCV_EPROMSAVE)
			{

				// Name: Lys ude ON, Type: Output: 1 -> pin25
				SET_PORT_PIN(A,25,(1));

			} else {

				// Name: Lys ude OFF, Type: Output: 0 -> pin25
				SET_PORT_PIN(A,25,(0));

			}


			if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
		}

		// Name: Saetter flaget til andet end  1 eller 2 som i Lysstaus, Type: Calculation:
		// FlagLysFlimFjern = 4
		FCV_FLAGLYSFLIMFJERN = 4;

		// Name: Saetter flaget til andet end  1 eller 2 som i Lysstaus, Type: Calculation:
		// LysCount = 0
		FCV_LYSCOUNT = 0;

		// Name: User Macro, Type: User Macro: Setting()
		FCM_Setting();

	} else {

		// Name: Decision, Type: Decision: Amb < EpromSave?
		if (FCV_AMB < FCV_EPROMSAVE)
		{

			// Name: Calculation, Type: Calculation:
			// FlagLysStatus = 1
			FCV_FLAGLYSSTATUS = 1;

			// Name: User Macro, Type: User Macro: Nat()
			FCM_Nat();

#if 0 // Disabled code
			// Name: Lys ude ON, Type: Output: 1 -> pin25
			SET_PORT_PIN(A,25,(1));

#endif // Disabled code

		} else {

			// Name: Calculation, Type: Calculation:
			// FlagLysStatus = 0
			FCV_FLAGLYSSTATUS = 0;

#if 0 // Disabled code
			// Name: Lys ude OFF, Type: Output: 0 -> pin25
			SET_PORT_PIN(A,25,(0));

#endif // Disabled code

		}

#if 0 // Disabled code
		// Name: Decision, Type: Decision: FLagSleep = 1?
		if (FCV_FLAGSLEEP == 1)
		{

		} else {

			// Name: User Macro, Type: User Macro: Lysstatus()
			FCM_Lysstatus();

		}

#endif // Disabled code

	}

	// Name: Calculation, Type: Calculation:
	// Count = 101
	// AmbOld = 999
	FCV_COUNT = 101;
	FCV_AMBOLD = 999;

	// Name: Calculation, Type: Calculation:
	// X = 0
	// Y = 0
	FCV_X = 0;
	FCV_Y = 0;

	// Name: Calculation, Type: Calculation:
	// ScreenFlag = 0
	FCV_SCREENFLAG = 0;

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_VoltSaveScaler()
{


	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("     ", 272, 252, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("     ", 6, 272, 252, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(2, 2)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(2, 2);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::PrintNumber(VoltOffset, 278, 252, 0, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__PrintNumber(FCV_VOLTOFFSET, 278, 252, 0, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_Nat()
{


	// Name: Ladning OFF, Type: Output: 0 -> pin13
	SET_PORT_PIN(A,13,(0));

	// Name: Lys ude ON, Type: Output: 1 -> pin25
	SET_PORT_PIN(A,25,(1));

	// Name: Calculation, Type: Calculation:
	// EpromSave = EpromSave + 20
	FCV_EPROMSAVE = FCV_EPROMSAVE + 20;

	// Name: Calculation, Type: Calculation:
	// Sekund = 0
	// Minut = 0
	FCV_SEKUND = 0;
	FCV_MINUT = 0;

	// Name: Faar ladestatus resat efter det har v?ret nat. Se ladestatus, Type: Calculation:
	// FlagLadeStatus = 4
	// Flagflimfjern = 4
	FCV_FLAGLADESTATUS = 4;
	FCV_FLAGFLIMFJERN = 4;

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(7, 7)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(7, 7);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Godnat!", 75, 100, 2, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Godnat!", 8, 75, 100, 2, 0);

	// Name: Delay, Type: Delay: 5 s
	FCI_DELAYBYTE_S(5);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

#if 0 // Disabled code
	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("      ", 130, 233, 1, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("      ", 7, 130, 233, 1, 0);

#endif // Disabled code

#if 0 // Disabled code
	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("OFF!", 130, 233, 1, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("OFF!", 5, 130, 233, 1, 1);

#endif // Disabled code

	// Name: Taeller for hvorn?r den skal g? i sleep, Type: Calculation:
	// FLagSleep = 0
	FCV_FLAGSLEEP = 0;

	// Name: Loop, Type: Loop: Until Amb > EpromSave && Sekund > 4
	while (1)
	{

		// Name: Delay, Type: Delay: 1 s
		FCI_DELAYBYTE_S(1);

		// Name: Decision, Type: Decision: Sekund > 4?
		if (FCV_SEKUND > 4)
		{

			// Name: Lys ude OFF, Type: Output: 0 -> pin25
			SET_PORT_PIN(A,25,(0));

		// } else {

		}

		// Name: Calculation, Type: Calculation:
		// Sekund = Sekund + 1
		FCV_SEKUND = FCV_SEKUND + 1;

#if 0 // Disabled code
		// Name: Decision, Type: Decision: Sekund > 59?
		if (FCV_SEKUND > 59)
		{

			// Name: Calculation, Type: Calculation:
			// Sekund = 0
			// Minut = Minut + 1
			FCV_SEKUND = 0;
			FCV_MINUT = FCV_MINUT + 1;

			// Name: Decision, Type: Decision: Minut > 240?
			if (FCV_MINUT > 240)
			{

				// Name: Calculation, Type: Calculation:
				// Sekund = 0
				FCV_SEKUND = 0;

				// Name: Lys ude OFF, Type: Output: 0 -> pin25
				SET_PORT_PIN(A,25,(0));

			// } else {

			}

		} else {

#if 0 // Disabled code
			// Name: Delay, Type: Delay: 100 ms
			FCI_DELAYBYTE_MS(100);

#endif // Disabled code

#if 0 // Disabled code
			// Name: Lys ude ON, Type: Output: 1 -> pin25
			SET_PORT_PIN(A,25,(1));

#endif // Disabled code

#if 0 // Disabled code
			// Name: Delay, Type: Delay: 100 ms
			FCI_DELAYBYTE_MS(100);

#endif // Disabled code

#if 0 // Disabled code
			// Name: Lys ude OFF, Type: Output: 0 -> pin25
			SET_PORT_PIN(A,25,(0));

#endif // Disabled code

		}

#endif // Disabled code

		// Name: Component Macro, Type: Component Macro: AmbientLight1::ChangeMeasurementTime(69)
		FCD_0f391_AmbientLight1__ChangeMeasurementTime(69);

		// Name: Component Macro, Type: Component Macro: Amb=AmbientLight1::ReadMeasurement()
		FCV_AMB = FCD_0f391_AmbientLight1__ReadMeasurement();

		// Name: Calculation, Type: Calculation:
		// Amb = Amb / 3
		FCV_AMB = FCV_AMB / 3;


		if ((FCV_AMB > FCV_EPROMSAVE && FCV_SEKUND > 4) != 0) break;
	}

	// Name: Lys ude OFF, Type: Output: 0 -> pin25
	SET_PORT_PIN(A,25,(0));

	// Name: C Code, Type: C Code:
	esp_restart();

#if 0 // Disabled code
	// Name: Calculation, Type: Calculation:
	// FlagLysStatus = 0
	FCV_FLAGLYSSTATUS = 0;

#endif // Disabled code

#if 0 // Disabled code
	// Name: Calculation, Type: Calculation:
	// LysCount = 0
	FCV_LYSCOUNT = 0;

#endif // Disabled code

#if 0 // Disabled code
	// Name: Lys ude OFF, Type: Output: 0 -> pin25
	SET_PORT_PIN(A,25,(0));

#endif // Disabled code

}

/*=----------------------------------------------------------------------=*\
   Use :
\*=----------------------------------------------------------------------=*/
void FCM_FrontValg()
{


	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("Solcelle lade controller.", 40, 50, 300, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("Solcelle lade controller.", 26, 40, 50, 300, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Print("J. Gundorph.", 110, 140, 300, 1)
	FCD_01de1_gLCD_ILI9488_SPI1__Print("J. Gundorph.", 13, 110, 140, 300, 1);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(0, 0, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(0, 0, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::DrawRectangle(360, 245, 465, 300, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__DrawRectangle(360, 245, 465, 300, 0, 0);

	// Name: User Macro, Type: User Macro: NEXT()
	FCM_NEXT();

	// Name: Calculation, Type: Calculation:
	// ScreenFlag = 0
	FCV_SCREENFLAG = 0;

	// Name: Calculation, Type: Calculation:
	// Y = 0
	// X = 0
	FCV_Y = 0;
	FCV_X = 0;

	// Name: Calculation, Type: Calculation:
	// Flagflimfjern = 0
	FCV_FLAGFLIMFJERN = 0;

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetForegroundColour(255, 255, 255)
	FCD_01de1_gLCD_ILI9488_SPI1__SetForegroundColour(255, 255, 255);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::BacklightOn()
	FCD_01de1_gLCD_ILI9488_SPI1__BacklightOn();

	// Name: Component Macro, Type: Component Macro: AmbientLight1::ContinuousMeasurement(0)
	FCD_0f391_AmbientLight1__ContinuousMeasurement(0);

	// Name: Loop, Type: Loop: Until Y < 137 && Y > 40 && x < 80 && X > 25
	while (1)
	{

		// Name: User Macro, Type: User Macro: VoltAmp()
		FCM_VoltAmp();

		// Name: User Macro, Type: User Macro: Lyssensor()
		FCM_Lyssensor();

		// Name: User Macro, Type: User Macro: Sleep()
		FCM_Sleep();

		// Name: User Macro, Type: User Macro: Touch()
		FCM_Touch();


		if ((FCV_Y < 137 && FCV_Y > 40 && FCV_X < 80 && FCV_X > 25) != 0) break;
	}

	// Name: Calculation, Type: Calculation:
	// ScreenFlag = 1
	FCV_SCREENFLAG = 1;

	// Name: Calculation, Type: Calculation:
	// LysCount = 0
	FCV_LYSCOUNT = 0;

	// Name: Calculation, Type: Calculation:
	// Y = 0
	// X = 0
	FCV_Y = 0;
	FCV_X = 0;

	// Name: User Macro, Type: User Macro: VoltAmp()
	FCM_VoltAmp();

}



/*========================================================================*\
   Use :Main
\*========================================================================*/
void app_main()
{
    // Initialize NVS
    esp_err_t ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK( ret );
	ESP_ERROR_CHECK(esp_event_loop_create_default());


	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::Initialise()
	FCD_01de1_gLCD_ILI9488_SPI1__Initialise();

	// Name: Component Macro, Type: Component Macro: XPT2046::Initialise()
	FCD_06ae1_XPT2046__Initialise();

	// Name: Component Macro, Type: Component Macro: AmbientLight1::Initialise()
	FCD_0f391_AmbientLight1__Initialise();

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetBackgroundColour(255, 0, 0)
	FCD_01de1_gLCD_ILI9488_SPI1__SetBackgroundColour(255, 0, 0);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetDisplayOrientation(1)
	FCD_01de1_gLCD_ILI9488_SPI1__SetDisplayOrientation(1);

	// Name: Output, Type: Output: 0 -> pin32
	SET_PORT_PIN(B,0,(0));

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::SetFontScaler(3, 3)
	FCD_01de1_gLCD_ILI9488_SPI1__SetFontScaler(3, 3);

	// Name: Component Macro, Type: Component Macro: gLCD_ILI9488_SPI1::ClearDisplay()
	FCD_01de1_gLCD_ILI9488_SPI1__ClearDisplay();

	// Name: Component Macro, Type: Component Macro: EpromSave=eeprom1::Read(0)
	FCV_EPROMSAVE = FCD_06651_eeprom1__Read(0);

	// Name: Component Macro, Type: Component Macro: VoltOffset=eeprom1::Read(1)
	FCV_VOLTOFFSET = FCD_06651_eeprom1__Read(1);

	// Name: Status hvilke unit output som er aktiv Unit et Adresse10, Type: Component Macro: FlagUnitOne=eeprom1::Read(10)
	FCV_FLAGUNITONE = FCD_06651_eeprom1__Read(10);

	// Name: Status hvilke unit output som er aktiv Unit et Adresse11, Type: Component Macro: FlagUnitTwo=eeprom1::Read(11)
	FCV_FLAGUNITTWO = FCD_06651_eeprom1__Read(11);

	// Name: Lys ude OFF, Type: Output: 0 -> pin25
	SET_PORT_PIN(A,25,(0));

#if 0 // Disabled code
	// Name: User Macro, Type: User Macro: Test_Out()
	FCM_Test_Out();

#endif // Disabled code

	// Name: Loop, Type: Loop: While 1
	while (1)
	{

		// Name: User Macro, Type: User Macro: FrontValg()
		FCM_FrontValg();


		if ((1) == 0) break;
	}

	mainendloop: goto mainendloop;
}



/*========================================================================*\
   Use :Interrupt
\*========================================================================*/




