/******************************************************************************* * Function Name: USBFS_Resume ******************************************************************************** * * Summary: * This function enables the USBFS block after power down mode. * * Parameters: * None. * * Return: * None. * * Global variables: * USBFS_backup - checked. * * Reentrant: * No. * *******************************************************************************/ void USBFS_Resume(void) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); if(USBFS_backup.enableState != 0u) { #if(USBFS_DP_ISR_REMOVE == 0u) CyIntDisable(USBFS_DP_INTC_VECT_NUM); #endif /* USBFS_DP_ISR_REMOVE */ /* Enable USB block */ USBFS_PM_ACT_CFG_REG |= USBFS_PM_ACT_EN_FSUSB; /* Enable USB block for Standby Power Mode */ USBFS_PM_STBY_CFG_REG |= USBFS_PM_STBY_EN_FSUSB; /* Enable core clock */ USBFS_USB_CLK_EN_REG |= USBFS_USB_CLK_ENABLE; /* Enable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/ USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_REF_EN; /* The reference will be available ~40us after power restored */ CyDelayUs(40u); /* Return VRegulator*/ USBFS_CR1_REG |= USBFS_backup.mode; CyDelayUs(0u); /*~50ns delay */ /* Enable USBIO */ USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_N; CyDelayUs(2u); /* Set the USBIO pull-up enable */ USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_PULLUP_N; /* Re-init Arbiter configuration for DMA transfers */ #if(USBFS_EP_MM != USBFS__EP_MANUAL) /* Usb arb interrupt enable */ USBFS_ARB_INT_EN_REG = USBFS_ARB_INT_MASK; #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) USBFS_ARB_CFG_REG = USBFS_ARB_CFG_MANUAL_DMA; #endif /* USBFS_EP_MM == USBFS__EP_DMAMANUAL */ #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) /*Set cfg cmplt this rises DMA request when the full configuration is done */ USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM; #endif /* USBFS_EP_MM == USBFS__EP_DMAAUTO */ #endif /* USBFS_EP_MM != USBFS__EP_MANUAL */ /* STALL_IN_OUT */ CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_MODE_STALL_IN_OUT); /* Enable the SIE with a last address */ USBFS_CR0_REG |= USBFS_CR0_ENABLE; CyDelayCycles(1u); /* Finally, Enable d+ pullup and select iomode to USB mode*/ CY_SET_REG8(USBFS_USBIO_CR1_PTR, USBFS_USBIO_CR1_USBPUEN); /* Restore USB register settings */ USBFS_RestoreConfig(); } CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: USBFS_Suspend ******************************************************************************** * * Summary: * This function disables the USBFS block and prepares for power down mode. * * Parameters: * None. * * Return: * None. * * Global variables: * USBFS_backup.enable: modified. * * Reentrant: * No. * *******************************************************************************/ void USBFS_Suspend(void) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); if((CY_GET_REG8(USBFS_CR0_PTR) & USBFS_CR0_ENABLE) != 0u) { /* USB block is enabled */ USBFS_backup.enableState = 1u; #if(USBFS_EP_MM != USBFS__EP_MANUAL) USBFS_Stop_DMA(USBFS_MAX_EP); /* Stop all DMAs */ #endif /* USBFS_EP_MM != USBFS__EP_MANUAL */ /* Ensure USB transmit enable is low (USB_USBIO_CR0.ten). - Manual Transmission - Disabled */ USBFS_USBIO_CR0_REG &= (uint8)~USBFS_USBIO_CR0_TEN; CyDelayUs(0u); /*~50ns delay */ /* Disable the USBIO by asserting PM.USB_CR0.fsusbio_pd_n(Inverted) and pd_pullup_hv(Inverted) high. */ USBFS_PM_USB_CR0_REG &= (uint8)~(USBFS_PM_USB_CR0_PD_N | USBFS_PM_USB_CR0_PD_PULLUP_N); /* Disable the SIE */ USBFS_CR0_REG &= (uint8)~USBFS_CR0_ENABLE; CyDelayUs(0u); /* ~50ns delay */ /* Store mode and Disable VRegulator*/ USBFS_backup.mode = USBFS_CR1_REG & USBFS_CR1_REG_ENABLE; USBFS_CR1_REG &= (uint8)~USBFS_CR1_REG_ENABLE; CyDelayUs(1u); /* 0.5 us min delay */ /* Disable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/ USBFS_PM_USB_CR0_REG &= (uint8)~USBFS_PM_USB_CR0_REF_EN; /* Switch DP and DM terminals to GPIO mode and disconnect 1.5k pullup*/ USBFS_USBIO_CR1_REG |= USBFS_USBIO_CR1_IOMODE; /* Disable USB in ACT PM */ USBFS_PM_ACT_CFG_REG &= (uint8)~USBFS_PM_ACT_EN_FSUSB; /* Disable USB block for Standby Power Mode */ USBFS_PM_STBY_CFG_REG &= (uint8)~USBFS_PM_STBY_EN_FSUSB; CyDelayUs(1u); /* min 0.5us delay required */ } else { USBFS_backup.enableState = 0u; } CyExitCriticalSection(enableInterrupts); /* Set the DP Interrupt for wake-up from sleep mode. */ #if(USBFS_DP_ISR_REMOVE == 0u) (void) CyIntSetVector(USBFS_DP_INTC_VECT_NUM, &USBFS_DP_ISR); CyIntSetPriority(USBFS_DP_INTC_VECT_NUM, USBFS_DP_INTC_PRIOR); CyIntClearPending(USBFS_DP_INTC_VECT_NUM); CyIntEnable(USBFS_DP_INTC_VECT_NUM); #endif /* (USBFS_DP_ISR_REMOVE == 0u) */ }
/******************************************************************************* * Function Name: EzI2C_RestoreConfig ******************************************************************************** * * Summary: * The Enable wakeup from Sleep Mode selection influences this function * implementation: * Unchecked: Restores the component non-retention configuration registers * to the state they were in before I2C_Sleep() or I2C_SaveConfig() * was called. * Checked: Disables the backup regulator of the I2C hardware. Sets up the * regular component interrupt handler and generates the component * interrupt if it was wake up source to release the bus and * continue in-coming I2C transaction. * * Parameters: * None. * * Return: * None. * * Global variables: * EzI2C_backup - the non-retention registers are restored from. * * Reentrant: * No. * * Side Effects: * Calling this function before EzI2C_SaveConfig() or * EzI2C_Sleep() may produce unexpected behavior. * *******************************************************************************/ void EzI2C_RestoreConfig(void) { uint8 intState; if (0u != (EzI2C_PWRSYS_CR1_I2C_BACKUP & EzI2C_PWRSYS_CR1_REG)) /* Exit from Sleep */ { /* Disable I2C backup regulator */ intState = CyEnterCriticalSection(); EzI2C_PWRSYS_CR1_REG &= (uint8) ~EzI2C_PWRSYS_CR1_I2C_BACKUP; CyExitCriticalSection(intState); } else /* Exit from Hibernate (bit is cleared) or wakeup disabled */ { #if (EzI2C_WAKEUP_ENABLED) /* Disable power to I2C block before register restore */ intState = CyEnterCriticalSection(); EzI2C_PM_ACT_CFG_REG &= (uint8) ~EzI2C_ACT_PWR_EN; EzI2C_PM_STBY_CFG_REG &= (uint8) ~EzI2C_STBY_PWR_EN; CyExitCriticalSection(intState); /* Enable component after restore complete */ EzI2C_backup.enableState = EzI2C_ENABLED; #endif /* (EzI2C_WAKEUP_ENABLED) */ /* Restore component registers: Hibernate disable power */ EzI2C_CFG_REG = EzI2C_backup.cfg; EzI2C_XCFG_REG = EzI2C_backup.xcfg; EzI2C_ADDR_REG = EzI2C_backup.adr; EzI2C_CLKDIV1_REG = EzI2C_backup.clkDiv1; EzI2C_CLKDIV2_REG = EzI2C_backup.clkDiv2; } #if (EzI2C_WAKEUP_ENABLED) /* Set I2C interrupt to be pending if component is source of wake up */ EzI2C_DisableInt(); (void) CyIntSetVector(EzI2C_ISR_NUMBER, &EzI2C_ISR); if (0u != EzI2C_wakeupSource) { /* Generate interrupt to release I2C bus */ (void) CyIntSetPending(EzI2C_ISR_NUMBER); } EzI2C_EnableInt(); #endif /* (EzI2C_WAKEUP_ENABLED) */ }
/******************************************************************************* * Function Name: Backlight_PWM_Stop ******************************************************************************** * * Summary: * Disables the Backlight_PWM. * * Parameters: * None * * Return: * None * *******************************************************************************/ void Backlight_PWM_Stop(void) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_BLOCK_CONTROL_REG &= (uint32)~Backlight_PWM_MASK; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: Backlight_PWM_TriggerCommand ******************************************************************************** * * Summary: * Triggers the designated command to occur on the designated TCPWM instances. * The mask can be used to apply this command simultaneously to more than one * instance. This allows multiple TCPWM instances to be synchronized. * * Parameters: * mask: Combination of mask bits for each instance of the TCPWM that the * command should apply to. This function from one instance can be used * to apply the command to any of the instances in the design. * The mask value for a specific instance is available with the MASK * define. * command: Enumerated command values. Capture command only applicable for * Timer/Counter with Capture and PWM modes. * Values: * - Backlight_PWM_CMD_CAPTURE - Trigger Capture command * - Backlight_PWM_CMD_RELOAD - Trigger Reload command * - Backlight_PWM_CMD_STOP - Trigger Stop command * - Backlight_PWM_CMD_START - Trigger Start command * * Return: * None * *******************************************************************************/ void Backlight_PWM_TriggerCommand(uint32 mask, uint32 command) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_COMMAND_REG = ((uint32)(mask << command)); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_Stop ******************************************************************************** * * Summary: * Disables the TILT. * * Parameters: * None * * Return: * None * *******************************************************************************/ void TILT_Stop(void) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_BLOCK_CONTROL_REG &= (uint32)~TILT_MASK; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: MessageReceived_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. Note calling MessageReceived_Start * or MessageReceived_StartEx will override any effect this method would * have had. This method should only be called after MessageReceived_Start or * MessageReceived_StartEx has been called. To set the initial * priority for the component use the cydwr file in the tool. * * Parameters: * priority: Priority of the interrupt. 0 - 3, 0 being the highest. * * Return: * None * *******************************************************************************/ void MessageReceived_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((MessageReceived__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *MessageReceived_INTC_PRIOR = (*MessageReceived_INTC_PRIOR & (uint32)(~MessageReceived__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: PhaseCounter_Intr_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling PhaseCounter_Intr_Start or PhaseCounter_Intr_StartEx will * override any effect this API would have had. This API should only be called * after PhaseCounter_Intr_Start or PhaseCounter_Intr_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void PhaseCounter_Intr_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((PhaseCounter_Intr__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *PhaseCounter_Intr_INTC_PRIOR = (*PhaseCounter_Intr_INTC_PRIOR & (uint32)(~PhaseCounter_Intr__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: start_int_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling start_int_Start or start_int_StartEx will * override any effect this API would have had. This API should only be called * after start_int_Start or start_int_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void start_int_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((start_int__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *start_int_INTC_PRIOR = (*start_int_INTC_PRIOR & (uint32)(~start_int__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: XBEE_RX_INT_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling XBEE_RX_INT_Start or XBEE_RX_INT_StartEx will * override any effect this API would have had. This API should only be called * after XBEE_RX_INT_Start or XBEE_RX_INT_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void XBEE_RX_INT_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((XBEE_RX_INT__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *XBEE_RX_INT_INTC_PRIOR = (*XBEE_RX_INT_INTC_PRIOR & (uint32)(~XBEE_RX_INT__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
void Tuner_RunTuner(void) { uint8 interruptState; uint8 suspended = 0; uint16 command; uint16 previousCompleteBit; /* COMPLETE_BIT in tunerCmd at time of last send to tuner host */ Tuner_SendBuffer(); /* Handle suspend command to avoid deadlock later in CapSense_RunTuner */ do { Tuner_RefreshBuffer(); interruptState = CyEnterCriticalSection(); /* Avoid ints between read and modify tunerCmd */ command = CapSense_dsRam.tunerCmd; switch (command) { case CapSense_TU_CMD_SUSPEND_E: suspended = 1; CapSense_dsRam.tunerCmd |= CapSense_TU_CMD_COMPLETE_BIT; CyExitCriticalSection(interruptState); /* Enable ints during SendBuffer */ Tuner_SendBuffer(); /* Send buffer with updated COMPLETE_BIT to tuner host */ interruptState = CyEnterCriticalSection(); break; case CapSense_TU_CMD_RESUME_E: case CapSense_TU_CMD_RESTART_E: case CapSense_TU_CMD_RUN_SNR_TEST_E: suspended = 0; break; default: break; } CyExitCriticalSection(interruptState); } while (suspended); previousCompleteBit = CapSense_dsRam.tunerCmd & CapSense_TU_CMD_COMPLETE_BIT; CapSense_RunTuner(); if ( previousCompleteBit != (CapSense_dsRam.tunerCmd & CapSense_TU_CMD_COMPLETE_BIT) ) Tuner_SendBuffer(); /* Send buffer with updated COMPLETE_BIT to tuner host */ }
/******************************************************************************* * Function Name: CYBLE_bless_isr_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling CYBLE_bless_isr_Start or CYBLE_bless_isr_StartEx will * override any effect this API would have had. This API should only be called * after CYBLE_bless_isr_Start or CYBLE_bless_isr_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void CYBLE_bless_isr_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((CYBLE_bless_isr__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *CYBLE_bless_isr_INTC_PRIOR = (*CYBLE_bless_isr_INTC_PRIOR & (uint32)(~CYBLE_bless_isr__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: I2S_DisableRx ******************************************************************************** * * Summary: * Disables the Rx direction of the I2S interface. * * Parameters: * None. * * Return: * None. * *******************************************************************************/ void I2S_DisableRx(void) { uint8 enableInterrupts; I2S_CONTROL_REG &= ((uint8) ~I2S_RX_EN); enableInterrupts = CyEnterCriticalSection(); I2S_RX_STATUS_AUX_CONTROL_REG &= ((uint8) ~I2S_RX_INT_EN); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: I2S_Enable ******************************************************************************** * * Summary: * Enables I2S interface. * * Parameters: * None. * * Return: * None. * *******************************************************************************/ void I2S_Enable(void) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); I2S_AUX_CONTROL_REG |= I2S_CNTR7_EN; CyExitCriticalSection(enableInterrupts); I2S_CONTROL_REG |= I2S_EN; }
/******************************************************************************* * Function Name: Ramp_LED_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling Ramp_LED_Start or Ramp_LED_StartEx will * override any effect this API would have had. This API should only be called * after Ramp_LED_Start or Ramp_LED_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void Ramp_LED_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((Ramp_LED__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *Ramp_LED_INTC_PRIOR = (*Ramp_LED_INTC_PRIOR & (uint32)(~Ramp_LED__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: I2S_EnableRx ******************************************************************************** * * Summary: * Enables the Rx direction of the I2S interface. At the next word * select falling edge reception of data will begin. * * Parameters: * None. * * Return: * None. * *******************************************************************************/ void I2S_EnableRx(void) { uint8 enableInterrupts; I2S_CONTROL_REG |= I2S_RX_EN; enableInterrupts = CyEnterCriticalSection(); I2S_RX_STATUS_AUX_CONTROL_REG |= I2S_RX_INT_EN; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: console_SCB_IRQ_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling console_SCB_IRQ_Start or console_SCB_IRQ_StartEx will * override any effect this API would have had. This API should only be called * after console_SCB_IRQ_Start or console_SCB_IRQ_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void console_SCB_IRQ_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((console_SCB_IRQ__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *console_SCB_IRQ_INTC_PRIOR = (*console_SCB_IRQ_INTC_PRIOR & (uint32)(~console_SCB_IRQ__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: isr_10ms_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling isr_10ms_Start or isr_10ms_StartEx will * override any effect this API would have had. This API should only be called * after isr_10ms_Start or isr_10ms_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void isr_10ms_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((isr_10ms__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *isr_10ms_INTC_PRIOR = (*isr_10ms_INTC_PRIOR & (uint32)(~isr_10ms__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: messageTimerInterrupt_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. Note calling messageTimerInterrupt_Start * or messageTimerInterrupt_StartEx will override any effect this method would * have had. This method should only be called after messageTimerInterrupt_Start or * messageTimerInterrupt_StartEx has been called. To set the initial * priority for the component use the cydwr file in the tool. * * Parameters: * priority: Priority of the interrupt. 0 - 3, 0 being the highest. * * Return: * None * *******************************************************************************/ void messageTimerInterrupt_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((messageTimerInterrupt__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *messageTimerInterrupt_INTC_PRIOR = (*messageTimerInterrupt_INTC_PRIOR & (uint32)(~messageTimerInterrupt__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: ADC_SAR_SEQ_IRQ_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling ADC_SAR_SEQ_IRQ_Start or ADC_SAR_SEQ_IRQ_StartEx will * override any effect this API would have had. This API should only be called * after ADC_SAR_SEQ_IRQ_Start or ADC_SAR_SEQ_IRQ_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void ADC_SAR_SEQ_IRQ_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((ADC_SAR_SEQ_IRQ__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *ADC_SAR_SEQ_IRQ_INTC_PRIOR = (*ADC_SAR_SEQ_IRQ_INTC_PRIOR & (uint32)(~ADC_SAR_SEQ_IRQ__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: StripLights_cisr_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling StripLights_cisr_Start or StripLights_cisr_StartEx will * override any effect this API would have had. This API should only be called * after StripLights_cisr_Start or StripLights_cisr_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void StripLights_cisr_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((StripLights_cisr__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *StripLights_cisr_INTC_PRIOR = (*StripLights_cisr_INTC_PRIOR & (uint32)(~StripLights_cisr__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: battery_charging_isr_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling battery_charging_isr_Start or battery_charging_isr_StartEx will * override any effect this API would have had. This API should only be called * after battery_charging_isr_Start or battery_charging_isr_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void battery_charging_isr_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((battery_charging_isr__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *battery_charging_isr_INTC_PRIOR = (*battery_charging_isr_INTC_PRIOR & (uint32)(~battery_charging_isr__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: Count7_Stop ******************************************************************************** * * Summary: * Disables the software enable of the counter. * * Parameters: * None * * Return: * None * *******************************************************************************/ void Count7_Stop(void) { uint8 interruptState; interruptState = CyEnterCriticalSection(); /* Clear the counter start bit in auxiliary control. */ Count7_AUX_CONTROL_REG &= (uint8) ~((uint8) Count7_COUNTER_START); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: Button_ISR_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling Button_ISR_Start or Button_ISR_StartEx will * override any effect this API would have had. This API should only be called * after Button_ISR_Start or Button_ISR_StartEx has been called. * To set the initial priority for the component, use the Design-Wide Resources * Interrupt Editor. * * Note This API has no effect on Non-maskable interrupt NMI). * * Parameters: * priority: Priority of the interrupt, 0 being the highest priority * PSoC 3 and PSoC 5LP: Priority is from 0 to 7. * PSoC 4: Priority is from 0 to 3. * * Return: * None * *******************************************************************************/ void Button_ISR_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((Button_ISR__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *Button_ISR_INTC_PRIOR = (*Button_ISR_INTC_PRIOR & (uint32)(~Button_ISR__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: Backlight_PWM_SetPWMInvert ******************************************************************************** * * Summary: * Writes the bits that control whether the line and line_n outputs are * inverted from their normal output values. This functionality is only * applicable to the three PWM modes. * * Parameters: * mask: Mask of outputs to invert. * Values: * - Backlight_PWM_INVERT_LINE - Inverts the line output * - Backlight_PWM_INVERT_LINE_N - Inverts the line_n output * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetPWMInvert(uint32 mask) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_CONTROL_REG &= (uint32)~Backlight_PWM_INV_OUT_MASK; Backlight_PWM_CONTROL_REG |= mask; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: Backlight_PWM_SetPrescaler ******************************************************************************** * * Summary: * Sets the prescaler value that is applied to the clock input. Not applicable * to PWM with dead time mode or Quadrature Decoder mode. * * Parameters: * prescaler: Prescaler divider value * Values: * - Backlight_PWM_PRESCALE_DIVBY1 - Divide by 1 (no prescaling) * - Backlight_PWM_PRESCALE_DIVBY2 - Divide by 2 * - Backlight_PWM_PRESCALE_DIVBY4 - Divide by 4 * - Backlight_PWM_PRESCALE_DIVBY8 - Divide by 8 * - Backlight_PWM_PRESCALE_DIVBY16 - Divide by 16 * - Backlight_PWM_PRESCALE_DIVBY32 - Divide by 32 * - Backlight_PWM_PRESCALE_DIVBY64 - Divide by 64 * - Backlight_PWM_PRESCALE_DIVBY128 - Divide by 128 * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetPrescaler(uint32 prescaler) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_CONTROL_REG &= (uint32)~Backlight_PWM_PRESCALER_MASK; Backlight_PWM_CONTROL_REG |= prescaler; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: CySpcStart ******************************************************************************** * Summary: * Starts the SPC. * * Parameters: * None * * Return: * None * *******************************************************************************/ void CySpcStart(void) { /* Save current global interrupt enable and disable it */ uint8 interruptState = CyEnterCriticalSection(); CY_SPC_PM_ACT_REG |= PM_SPC_PM_EN; CY_SPC_PM_STBY_REG |= PM_SPC_PM_EN; /* Restore global interrupt enable state */ CyExitCriticalSection(interruptState); }
/******************************************************************************* * Function Name: Backlight_PWM_SetCaptureMode ******************************************************************************** * * Summary: * Sets the capture trigger mode. For PWM mode this is the switch input. * This input is not applicable to the Timer/Counter without Capture and * Quadrature Decoder modes. * * Parameters: * triggerMode: Enumerated trigger mode value * Values: * - Backlight_PWM_TRIG_LEVEL - Level * - Backlight_PWM_TRIG_RISING - Rising edge * - Backlight_PWM_TRIG_FALLING - Falling edge * - Backlight_PWM_TRIG_BOTH - Both rising and falling edge * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetCaptureMode(uint32 triggerMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_TRIG_CONTROL1_REG &= (uint32)~Backlight_PWM_CAPTURE_MASK; Backlight_PWM_TRIG_CONTROL1_REG |= triggerMode; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: Backlight_PWM_SetCompareSwap ******************************************************************************** * * Summary: * Writes the register that controls whether the compare registers are * swapped. When enabled in Timer/Counter mode(without capture) the swap occurs * at a TC event. In PWM mode the swap occurs at the next TC event following * a hardware switch event. * * Parameters: * swapEnable * Values: * - 0 - Disable swap * - 1 - Enable swap * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetCompareSwap(uint32 swapEnable) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_CONTROL_REG &= (uint32)~Backlight_PWM_RELOAD_CC_MASK; Backlight_PWM_CONTROL_REG |= (swapEnable & Backlight_PWM_1BIT_MASK); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: Backlight_PWM_SetCounterMode ******************************************************************************** * * Summary: * Sets the counter mode. Applicable to all modes except Quadrature Decoder * and PWM with pseudo random output. * * Parameters: * counterMode: Enumerated couner type values * Values: * - Backlight_PWM_COUNT_UP - Counts up * - Backlight_PWM_COUNT_DOWN - Counts down * - Backlight_PWM_COUNT_UPDOWN0 - Counts up and down. Terminal count * generated when counter reaches 0 * - Backlight_PWM_COUNT_UPDOWN1 - Counts up and down. Terminal count * generated both when counter reaches 0 * and period * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetCounterMode(uint32 counterMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_CONTROL_REG &= (uint32)~Backlight_PWM_UPDOWN_MASK; Backlight_PWM_CONTROL_REG |= counterMode; CyExitCriticalSection(enableInterrupts); }