DESCRIPTION:
DALICG02_Example3_XMC12: This example demonstrates DALI control gear (IEC 62386-102) functionality using DALICG02. It can be used
as a getting started example or in hands-on trainings. All DALI commands are supported. However, only DALI Fade Time 0-7 are
supported. Additional code is needed for full DALI Fade Time support and will be covered in other DALICG02 examples.
The XMC1200 Boot Kit, combined with the White LED card, acts as the DALI control gear. This example is created for demonstration 
with the Tridonic DALI USB as the DALI control device. However, any other DALI master can be used too.
PRNG01 app is used in this example for random addressing.
FEE001 app is used in this example for storing variables in persistent memory.
WHITELAMP01 app is also used in this example for driving the LEDs on the White LED card.

REQUIREMENTS:
- J-Link Drivers installed on PC
- J-Link v4.59 or above
- DALI Control Gear:
  - XMC1200 Boot Kit + White LED Card
- DALI Control Device:
  - Tridonic DALI USB (http://www.tridonic.com/com/en/products/2622.asp) +
    Tridonic DALI PS1 (http://www.tridonic.com/com/en/products/2626.asp) +
    masterCONFIGURATOR(http://www.tridonic.com/com/en/software-masterconfigurator.asp)
    or any other DALI control device

SETUP:
- Connect White LED Card to XMC1200 Boot Kit
- Remove resistor beside LED on P0.2 on the XMC1200 Boot Kit
- Wire the 2 DALI communication lines from the DALI control device to DALI port on White LED Card

HOW TO CREATE THE PROJECT:
1) Instantiate the WHITELAMP01, DALICG01, PRNG01 and FEE01 Apps from App Selection View. 

2) In the WHITELAMP01 UI select 4 Channels and Dimming Engine as Source of Dimming.

3) In each of the BCCUCH01 UIs, enable channel at initialization and flicker watchdog in the Channel Configuration tab.
   In the Intensity and Packer Configuration tab, set channel intensity to 4095 (100%).
    
4) In BCCUDIM01 UI, enable dimming engine at initialization.

5) In BCCUGLOBAL UI, set the FCLK frequency to 1 MHZ and the Flicker Watchdog ON-bit insertion threshold to 1000 (0.1 %).

6) In CLK002 UI, set MCLK to 32000 kHz and PCLK = 2*MCLK in the Clock Configuration tab.

7) In DALICG01 UI, select Control Gear protocol.

8) In MANC01 select Encoding technique as Using IO and system app, 
   Bit rate = 1200 Hz, Minimum valid bit rate = 600 Hz, Maximum valid bit rate = 1800 Hz,
   Encode bit = 8 bits, Decode bit = 16 bits.
   
9) In PRNG01 UI, select Byte as Random Data Block Size.

10) In FEE001 UI, set FEE Total Size as 2048 bytes. Enable EraseAll feature.
    In the Block Configuration tab, set the no. of Blocks Required to 3.
    Set Block1 Id as 1 and Block1 Size as 256.
    Set Block2 Id as 2 and Block2 Size as 256.
    Set Block3 Id as 3 and Block3 Size as 30.
   
11) Map Manual Pin Assignment:
   - BCCUCH0/0 to P0.5
   - BCCUCH0/1 to P0.6
   - BCCUCH0/2 to P0.7
   - BCCUCH0/3 to P0.8
   - MANC01/0 captureinput pin to P0.2 
   - IO004/0 pin to P0.3 (encoder pin)
   
OBSERVATIONS:
Send commands from the DALI Control Device to the DALI Control Gear.
DALI Control Gear should respond accordingly (via LED brightness change or answer on Control Device UI)