LUT Functions

group group_smartio_functions_lut

Functions

cy_en_smartio_luttr_t Cy_SmartIO_GetLutTr(SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum, cy_en_smartio_trnum_t trNum)

Gets the specified LUT input trigger source.

Return

LUT input trigger source

Function Usage


    /* Refer to the Cy_SmartIO_SetLutTr() function usage example */

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

  • trNum: Input trigger number

cy_en_smartio_status_t Cy_SmartIO_SetLutTr(SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum, cy_en_smartio_trnum_t trNum, cy_en_smartio_luttr_t trSrc)

Sets the specified LUT input trigger source.

note

The Smart I/O block must be disabled before calling this function.

Return

Status of the operation

Function Usage


    #define ioss_0_port_8_smartio_0_HW SMARTIO_PRT8
    
    /* Scenario: Smart I/O block 8 LUT1 TR0 needs to change to be sourced
       from I/O 1 */
    
    cy_en_smartio_luttr_t lut1Tr0;
    lut1Tr0 = Cy_SmartIO_GetLutTr(SMARTIO_PRT8, CY_SMARTIO_LUT1, CY_SMARTIO_TR0);
    
    if(lut1Tr0 != CY_SMARTIO_LUTTR_IO1)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetLutTr(SMARTIO_PRT8, CY_SMARTIO_LUT1, CY_SMARTIO_TR0, CY_SMARTIO_LUTTR_IO1);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

  • trNum: Input trigger number

  • trSrc: Input trigger source

cy_en_smartio_status_t Cy_SmartIO_SetLutTrAll(SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum, cy_en_smartio_luttr_t trSrc)

Sets all LUT input triggers to the same source.

note

The Smart I/O block must be disabled before calling this function.

Return

Status of the operation

Function Usage


    #define ioss_0_port_8_smartio_0_HW SMARTIO_PRT8
    
    /* Scenario: Smart I/O block 8 LUT1 TR0, TR1 and TR2 need to change to be
       sourced from LUT output 2 */
    
    Cy_SmartIO_Disable(SMARTIO_PRT8);
    Cy_SmartIO_SetLutTrAll(SMARTIO_PRT8, CY_SMARTIO_LUT1, CY_SMARTIO_LUTTR_LUT2_OUT);
    Cy_SmartIO_Enable(SMARTIO_PRT8);
    

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

  • trSrc: Input trigger source

__STATIC_INLINE cy_en_smartio_lutopc_t Cy_SmartIO_GetLutOpcode (SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum)

Gets the opcode of the specified LUT.

Return

LUT opcode

Function Usage


    /* Refer to the Cy_SmartIO_SetLutOpcode function usage example */

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

cy_en_smartio_status_t Cy_SmartIO_SetLutOpcode(SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum, cy_en_smartio_lutopc_t opcode)

Sets the opcode of the specified LUT.

note

The Smart I/O block must be disabled before calling this function.

Return

Status of the operation

Function Usage


    #define ioss_0_port_8_smartio_0_HW SMARTIO_PRT8
    
    /* Scenario: Smart I/O block 8 LUT1 op-code needs to be updated to combinatorial mode */
    
    cy_en_smartio_lutopc_t opcode;
    opcode = Cy_SmartIO_GetLutOpcode(SMARTIO_PRT8, CY_SMARTIO_LUT1);
    
    if(opcode != CY_SMARTIO_LUTOPC_COMB)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetLutOpcode(SMARTIO_PRT8, CY_SMARTIO_LUT1, CY_SMARTIO_LUTOPC_COMB);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

  • opcode: LUT opcode

__STATIC_INLINE uint8_t Cy_SmartIO_GetLutMap (SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum)

Gets the 3:1 truth table of the specified LUT.

tr2

tr1

tr0

lutNum

0

0

0

bit 0

0

0

1

bit 1

0

1

0

bit 2

0

1

1

bit 3

1

0

0

bit 4

1

0

1

bit 5

1

1

0

bit 6

1

1

1

bit 7

Return

Bitfield [7:0] mapping of the 3:1 LUT

Function Usage


    /* Refer to the Cy_SmartIO_SetLutMap function usage example */

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

cy_en_smartio_status_t Cy_SmartIO_SetLutMap(SMARTIO_PRT_Type *base, cy_en_smartio_lutnum_t lutNum, uint8_t lutMap)

Sets the 3 bit input to 1 bit output mapping of the specified LUT.

tr2

tr1

tr0

lutMap

0

0

0

bit 0

0

0

1

bit 1

0

1

0

bit 2

0

1

1

bit 3

1

0

0

bit 4

1

0

1

bit 5

1

1

0

bit 6

1

1

1

bit 7

note

The Smart I/O block must be disabled before calling this function.

Return

Status of the operation

Function Usage


    #define ioss_0_port_8_smartio_0_HW SMARTIO_PRT8
    
    /* Scenario: Smart I/O block 8 LUT1 mapping needs to be updated to produce a
       1 when all TR0, TR1 and TR2 inputs are 0. */
    
    uint8_t lutMap;
    lutMap = Cy_SmartIO_GetLutMap(SMARTIO_PRT8, CY_SMARTIO_LUT1);
    
    if(lutMap != 0x01u)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetLutMap(SMARTIO_PRT8, CY_SMARTIO_LUT1, 0x01u);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

Parameters
  • base: Pointer to the Smart I/O base address

  • lutNum: LUT index number

  • lutMap: Bitfield [7:0] mapping of the 3:1 LUT