/* readme.txt for FlexIO 8080 LCD demo */

1. Overview
This FlexIO 8080 demo is a simple demonstration program that uses the FlexIO peripheral to
emulate 8080 bus and to drive a LCD module with HX8357 driver IC.


2. Directories and files
(1) \iar - IAR project files.
(2) \source - source files.
     |- board               - board related files
     |  |- board.c
     |  |- board.h
     |  |- clock_config.c
     |  |- clock_config.h
     |  |- pin_mux.c
     |  `- pin_mux.h
     |- graph               - graphic displaying files
     |  |- draw_house       - drawing some simple shapes
     |  |- draw_house       - header file of the shapes drawing
     |  |- logo_echo.c      - realizing a image moving animation
     |  |- logo_echo.h      - header file of the image moving
     |  |- pic_hex_data     - hex data of some images
     |  |- pic_hex_data     - header file of the image data
     |  |- zoo_rotate       - displaying some images
     |  `- zoo_rotate       - header file of the image displaying
     |- flexio_8080_drv.c   - FlexIO 8080 driver source file
     |- flexio_8080_drv.h   - FlexIO 8080 driver header file
     |- lcd_hx8357_drv.c    - LCD HX8357 driver source file
     |- lcd_hx8357_drv.h    - LCD HX8357 driver header file
     `- main.c              - the main file


3. FlexIO 8080 driver functions
These driver functions are located in /source/flexio_8080_drv.c.

    void FLEXIO_8080_SglBeatWR_1Prm(uint32_t const cmdIdx, uint16_t const value)
    Function: Write command with single parameter in single-beat writing mode using polling method.
    Parameter: cmdIdx - command index
    Parameter: value - command value

    void FLEXIO_8080_SglBeatWR_nPrm(uint32_t const cmdIdx, uint16_t const * buffer, uint32_t const length)
    Function: Write command with multi parameters in single-beat writing mode using polling method.
    Parameter: cmdIdx - command index
    Parameter: buffer - buffer used to store command value
    Parameter: length - command size

    void FLEXIO_8080_SglBeatWR_nSamePrm(uint32_t const cmdIdx, uint16_t const value, uint32_t const length)
    Function: Write command with multi repeated parameters in single-beat writing mode using polling method.
              It is used to fill LCD module with solid color.
    Parameter: cmdIdx - command index
    Parameter: value - command value
    Parameter: length - command size

    uint16_t FLEXIO_8080_SglBeatRD_1Prm(uint32_t const cmdIdx)
    Function: Read command with single parameter in single-beat reading mode using polling method.
    Parameter: cmdIdx - command index
    return - the reading result

    void FLEXIO_8080_SglBeatRD_nPrm(uint32_t const cmdIdx, uint16_t * buffer, uint32_t const length)
    Function: Read command with multi parameters in single-beat reading mode using polling method.
    Parameter: cmdIdx - command index
    Parameter: buffer - buffer used to store command value
    Parameter: length - command size

    void FLEXIO_8080_MulBeatWR(uint32_t const cmdIdx, uint16_t const * buffer, uint32_t const length)
    Function: Write command with multi parameters in multi-beat writing mode using DMA method.
              The total transfer size is configured in the DMA configuration function.
    Parameter: cmdIdx - command index
    Parameter: buffer - buffer used to store command value
    Parameter: length - command size

    void FLEXIO_8080_MulBeatWR(uint32_t const cmdIdx, uint16_t * buffer, uint32_t const length)
    Function: Read command with multi parameters in multi-beat reading mode using DMA method.
              The total transfer size is configured in the DMA configuration function.
    Parameter: cmdIdx - command index
    Parameter: buffer - buffer used to store command value
    Parameter: length - command size


4. FlexIO configurations
There are lots of options for you to configure FlexIO to emulate 8080 bus, such as different bus width,
baud rate, the number of the concatenated shifters, which specific shifters, pins, and timer to use,
and so forth. You need to set up proper configurations based on your application requirement.
The default configurations are realized in /source/flexio_8080_drv.c:
    void FLEXIO_8080_Type_GetDefaultConfig(void)
    static void FLEXIO_8080_SglBeatWR_GetRegConfig(flexio_8080_SglBeat_reg_config_t * reg_config)
    static void FLEXIO_8080_SglBeatRD_GetRegConfig(flexio_8080_SglBeat_reg_config_t * reg_config)
    static void FLEXIO_8080_MulBeatWR_GetRegConfig(flexio_8080_MulBeatWR_reg_config_t * reg_config)
    static void FLEXIO_8080_MulBeatRD_GetRegConfig(flexio_8080_MulBeatRD_reg_config_t * reg_config)


5. Hardware connections
This demo is designed to run on TWR-KL28Z72M development board and a LCD module with HX8357.
Following are some hardware connections for this demo.
        ----------------------------------------------------------------------
        FlexIO Pin | PORT Pin  |   Board header          |    LCD module
        ----------------------------------------------------------------------
        FlexIO D0  --- PTD0  --- TWR-KL28Z72M J26-0  <------->    D0
        FlexIO D1  --- PTD1  --- TWR-KL28Z72M J26-1  <------->    D1
        FlexIO D2  --- PTD2  --- TWR-KL28Z72M J26-2  <------->    D2
        FlexIO D3  --- PTD3  --- TWR-KL28Z72M J26-3  <------->    D3
        FlexIO D4  --- PTD4  --- TWR-KL28Z72M J26-4  <------->    D4
        FlexIO D5  --- PTD5  --- TWR-KL28Z72M J26-5  <------->    D5
        FlexIO D6  --- PTD6  --- TWR-KL28Z72M J26-6  <------->    D6
        FlexIO D7  --- PTD7  --- TWR-KL28Z72M J26-7  <------->    D7
        FlexIO D8  --- PTB0  --- TWR-KL28Z72M J26-8  <------->    D8
        FlexIO D9  --- PTB1  --- TWR-KL28Z72M J26-9  <------->    D9
        FlexIO D10 --- PTB2  --- TWR-KL28Z72M J26-10 <------->    D10
        FlexIO D11 --- PTB3  --- TWR-KL28Z72M J26-11 <------->    D11
        FlexIO D12 --- PTB8  --- TWR-KL28Z72M J26-12 <------->    D12
        FlexIO D13 --- PTB9  --- TWR-KL28Z72M J26-13 <------->    D13
        FlexIO D14 --- PTB10 --- TWR-KL28Z72M J26-14 <------->    D14
        FlexIO D15 --- PTB11 --- TWR-KL28Z72M J26-15 <------->    D15
        FlexIO D16 --- PTB16 --- TWR-KL28Z72M J26-16  ------->    WR
        FlexIO D17 --- PTB17 --- TWR-KL28Z72M J26-17  ------->    RD
        ----------------------------------------------------------------------
                  GPIO PTB18 --- TWR-KL28Z72M J26-18  ------->    CS
                  GPIO PTB19 --- TWR-KL28Z72M J26-19  ------->    RS
        ----------------------------------------------------------------------
                                 TWR-KL28Z72M J12-4   -------     3V3
                                 TWR-KL28Z72M J12-6   -------     GND
        ----------------------------------------------------------------------

6. Run the demo
  (1) Make the connections listed above by using external wires.
  (2) Take a mini-B USB cable and plug one end into your computer USB port,
      and the other end into the TWR-KL28Z72M mini-B port labeled "SDA USB".
  (3) Open the project file, and configure the debug driver based on your debugger type.
  (4) Build, download and run the program.
  (5) Press "SW2" on the board to switch the displaying modes.

/*EOF*/
