本文整理汇总了C++中CY_GET_REG8函数的典型用法代码示例。如果您正苦于以下问题:C++ CY_GET_REG8函数的具体用法?C++ CY_GET_REG8怎么用?C++ CY_GET_REG8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CY_GET_REG8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ServiceUSB
//.........这里部分代码省略.........
USBFS_MIDI_IN_EP_Service();
}
}
else
{
midiInWaitTimer = MIDI_IN_EP_WAIT_TIME;
}
#endif
/* USBFS_IsConfigurationChanged() is a clear on read status update therefore, only one read of
* USBFS_IsConfigurationChanged() should ever exist in user code */
if(USBFS_IsConfigurationChanged())
{
macPC_flag = IsMacPCConnected();
#ifndef ENABLE_DIGITAL_AUDIO_IN_ONLY
/* Get Alternate setting */
altSetting[AUDIO_OUT_INTERFACE_INDEX] = (macPC_flag? USBFS_GetInterfaceSetting(1):USBFS_GetInterfaceSetting(2));
/* ByteSwap control register bit is set to 1 if alt setting 2 is selected so that
* Byte swap digital logic processes data as 16 bits. ByteSwap control register is set to 0
* if alt setting 1 is selected and byte swap processes data as 24 bits */
if (altSetting[AUDIO_OUT_INTERFACE_INDEX]==ALT_SETTING_ACTIVE_24_BIT)
{
ByteSwap_Tx_CONTROL_REG = ByteSwap_Tx_CONTROL_REG & (~ByteSwap_Tx_RES_CTRL_16);
}
else if (altSetting[AUDIO_OUT_INTERFACE_INDEX]==ALT_SETTING_ACTIVE_16_BIT)
{
ByteSwap_Tx_CONTROL_REG = ByteSwap_Tx_CONTROL_REG | ByteSwap_Tx_RES_CTRL_16;
}
/* Arming the audio out EP if it is not zero bandwidth alt setting */
if (altSetting[AUDIO_OUT_INTERFACE_INDEX]!= ALT_SETTING_ZERO_BANDWIDTH &&
(CY_GET_REG8(USBFS_SIE_EP1_CR0_PTR + ((AUDIO_OUT_ENDPOINT - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT)) & USBFS_MODE_MASK)
== USBFS_MODE_NAK_IN_OUT)
{
/* Init DMA configurations for audio OUT EP */
USBFS_ReadOutEP(AUDIO_OUT_ENDPOINT, &outRam[0], OUT_AUDIOMAXPKT);
USBFS_EnableOutEP(AUDIO_OUT_ENDPOINT);
}
#endif
#ifndef ENABLE_DIGITAL_AUDIO_OUT_ONLY
#ifndef ENABLE_DIGITAL_AUDIO_IN_ONLY
if(altSetting[AUDIO_IN_INTERFACE_INDEX] != (macPC_flag? USBFS_GetInterfaceSetting(2):USBFS_GetInterfaceSetting(3)))
{
altSetting[AUDIO_IN_INTERFACE_INDEX] = (macPC_flag? USBFS_GetInterfaceSetting(2):USBFS_GetInterfaceSetting(3));
#else
if(altSetting[AUDIO_IN_INTERFACE_INDEX] != (macPC_flag? USBFS_GetInterfaceSetting(1):USBFS_GetInterfaceSetting(2)))
{
altSetting[AUDIO_IN_INTERFACE_INDEX] = (macPC_flag? USBFS_GetInterfaceSetting(1):USBFS_GetInterfaceSetting(2));
#endif
/* Setting the ByteSwap control register bit to 0 regardless of alt setting is selected. Because audio in
* interface both the alternate settings alt setting1 and alt setting 2 both use 3 byte subframe size. */
ByteSwap_Rx_CONTROL_REG = ByteSwap_Rx_CONTROL_REG & (~ByteSwap_Rx_RES_CTRL_16);
/* Arming the audio in EP if it is not zero bandwidth alt setting */
if (altSetting[AUDIO_IN_INTERFACE_INDEX]!= ALT_SETTING_ZERO_BANDWIDTH &&
(CY_GET_REG8(USBFS_SIE_EP1_CR0_PTR + ((AUDIO_IN_ENDPOINT - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT)) & USBFS_MODE_MASK)
== USBFS_MODE_NAK_IN_OUT)
{
/* Init DMA configurations for audio IN EP */
inCnt = IN_AUDIOMAXPKT;
USBFS_LoadInEP(AUDIO_IN_ENDPOINT, &inRam[0], inCnt);
/* Pre-arm first audio IN request */
示例2: PWM_3_ReadStatusRegister
/*******************************************************************************
* Function Name: PWM_3_ReadStatusRegister
********************************************************************************
*
* Summary:
* This function returns the current state of the status register.
*
* Parameters:
* None
*
* Return:
* uint8 : Current status register value. The status register bits are:
* [7:6] : Unused(0)
* [5] : Kill event output
* [4] : FIFO not empty
* [3] : FIFO full
* [2] : Terminal count
* [1] : Compare output 2
* [0] : Compare output 1
*
*******************************************************************************/
uint8 PWM_3_ReadStatusRegister(void)
{
return (CY_GET_REG8(PWM_3_STATUS_PTR));
}
示例3: PWM_3_ReadCompare2
/*******************************************************************************
* Function Name: PWM_3_ReadCompare2
********************************************************************************
*
* Summary:
* Reads the compare value for the compare2 output.
*
* Parameters:
* None
*
* Return:
* uint8/uint16: Current compare value.
*
*******************************************************************************/
uint8 PWM_3_ReadCompare2(void)
{
return (CY_GET_REG8(PWM_3_COMPARE2_LSB_PTR));
}
示例4: PrISM_2_ReadSeed
/*******************************************************************************
* FUNCTION NAME: PrISM_2_ReadSeed
********************************************************************************
*
* Summary:
* Reads the PrISM Seed register.
*
* Parameters:
* None.
*
* Return:
* Current Period register value.
*
*******************************************************************************/
uint8 PrISM_2_ReadSeed(void)
{
return( CY_GET_REG8(PrISM_2_SEED_PTR) );
}
示例5: PrISM_2_ReadPulse1
/*******************************************************************************
* FUNCTION NAME: PrISM_2_ReadPulse1
********************************************************************************
*
* Summary:
* Reads the PrISM Pulse Density1 register.
*
* Parameters:
* None.
*
* Return:
* Pulse Density1 register value.
*
*******************************************************************************/
uint8 PrISM_2_ReadPulse1(void)
{
return( CY_GET_REG8(PrISM_2_DENSITY1_PTR) );
}
示例6: pwm_ReadKillTime
/*******************************************************************************
* Function Name: pwm_ReadKillTime
********************************************************************************
*
* Summary:
* Reads the kill time value used by the hardware when the Kill Mode is set
* to Minimum Time.
*
* Parameters:
* None
*
* Return:
* uint8: The current Minimum Time kill counts
*
*******************************************************************************/
uint8 pwm_ReadKillTime(void)
{
return (CY_GET_REG8(pwm_KILLMODEMINTIME_PTR));
}
示例7: RedGreenPrISM_ReadPolynomial
/*******************************************************************************
* FUNCTION NAME: RedGreenPrISM_ReadPolynomial
********************************************************************************
*
* Summary:
* Reads the PrISM polynomial.
*
* Parameters:
* None.
*
* Return:
* PrISM polynomial.
*
*******************************************************************************/
uint8 RedGreenPrISM_ReadPolynomial(void)
{
return( CY_GET_REG8(RedGreenPrISM_POLYNOM_PTR) );
}
示例8: PWM_BC_ReadCompare1
/*******************************************************************************
* Function Name: PWM_BC_ReadCompare1
********************************************************************************
*
* Summary:
* Reads the compare value for the compare1 output.
*
* Parameters:
* None
*
* Return:
* uint8/uint16: Current compare value.
*
*******************************************************************************/
uint8 PWM_BC_ReadCompare1(void)
{
return (CY_GET_REG8(PWM_BC_COMPARE1_LSB_PTR));
}
示例9: MainTimer_SoftwareCapture
/*******************************************************************************
* Function Name: MainTimer_SoftwareCapture
********************************************************************************
*
* Summary:
* This function forces a capture independent of the capture signal.
*
* Parameters:
* void
*
* Return:
* void
*
* Side Effects:
* An existing hardware capture could be overwritten.
*
* Reentrant
* Yes
*
*******************************************************************************/
void MainTimer_SoftwareCapture(void)
{
/* Generate a software capture by reading the counter register */
CY_GET_REG8(MainTimer_COUNTER_LSB_PTR);
/* Capture Data is now in the FIFO */
}
示例10: hallTickCounter_ReadCompare
/*******************************************************************************
* Function Name: hallTickCounter_ReadCompare
********************************************************************************
* Summary:
* Returns the compare value.
*
* Parameters:
* void:
*
* Return:
* (uint8) Present compare value.
*
*******************************************************************************/
uint8 hallTickCounter_ReadCompare(void)
{
return (CY_GET_REG8(hallTickCounter_COMPARE_LSB_PTR));
}
示例11: main
//.........这里部分代码省略.........
#ifdef SPECIAL_EDITION
disp_str("Calibration Edition",19,(64-57),64-6,FONT6X6);
#else
disp_str("Open Devices",12,(64-36),64-6,FONT6X6);
#endif
FB_update();
GPIO_Init();
DummyLoad_Init();
USBMux_Init();
I2C_Init();
PWM_Init();
ADC_Init();
uint16_t ctr=0;
for(;;)
{
char buffah[22];
uint8_t num;
float vbatvolt,vbatcur,vbusvolt,vbuscur;
I2C_Work();
vbatvolt=(float)I2C_Get_VBAT_VoltAvg() * 0.001f;
vbatcur=I2C_Get_VBAT_CurAvg();
PWM_Work(I2C_Get_VBAT_Volt(),I2C_Get_VBAT_CurRaw());
DummyLoad_Work(I2C_Get_VBAT_Volt());
ADC_Work();
uint8_t vrefok = ADC_VtargetValid();
static uint8_t oldvrefok = 2;
if( vrefok != oldvrefok ) {
if( vrefok ) {
CyPins_ClearPin(LED_Vref_0);
GPIO_SetTXDrive( 1 );
} else {
CyPins_SetPin(LED_Vref_0);
GPIO_SetTXDrive( 0 );
SIORefGen_SetValue(62); // Default 1V ref
}
oldvrefok = vrefok;
}
if(ctr == 0) {
vbusvolt=(float)I2C_Get_VBUS_Volt() * 0.001f;
vbuscur=I2C_Get_VBUS_Cur();
USBMux_UpdateMeasurements(vbusvolt,vbuscur);
num = snprintf(buffah, sizeof(buffah), "VBAT %5.2fV %6.1fmA", vbatvolt,vbatcur);
disp_str(buffah, num, 0, 8, FONT6X6);
num = snprintf(buffah, sizeof(buffah), "VBUS %5.2fV %6.1fmA", vbusvolt,vbuscur);
disp_str(buffah, num, 0, 8+6, FONT6X6);
DummyLoad_ADCWork();
float loadcur = DummyLoad_GetCur();
float loadtemp = DummyLoad_GetTemp();
num = snprintf(buffah, sizeof(buffah), "Load %5.1f` %6.1fmA", loadtemp,loadcur);
disp_str(buffah, num, 0, 8+12, FONT6X6);
float tmp = ADC_GetVoltage(VBATSENSE);
num = snprintf(buffah, sizeof(buffah), "VBAT %5.2fV", tmp);
disp_str(buffah, num, 0, 8+18, FONT6X6);
tmp = ADC_GetVoltage(USB2SENSE);
num = snprintf(buffah, sizeof(buffah), "USB2 %5.2fV", tmp);
disp_str(buffah, num, 0, 8+24, FONT6X6);
tmp = ADC_GetVoltage(USB3SENSE);
num = snprintf(buffah, sizeof(buffah), "USB3 %5.2fV", tmp);
disp_str(buffah, num, 0, 8+30, FONT6X6);
tmp = ADC_GetVoltage(VTARGETSENSE);
if( tmp > 4.5f ) { // Assume 5V, disable regulated output
CY_SET_REG8(DTMS__SIO_CFG, (CY_GET_REG8(DTMS__SIO_CFG) & 0xcf) | 0x20);
CY_SET_REG8(DTMS__SIO_DIFF, (CY_GET_REG8(DTMS__SIO_DIFF) & 0xcf) | 0x00);
CY_SET_REG8(DTMS__SIO_HYST_EN, (CY_GET_REG8(DTMS__SIO_HYST_EN) & 0xcf) | 0x00);
} else if( tmp > 0.89f ) {
float val = tmp * 255.0f / 4.096f;
if(val > 255.0f) val = 255.0f;
SIORefGen_SetValue((uint8_t)val);
CY_SET_REG8(DTMS__SIO_CFG, (CY_GET_REG8(DTMS__SIO_CFG) & 0xcf) | 0x30); // Regulated output buffer
CY_SET_REG8(DTMS__SIO_DIFF, (CY_GET_REG8(DTMS__SIO_DIFF) & 0xcf) | 0x20);
CY_SET_REG8(DTMS__SIO_HYST_EN, (CY_GET_REG8(DTMS__SIO_HYST_EN) & 0xcf) | 0x20);
}
num = snprintf(buffah, sizeof(buffah), "VTGT %5.2fV", tmp);
disp_str(buffah, num, 0, 8+36, FONT6X6);
FB_update();
UpdateCtrl();
ctr=256;
} else {
ctr--;
}
USB_Work();
}
}
示例12: LED1_ReadPulse1
/*******************************************************************************
* FUNCTION NAME: LED1_ReadPulse1
********************************************************************************
*
* Summary:
* Reads the PrISM Pulse Density1 register.
*
* Parameters:
* None.
*
* Return:
* Pulse Density1 register value.
*
*******************************************************************************/
uint8 LED1_ReadPulse1(void)
{
return( CY_GET_REG8(LED1_DENSITY1_PTR) );
}
示例13: LED1_ReadPolynomial
/*******************************************************************************
* FUNCTION NAME: LED1_ReadPolynomial
********************************************************************************
*
* Summary:
* Reads the PrISM polynomial.
*
* Parameters:
* None.
*
* Return:
* PrISM polynomial.
*
*******************************************************************************/
uint8 LED1_ReadPolynomial(void)
{
return( CY_GET_REG8(LED1_POLYNOM_PTR) );
}
示例14: LED1_ReadSeed
/*******************************************************************************
* FUNCTION NAME: LED1_ReadSeed
********************************************************************************
*
* Summary:
* Reads the PrISM Seed register.
*
* Parameters:
* None.
*
* Return:
* Current Period register value.
*
*******************************************************************************/
uint8 LED1_ReadSeed(void)
{
return( CY_GET_REG8(LED1_SEED_PTR) );
}
示例15: pwm_ReadCapture
/*******************************************************************************
* Function Name: pwm_ReadCapture
********************************************************************************
*
* Summary:
* Reads the capture value from the capture FIFO.
*
* Parameters:
* None
*
* Return:
* uint8/uint16: The current capture value
*
*******************************************************************************/
uint8 pwm_ReadCapture(void)
{
return (CY_GET_REG8(pwm_CAPTURE_LSB_PTR));
}