Data Unit Functions

group group_smartio_functions_du

Functions

cy_en_smartio_dutr_t Cy_SmartIO_GetDuTr(SMARTIO_PRT_Type *base, cy_en_smartio_trnum_t trNum)

Gets the data unit input trigger source.

Return

Data unit input trigger source

Function Usage


    /* Refer to the Cy_SmartIO_SetDuTr function usage example */

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

  • trNum: Input trigger number

cy_en_smartio_status_t Cy_SmartIO_SetDuTr(SMARTIO_PRT_Type *base, cy_en_smartio_trnum_t trNum, cy_en_smartio_dutr_t trSrc)

Sets the data unit 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 DU TR1 needs to be updated to be sourced
       from LUT1 output */
    
    cy_en_smartio_dutr_t duTr;
    duTr = Cy_SmartIO_GetDuTr(SMARTIO_PRT8, CY_SMARTIO_TR1);
    
    if(duTr != CY_SMARTIO_DUTR_LUT1_OUT)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetDuTr(SMARTIO_PRT8, CY_SMARTIO_TR1, CY_SMARTIO_DUTR_LUT1_OUT);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

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

  • trNum: Input trigger number

  • trSrc: Input trigger source

cy_en_smartio_status_t Cy_SmartIO_SetDuTrAll(SMARTIO_PRT_Type *base, cy_en_smartio_dutr_t trSrc)

Sets all the data unit input trigger sources.

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 DU TR0, TR1 and TR2 need to be updated to be
       sourced from LUT1 output */

    Cy_SmartIO_Disable(SMARTIO_PRT8);
    Cy_SmartIO_SetDuTrAll(SMARTIO_PRT8, CY_SMARTIO_DUTR_LUT1_OUT);
    Cy_SmartIO_Enable(SMARTIO_PRT8);
    

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

  • trSrc: Input trigger source

__STATIC_INLINE cy_en_smartio_dudata_t Cy_SmartIO_GetDuData (SMARTIO_PRT_Type *base, cy_en_smartio_datanum_t dataNum)

Gets the data unit’s input “data” source.

Return

Data unit input trigger source

Function Usage


    /* Refer to the Cy_SmartIO_SetDuData function usage example */

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

  • dataNum: Input data number

cy_en_smartio_status_t Cy_SmartIO_SetDuData(SMARTIO_PRT_Type *base, cy_en_smartio_datanum_t dataNum, cy_en_smartio_dudata_t dataSrc)

Sets the data unit’s input “data” 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 DU DATA0 needs to be sourced by the values
       stored in DU DATAREG */
    
    cy_en_smartio_dudata_t duSrc;
    duSrc = Cy_SmartIO_GetDuData(SMARTIO_PRT8, CY_SMARTIO_DATA0);
    
    if(duSrc != CY_SMARTIO_DUDATA_DATAREG)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetDuData(SMARTIO_PRT8, CY_SMARTIO_DATA0, CY_SMARTIO_DUDATA_DATAREG);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

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

  • dataNum: Input data number

  • dataSrc: Data unit input trigger source

__STATIC_INLINE cy_en_smartio_duopc_t Cy_SmartIO_GetDuOpc (SMARTIO_PRT_Type *base)

Gets the data unit’s opcode.

Return

Data unit opcode

Function Usage


    /* Refer to the Cy_SmartIO_SetDuOperation function usage example */

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

__STATIC_INLINE cy_en_smartio_dusize_t Cy_SmartIO_GetDuSize (SMARTIO_PRT_Type *base)

Gets the data unit’s opcode operand bit-width.

Return

Data unit operand bit-width

Function Usage


    /* Refer to the Cy_SmartIO_SetDuOperation function usage example */

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

cy_en_smartio_status_t Cy_SmartIO_SetDuOperation(SMARTIO_PRT_Type *base, cy_en_smartio_duopc_t opcode, cy_en_smartio_dusize_t size)

Sets the data unit’s opcode and operand bit-width.

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 DU opcode needs to be updated to 8-bit wrapping
       increment and decrement counter mode. */
    
    cy_en_smartio_duopc_t opcode;
    cy_en_smartio_dusize_t size;
    opcode = Cy_SmartIO_GetDuOpc(SMARTIO_PRT8);
    size = Cy_SmartIO_GetDuSize(SMARTIO_PRT8);
    
    if((opcode != CY_SMARTIO_DUOPC_INCR_WRAP) && (size != CY_SMARTIO_DUSIZE_8))
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetDuOperation(SMARTIO_PRT8, CY_SMARTIO_DUOPC_INCR_WRAP, CY_SMARTIO_DUSIZE_8);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

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

  • opcode: Data Unit opcode

  • size: Data unit operand bit-width

__STATIC_INLINE uint8_t Cy_SmartIO_GetDataReg (SMARTIO_PRT_Type *base)

Gets the data unit’s DATA register value.

Return

DATA register value

Function Usage


    /* Refer to the Cy_SmartIO_SetDataReg function usage example */

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

cy_en_smartio_status_t Cy_SmartIO_SetDataReg(SMARTIO_PRT_Type *base, uint8_t dataReg)

Sets the data unit’s DATA register value.

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 DU DATAREG needs to be updated to 0xFF */
    
    uint8_t dataReg;
    dataReg = Cy_SmartIO_GetDataReg(SMARTIO_PRT8);
    
    if(dataReg != 0xFFu)
    {
        Cy_SmartIO_Disable(SMARTIO_PRT8);
        Cy_SmartIO_SetDataReg(SMARTIO_PRT8, 0xFFu);
        Cy_SmartIO_Enable(SMARTIO_PRT8);
    }
    

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

  • dataReg: DATA register value