/* ###################################################################
**     This component module is generated by Processor Expert. Do not modify it.
**     Filename    : G4XS1.h
**     CDE edition : Internal
**     Project     : G4XS_K64F_FreeMASTER
**     Processor   : MK64FN1M0VLQ12
**     Component   : Gen4eXtremeSwitch
**     Version     : Component 01.000, Driver 01.00, CPU db: 3.00.000
**     Repository  : My Components
**     Compiler    : GNU C Compiler
**     Date/Time   : 2016-04-07, 10:19, # CodeGen: 4
**     Abstract    :
**
**     Settings    :
**          Component Name                                 : G4XS1
**          SPI Configuration                              : Parallel SPI
**          Global Configuration                           : 
**            RSTB Link                                    : BitIO_LDD
**            RSTB Pin                                     : PTE26/ENET_1588_CLKIN/UART4_CTS_b/RTC_CLKOUT/USB_CLKIN
**            CLK Link                                     : PWM_LDD
**            External Clock Frequency                     : 50000
**            CLK Pin                                      : ADC0_SE15/PTC1/LLWU_P6/SPI0_PCS3/UART1_RTS_b/FTM0_CH0/FB_AD13/I2S0_TXD0
**            Watchdog Timeout                             : 128 ms
**            Direct Input Control                         : Disabled
**            Current, Voltage and Temperature Sensing     : Enabled
**              ADC Link                                   : AD1
**              ADC Conversion Time                        : 4.768372 µs
**              CSNS Function                              : Temperature
**              CSNS Pin                                   : ADC1_SE14/PTB10/SPI1_PCS0/UART3_RX/FB_AD19/FTM0_FLT1
**              CSNS Synchronization                       : Off
**          Devices                                        : 1
**            Device1                                      : 
**              Device Model                               : MC17XSF500
**              SPI Link                                   : SPI_Device
**              SOA Mode                                   : Single read
**              Overtemperature Warning Threshold          : 115 °C
**              HID Selection                              : Disabled
**              OCHI Type                                  : Default
**              Global PWM Duty Cycle                      : 0
**              Channels                                   : 6
**                Output1                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Pulse Skipping                       : Disabled
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Direct Input Control                   : Disabled
**                  Open Load                              : 
**                    Open Load LED                        : Disabled
**                    OLON Deglitch Time                   : 64 us
**                  Overcurrent                            : 
**                    OCLO Threshold                       : Low
**                    Advanced Current Sensing Mode        : Disabled
**                    Short OCHI                           : Disabled
**                    No OCHI                              : Disabled
**                Output2                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Pulse Skipping                       : Disabled
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Direct Input Control                   : Disabled
**                  Open Load                              : 
**                    Open Load LED                        : Disabled
**                    OLON Deglitch Time                   : 64 us
**                  Overcurrent                            : 
**                    OCLO Threshold                       : Low
**                    Advanced Current Sensing Mode        : Disabled
**                    Short OCHI                           : Disabled
**                    No OCHI                              : Disabled
**                Output3                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Pulse Skipping                       : Disabled
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Direct Input Control                   : Disabled
**                  Open Load                              : 
**                    Open Load LED                        : Disabled
**                    OLON Deglitch Time                   : 64 us
**                  Overcurrent                            : 
**                    OCLO Threshold                       : Low
**                    Advanced Current Sensing Mode        : Disabled
**                    Short OCHI                           : Disabled
**                    No OCHI                              : Disabled
**                Output4                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Pulse Skipping                       : Disabled
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Direct Input Control                   : Disabled
**                  Open Load                              : 
**                    Open Load LED                        : Disabled
**                    OLON Deglitch Time                   : 64 us
**                  Overcurrent                            : 
**                    OCLO Threshold                       : Low
**                    Advanced Current Sensing Mode        : Disabled
**                    Short OCHI                           : Disabled
**                    No OCHI                              : Disabled
**                Output5                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Pulse Skipping                       : Disabled
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Open Load                              : 
**                    Open Load LED                        : Disabled
**                    OLON Deglitch Time                   : 64 us
**                  Overcurrent                            : 
**                    OCLO Threshold                       : Low
**                    Advanced Current Sensing Mode        : Disabled
**                    Short OCHI                           : Disabled
**                    No OCHI                              : Disabled
**                Output6                                  : Enabled
**                  PWM Output Control                     : 
**                    Global PWM                           : Disabled
**                    Channel Duty Cycle                   : 0
**                    Phase Selection                      : 0
**                    Slew Rate Prescaler                  : 1
**                    Output Initial State                 : Off
**                  Open Load LED                          : Disabled
**                  OLON Deglitch Time                     : 64 us
**                  OCLO Threshold                         : Low
**                  Advanced Current Sensing Mode          : Disabled
**                  Short OCHI                             : Disabled
**                  No OCHI                                : Disabled
**          Auto Initialization                            : yes
**     Contents    :
**         Init                  - TError G4XS1_Init(TUserDataPtr UserDataPtr);
**         GetQuickStatus        - TError G4XS1_GetQuickStatus(TDeviceIdx DeviceIndex,uint16_t *StatusData);
**         GetChannelStatus      - TError G4XS1_GetChannelStatus(TDeviceIdx DeviceIndex,uint16_t *StatusData);
**         GetDeviceStatus       - TError G4XS1_GetDeviceStatus(TDeviceIdx DeviceIndex,uint16_t *StatusData);
**         GetIOStatus           - TError G4XS1_GetIOStatus(TDeviceIdx DeviceIndex,uint16_t *StatusData);
**         ReadRegister          - TError G4XS1_ReadRegister(TDeviceIdx DeviceIndex,TSORegister...
**         WriteRegister         - TError G4XS1_WriteRegister(TDeviceIdx DeviceIndex,TSIRegister...
**         FeedWatchdog          - TError G4XS1_FeedWatchdog(void);
**         SetOutputState        - TError G4XS1_SetOutputState(TDeviceIdx DeviceIndex,bool *OutputStates);
**         SetPWMDuty            - TError G4XS1_SetPWMDuty(TDeviceIdx DeviceIndex,uint8_t Channel,uint16_t Duty);
**         SetGPWMDuty           - TError G4XS1_SetGPWMDuty(TDeviceIdx DeviceIndex,uint16_t Duty);
**         SetPWMControl         - TError G4XS1_SetPWMControl(TDeviceIdx DeviceIndex,uint8_t...
**         IncrementalPWMControl - TError G4XS1_IncrementalPWMControl(TDeviceIdx DeviceIndex,TIDSign...
**         ConfigureMonitoring   - TError G4XS1_ConfigureMonitoring(TDeviceIdx DeviceIndex,TSenseMux...
**         GetSenseValue         - TError G4XS1_GetSenseValue(uint16_t *Result);
**
**     (c) Copyright <company/user-name>, 2015
**     http://www.<company>.com
**     mail: info@<company>.com
** ###################################################################*/
/*!
** @file G4XS1.h
** @version 01.00
** @brief
**
*/         
/*!
**  @addtogroup G4XS1_module G4XS1 module documentation
**  @{
*/         

#ifndef __G4XS1_H
#define __G4XS1_H

/* MODULE G4XS1. */

/* Include shared modules, which are used for whole project */
#include "Mcal.h"
/* Include inherited components */
#include "XS65_Drv/G4XS1_MC12XS6_F.h"
#include "XS65_Drv/XS65_port.h"

#ifdef __cplusplus
extern "C" {
#endif 

#ifndef __CDEUserType_TDeviceDataPtr
#define __CDEUserType_TDeviceDataPtr
typedef void* TDeviceDataPtr;          /* Device data pointer */
#endif
#ifndef __CDEUserType_TUserDataPtr
#define __CDEUserType_TUserDataPtr
typedef void* TUserDataPtr;            /* User data pointer */
#endif
#ifndef __CDEUserType_G4XS1_TDeviceIdx
#define __CDEUserType_G4XS1_TDeviceIdx
typedef enum {
	didxDEV1,
	didxDEV2,
	didxDEV3,
	didxDEV4
} G4XS1_TDeviceIdx;                    /* Device index */
#endif
#ifndef __CDEUserType_G4XS1_TSIRegister
#define __CDEUserType_G4XS1_TSIRegister
typedef enum {
	sirINIT1,
	sirINIT2,
	sirCH1_CTRL,
	sirCH2_CTRL,
	sirCH3_CTRL,
	sirCH4_CTRL,
	sirCH5_CTRL,
	sirCH6_CTRL,
	sirOUT_CTRL,
	sirGPWM_CTRL1,
	sirGPWM_CTRL2,
	sirOC_CTRL1,
	sirOC_CTRL2,
	sirIE,
	sirPRS1,
	sirPRS2,
	sirOL_CTRL,
	sirOLLED_CTRL,
	sirINC_DEC
} G4XS1_TSIRegister;                   /* Device serial input registers */
#endif
#ifndef __CDEUserType_G4XS1_TSORegister
#define __CDEUserType_G4XS1_TSORegister
typedef enum {
	sorQUICK_STATUS,
	sorCH1_STATUS,
	sorCH2_STATUS,
	sorCH3_STATUS,
	sorCH4_STATUS,
	sorCH5_STATUS,
	sorDEVICE_STATUS,
	sorIO_STATUS,
	sorDEVICE_ID
} G4XS1_TSORegister;                   /* Device serial output registers */
#endif
#ifndef __CDEUserType_G4XS1_TChannelControl
#define __CDEUserType_G4XS1_TChannelControl
typedef enum {
	ccINDIVIDUAL,
	ccGLOBAL
} G4XS1_TChannelControl;               /* Channel control types */
#endif
#ifndef __CDEUserType_G4XS1_TIDSign
#define __CDEUserType_G4XS1_TIDSign
typedef enum {
	idsPOSITIVE,
	idsNEGATIVE
} G4XS1_TIDSign;                       /* Incremental PWM control sign */
#endif
#ifndef __CDEUserType_G4XS1_TLSBStep
#define __CDEUserType_G4XS1_TLSBStep
typedef enum {
	idsNONE,
	ids4LSB,
	ids8LSB,
	ids16LSB
} G4XS1_TLSBStep;                      /* Steps for incremental PWM control */
#endif
#ifndef __CDEUserType_G4XS1_TExtClkState
#define __CDEUserType_G4XS1_TExtClkState
typedef enum {
	ecsENABLED,
	ecsDISABLED
} G4XS1_TExtClkState;                  /* External clock states */
#endif
#ifndef __CDEUserType_G4XS1_TSenseSyncTrigger
#define __CDEUserType_G4XS1_TSenseSyncTrigger
typedef enum {
	sstOFF,
	sstVALID,
	sstTRIG0,
	sstTRIG12
} G4XS1_TSenseSyncTrigger;             /* Current sense synchronization values */
#endif
#ifndef __CDEUserType_G4XS1_TSenseMux
#define __CDEUserType_G4XS1_TSenseMux
typedef enum {
	smOFF,
	smOUT1_CURRENT,
	smOUT2_CURRENT,
	smOUT3_CURRENT,
	smOUT4_CURRENT,
	smOUT5_CURRENT,
	smVBAT_MONITOR,
	smCTRL_DIE_TEMP
} G4XS1_TSenseMux;                     /* Possible outputs for monitoring */
#endif
#ifndef __CDEUserType_G4XS1_TError
#define __CDEUserType_G4XS1_TError
typedef uint8_t G4XS1_TError;          /* Error codes */
#endif

/* number of devices  */
#define G4XS1_DEV_NUM 1

/* number of registers for device with 5 channels */          
#define G4XS1_SI_NUM 19
#define G4XS1_SO_NUM 9

/* maximum number of channels for SI/SO registers */
#define G4XS1_SI_CH_MAX 6
#define G4XS1_SO_CH_MAX 5

/* maximum PWM duty value (0 - channel is disabled) */
#define G4XS1_MAX_PWM_DUTY 256

/* sets of macros for manipulation with channel mask */
#define G4XS1_CH_MASK_SET(mask, ch) (mask | (0x01 << (ch)))
#define G4XS1_CH_MASK_UNSET(mask, ch) (mask & ~(0x01 << (ch)))
#define G4XS1_CH_MASK_GET(mask, ch) (mask & (0x01 << (ch)))

/* custom errors starts at this number to prevent overlap with standard PE error codes */
#define ERR_MIN_DUTY 0xA0
#define ERR_MAX_DUTY 0xA1
#define ERR_CH_NOT_USED 0xA2

/* G4XS device data structure type */
typedef struct {
  uint16_t SIRegisters[G4XS1_DEV_NUM][G4XS1_SI_NUM]; /* serial input registers */
  uint16_t SORegister[G4XS1_DEV_NUM];            /* serial output register */
  uint16_t WDMask[G4XS1_DEV_NUM];                /* watchdog bit mask */
  uint8_t ChIndexMap[G4XS1_DEV_NUM][G4XS1_SI_CH_MAX]; /* index mapping of used channels */
  uint8_t ChUsedMask[G4XS1_DEV_NUM];             /* mask of used channels */
  uint8_t ChStateMask[G4XS1_DEV_NUM];            /* mask of state of channels (on/off) */
  G4XS1_TDeviceIdx MonitoredDevice;              /* device configured for monitoring */
  G4XS1_TSenseMux MonitoredOutput;               /* output configured for monitoring */
  TUserDataPtr UserDataPtr;                      /* the pointer to user data */
} G4XS1_TDeviceData, *G4XS1_TDeviceDataPtr;      /* device internal data */

/* pointer to device data structure (accessible because of FreeMASTER application dependency) */
extern G4XS1_TDeviceDataPtr G4XS1_DeviceDataPtr;

/*
** ===================================================================
**     Method      :  G4XS1_Init (component Gen4eXtremeSwitch)
**     @brief
**         Initializes the device according to the component properties.
**         This method writes the data gathered from the component properties 
**         into registers via SPI. When auto initialization is enabled, 
**         this method will be called automatically within PE initialization 
**         function - PE_low_level_init(). 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TUserDataPtr UserDataPtr - User data pointer 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_Init(TUserDataPtr UserDataPtr);

/*
** ===================================================================
**     Method      :  G4XS1_GetQuickStatus (component Gen4eXtremeSwitch)
**     @brief
**         Returns current status of the device.
**         Reads the quick status register which provides glance at failure overview. As long as 
**         no failure flag is set (logic 1), no control action by the microcontroller 
**         is necessary.
**         Meaning of bits in quick status register can be found in datasheet or header file. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint16_t StatusData - Pointer to variable that will be filled with 
**                           the status information. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_GetQuickStatus(G4XS1_TDeviceIdx DeviceIndex, uint16_t *StatusData);

/*
** ===================================================================
**     Method      :  G4XS1_GetChannelStatus (component Gen4eXtremeSwitch)
**     @brief
**         Gets the information of the fault for all available channels.
**         Reads information from CHx status register.
**         Meaning of bits in CHx status register can be found in datasheet or header file. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint16_t StatusData - Pointer to an array that will be filled with 
**                           the fault information. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_GetChannelStatus(G4XS1_TDeviceIdx DeviceIndex, uint16_t *StatusData);

/*
** ===================================================================
**     Method      :  G4XS1_GetDeviceStatus (component Gen4eXtremeSwitch)
**     @brief
**         Gets information on the status of the device.
**         Reads information from device status register.
**         Meaning of bits in device status register can be found in datasheet or header file. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint16_t StatusData - Pointer to variable that will be filled with 
**                           the fault information. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_GetDeviceStatus(G4XS1_TDeviceIdx DeviceIndex, uint16_t *StatusData);

/*
** ===================================================================
**     Method      :  G4XS1_GetIOStatus (component Gen4eXtremeSwitch)
**     @brief
**         Gets information on the I/O of the device.
**         Reads information from I/O status register.
**         Meaning of bits in I/O status register can be found in datasheet or header file. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint16_t StatusData - Pointer to variable that will be filled with 
**                           the fault information. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_GetIOStatus(G4XS1_TDeviceIdx DeviceIndex, uint16_t *StatusData);

/*
** ===================================================================
**     Method      :  G4XS1_send_rcv_16b (component Gen4eXtremeSwitch)
**     @brief
**         Sends and receives value of the given register via SPI. This method is 
**         by other methods to read content from a register of the device(s). 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         uint8_t sendData - Data to send. 
**         @param
**         uint16_t rcvData - Pointer to the variable for resulting data. 
**                           If there are more devices in a daisy chain, 
**                           all devices are read at once. The size of the 
**                           array must match the length of the daisy-chain 
**                           configured in component. In case there is only 
**                           single device, the size is 1. 
**         @return
**         LDD_TError      - Return values:
**                           ERR_OK - OK
**                           ERR_PARA - input value is invalid
**                           ERR_COMM - communication error
** ===================================================================
*/
G4XS1_TError G4XS1_send_rcv_16b(G4XS1_TDeviceIdx DeviceIndex, uint16_t SendData, uint16_t *RcvData);

/*
** ===================================================================
**     Method      :  G4XS1_ReadRegister (component Gen4eXtremeSwitch)
**     @brief
**         Reads value of the given register via SPI.
**         This method allows the user to read content from a register of the device(s). 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         TSORegister Register - Address of the register. 
**         @param
**         uint16_t RegVal - Pointer to the variable for resulting data. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_ReadRegister(G4XS1_TDeviceIdx DeviceIndex, G4XS1_TSORegister Register, uint16_t *RegVal);

/*
** ===================================================================
**     Method      :  G4XS1_WriteRegister (component Gen4eXtremeSwitch)
**     @brief
**         Writes value to the given register via SPI.
**         This method allows the user to set a custom value to a register of the device. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         TSIRegister Register - Address of the register. 
**         @param
**         uint16_t RegVal - Pointer to the value to be written. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_WriteRegister(G4XS1_TDeviceIdx DeviceIndex, G4XS1_TSIRegister Register, uint16_t RegVal);

/*
** ===================================================================
**     Method      :  G4XS1_FeedWatchdog (component Gen4eXtremeSwitch)
**     @brief
**         Toggles the watchdog bit in all devices to avoid watchdog timeout.
**         Watchdog is fed with every SPI write. If there is not SPI communication 
**         it is necessary to feed it before the timeout expires. The watchdog 
**         timeout depends on WD SEL bit in Intialization register 1. The 
**         timeout is either 32 ms or 128 ms. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_FeedWatchdog(void);

/*
** ===================================================================
**     Method      :  G4XS1_SetOutputState (component Gen4eXtremeSwitch)
**     @brief
**         Turns on/off channels of the device. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint8_t OutputStates - Pointer to array containing states of
**                           available channels (TRUE = enabled, FALSE = disabled). 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_SetOutputState(G4XS1_TDeviceIdx DeviceIndex, bool *OutputStates);

/*
** ===================================================================
**     Method      :  G4XS1_SetPWMDuty (component Gen4eXtremeSwitch)
**     @brief
**         Sets PWM duty for specified channel.
**         Calling this method will set PWM output immediately (if PWM is enabled).
**         This method writes PWM value into CHx register. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint8_t Channel - Output channel index. 
**         @param
**         uint16_t Duty   - PWM duty value for selected channel. The range 
**                           of the duty is 0..256, where 0 = OFF and 1 
**                           = 0.4% duty and 256 = 100%. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_SetPWMDuty(G4XS1_TDeviceIdx DeviceIndex, uint8_t Channel, uint16_t Duty);

/*
** ===================================================================
**     Method      :  G4XS1_SetGPWMDuty (component Gen4eXtremeSwitch)
**     @brief
**         Sets Global PWM duty cycle value.
**         Calling this method will set PWM output immediately (if PWM is enabled). This method writes 
**         into global register. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint16_t Duty   - Global PWM duty value for selected device. The range 
**                           of the duty is 0..256, where 0 = OFF and 1 
**                           = 0.4% duty and 256 = 100%. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_SetGPWMDuty(G4XS1_TDeviceIdx DeviceIndex, uint16_t Duty);

/*
** ===================================================================
**     Method      :  G4XS1_SetPWMControl (component Gen4eXtremeSwitch)
**     @brief
**         Sets PWM output to Global or individual PWM control. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         uint8_t Channel - Output channel index. 
**         @param
**         TChannelControl Control - Individual state of the PWM type control for 
**                           each single output. The value is ccGLOBAL 
**                           if a channel is supposed to be controlled by 
**                           global PWM register or ccINDIVIDUAL if individually. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_SetPWMControl(G4XS1_TDeviceIdx DeviceIndex, uint8_t Channel, G4XS1_TChannelControl Control);

/*
** ===================================================================
**     Method      :  G4XS1_IncrementalPWMControl (component Gen4eXtremeSwitch)
**     @brief
**         This method sets LSB step according to which the duty cycle will 
**         be incremented or decremented with every call of this method. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         TIDSign Sign    - idsPOSITIVE = increment, idsNEGATIVE = decrement. 
**         @param
**         TLSBStep LSBStep - Array for available channels with step of increment/decrement 
**                           (idsNONE, ids4LSB, ids8LSB, ids16LSB). 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_IncrementalPWMControl(G4XS1_TDeviceIdx DeviceIndex, G4XS1_TIDSign Sign, G4XS1_TLSBStep *LSBStep);

/*
** ===================================================================
**     Method      :  G4XS1_ConfigureMonitoring (component Gen4eXtremeSwitch)
**     @brief
**         Configures CSNS pin output.
**         This method sets monitored parameter and synchronization. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         TDeviceIdx DeviceIndex - Index of device (didxDEV1..4). 
**         @param
**         TSenseMux SenseMux - Measured value (CSNS pin function). 
**         @param
**         TSenseSyncTrigger Trigger - Synchronization trigger. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_ConfigureMonitoring(G4XS1_TDeviceIdx DeviceIndex, G4XS1_TSenseMux SenseMux, G4XS1_TSenseSyncTrigger Trigger);

/*
** ===================================================================
**     Method      :  G4XS1_GetSenseValue (component Gen4eXtremeSwitch)
**     @brief
**         Configures monitoring of current, voltage or temperature on the 
**         CSNS pin and returns the corresponding value from the ADC. Waits 
**         until measurement is completed. 
**     Parameters  :
**         NAME            - DESCRIPTION
**         @param
**         uint16_t Result - Pointer to variable where the measured data will be stored. 
**         @return
**         TError          - Error code, ERR_OK if successful 
** ===================================================================
*/
G4XS1_TError G4XS1_GetSenseValue(uint16_t *Result);


#ifdef __cplusplus
}  /* extern "C" */
#endif 
/* END G4XS1. */

#endif 
/* ifndef __G4XS1_H */
/*!
** @}
*/
/*
** ###################################################################
**
**     This file was created by Processor Expert 10.5 [05.21]
**     for the Freescale Kinetis series of microcontrollers.
**
** ###################################################################
*/
