/******************************************************************************* * 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: UART_SCB_IRQ_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling UART_SCB_IRQ_Start or UART_SCB_IRQ_StartEx will * override any effect this API would have had. This API should only be called * after UART_SCB_IRQ_Start or UART_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 UART_SCB_IRQ_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((UART_SCB_IRQ__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *UART_SCB_IRQ_INTC_PRIOR = (*UART_SCB_IRQ_INTC_PRIOR & (uint32)(~UART_SCB_IRQ__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: isr_Rx_1_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling isr_Rx_1_Start or isr_Rx_1_StartEx will * override any effect this API would have had. This API should only be called * after isr_Rx_1_Start or isr_Rx_1_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_Rx_1_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((isr_Rx_1__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *isr_Rx_1_INTC_PRIOR = (*isr_Rx_1_INTC_PRIOR & (uint32)(~isr_Rx_1__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
/******************************************************************************* * 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: 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: Filter_Reset_ISR_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling Filter_Reset_ISR_Start or Filter_Reset_ISR_StartEx will * override any effect this API would have had. This API should only be called * after Filter_Reset_ISR_Start or Filter_Reset_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 Filter_Reset_ISR_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((Filter_Reset_ISR__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *Filter_Reset_ISR_INTC_PRIOR = (*Filter_Reset_ISR_INTC_PRIOR & (uint32)(~Filter_Reset_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: BLE_1_bless_isr_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling BLE_1_bless_isr_Start or BLE_1_bless_isr_StartEx will * override any effect this API would have had. This API should only be called * after BLE_1_bless_isr_Start or BLE_1_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 BLE_1_bless_isr_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((BLE_1_bless_isr__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *BLE_1_bless_isr_INTC_PRIOR = (*BLE_1_bless_isr_INTC_PRIOR & (uint32)(~BLE_1_bless_isr__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: TimerDelay_Interrupt_SetPriority ******************************************************************************** * * Summary: * Sets the Priority of the Interrupt. * * Note calling TimerDelay_Interrupt_Start or TimerDelay_Interrupt_StartEx will * override any effect this API would have had. This API should only be called * after TimerDelay_Interrupt_Start or TimerDelay_Interrupt_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 TimerDelay_Interrupt_SetPriority(uint8 priority) { uint8 interruptState; uint32 priorityOffset = ((TimerDelay_Interrupt__INTC_NUMBER % 4u) * 8u) + 6u; interruptState = CyEnterCriticalSection(); *TimerDelay_Interrupt_INTC_PRIOR = (*TimerDelay_Interrupt_INTC_PRIOR & (uint32)(~TimerDelay_Interrupt__INTC_PRIOR_MASK)) | ((uint32)priority << priorityOffset); CyExitCriticalSection(interruptState); }
int main() { uint8 interruptState; CyGlobalIntEnable; /* Enable global interrupts */ EZI2C_Start(); /* Start EZI2C component */ /* * Set up communication and initialize data buffer to CapSense data structure * to use Tuner application */ EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam), sizeof(CapSense_dsRam), (uint8 *)&CapSense_dsRam); CapSense_Start(); /* Initialize component */ BleHandler_Init(); Tuner_Init(BleHandler_RefreshBuffer, BleHandler_SendBuffer); CapSense_ScanAllWidgets(); /* Scan all widgets */ for(;;) { /* Do this only when a scan is done */ interruptState = CyEnterCriticalSection(); if(CapSense_NOT_BUSY == CapSense_IsBusy()) { CyExitCriticalSection(interruptState); CapSense_ProcessAllWidgets(); /* Process all widgets */ Tuner_RunTuner(); if (CapSense_IsAnyWidgetActive()) /* Scan result verification */ { /* add custom tasks to execute when touch detected */ } CapSense_ScanAllWidgets(); /* Start next scan */ } CySysPmSleep(); /* Sleep until scan is finished */ CyExitCriticalSection(interruptState); } }
/******************************************************************************* * Function Name: TILT_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: * - TILT_COUNT_UP - Counts up * - TILT_COUNT_DOWN - Counts down * - TILT_COUNT_UPDOWN0 - Counts up and down. Terminal count * generated when counter reaches 0 * - TILT_COUNT_UPDOWN1 - Counts up and down. Terminal count * generated both when counter reaches 0 * and period * * Return: * None * *******************************************************************************/ void TILT_SetCounterMode(uint32 counterMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_CONTROL_REG &= (uint32)~TILT_UPDOWN_MASK; TILT_CONTROL_REG |= counterMode; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_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 TILT_SetCompareSwap(uint32 swapEnable) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_CONTROL_REG &= (uint32)~TILT_RELOAD_CC_MASK; TILT_CONTROL_REG |= (swapEnable & TILT_1BIT_MASK); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_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: * - TILT_INVERT_LINE - Inverts the line output * - TILT_INVERT_LINE_N - Inverts the line_n output * * Return: * None * *******************************************************************************/ void TILT_SetPWMInvert(uint32 mask) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_CONTROL_REG &= (uint32)~TILT_INV_OUT_MASK; TILT_CONTROL_REG |= mask; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_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: * - TILT_PRESCALE_DIVBY1 - Divide by 1 (no prescaling) * - TILT_PRESCALE_DIVBY2 - Divide by 2 * - TILT_PRESCALE_DIVBY4 - Divide by 4 * - TILT_PRESCALE_DIVBY8 - Divide by 8 * - TILT_PRESCALE_DIVBY16 - Divide by 16 * - TILT_PRESCALE_DIVBY32 - Divide by 32 * - TILT_PRESCALE_DIVBY64 - Divide by 64 * - TILT_PRESCALE_DIVBY128 - Divide by 128 * * Return: * None * *******************************************************************************/ void TILT_SetPrescaler(uint32 prescaler) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_CONTROL_REG &= (uint32)~TILT_PRESCALER_MASK; TILT_CONTROL_REG |= prescaler; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_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: * - TILT_TRIG_LEVEL - Level * - TILT_TRIG_RISING - Rising edge * - TILT_TRIG_FALLING - Falling edge * - TILT_TRIG_BOTH - Both rising and falling edge * * Return: * None * *******************************************************************************/ void TILT_SetCaptureMode(uint32 triggerMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_TRIG_CONTROL1_REG &= (uint32)~TILT_CAPTURE_MASK; TILT_TRIG_CONTROL1_REG |= triggerMode; 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_SetQDMode ******************************************************************************** * * Summary: * Sets the the Quadrature Decoder to one of 3 supported modes. * Is functionality is only applicable to Quadrature Decoder operation. * * Parameters: * qdMode: Quadrature Decoder mode * Values: * - Backlight_PWM_MODE_X1 - Counts on phi 1 rising * - Backlight_PWM_MODE_X2 - Counts on both edges of phi1 (2x faster) * - Backlight_PWM_MODE_X4 - Counts on both edges of phi1 and phi2 * (4x faster) * * Return: * None * *******************************************************************************/ void Backlight_PWM_SetQDMode(uint32 qdMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_CONTROL_REG &= (uint32)~Backlight_PWM_QUAD_MODE_MASK; Backlight_PWM_CONTROL_REG |= qdMode; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: Backlight_PWM_SetCountMode ******************************************************************************** * * Summary: * Sets the count trigger mode. For Quadrature Decoder mode this is the phiA * input. * * 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_SetCountMode(uint32 triggerMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); Backlight_PWM_TRIG_CONTROL1_REG &= (uint32)~Backlight_PWM_COUNT_MASK; Backlight_PWM_TRIG_CONTROL1_REG |= ((uint32)(triggerMode << Backlight_PWM_COUNT_SHIFT)); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * 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: 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); }
/******************************************************************************* * Function Name: CyEEPROM_Stop ******************************************************************************** * * Summary: * Disable the EEPROM. * * Parameters: * None * * Return: * None * *******************************************************************************/ void CyEEPROM_Stop (void) { uint8 interruptState; interruptState = CyEnterCriticalSection(); CY_FLASH_PM_ACT_CFG12_REG &= ((uint8)(~CY_FLASH_PM_ACT_CFG12_EN_EE)); CY_FLASH_PM_ALTACT_CFG12_REG &= ((uint8)(~CY_FLASH_PM_ALTACT_CFG12_EN_EE)); 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: TILT_SetCountMode ******************************************************************************** * * Summary: * Sets the count trigger mode. For Quadrature Decoder mode this is the phiA * input. * * Parameters: * triggerMode: Enumerated trigger mode value * Values: * - TILT_TRIG_LEVEL - Level * - TILT_TRIG_RISING - Rising edge * - TILT_TRIG_FALLING - Falling edge * - TILT_TRIG_BOTH - Both rising and falling edge * * Return: * None * *******************************************************************************/ void TILT_SetCountMode(uint32 triggerMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_TRIG_CONTROL1_REG &= (uint32)~TILT_COUNT_MASK; TILT_TRIG_CONTROL1_REG |= ((uint32)(triggerMode << TILT_COUNT_SHIFT)); CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: TILT_SetQDMode ******************************************************************************** * * Summary: * Sets the the Quadrature Decoder to one of 3 supported modes. * Is functionality is only applicable to Quadrature Decoder operation. * * Parameters: * qdMode: Quadrature Decoder mode * Values: * - TILT_MODE_X1 - Counts on phi 1 rising * - TILT_MODE_X2 - Counts on both edges of phi1 (2x faster) * - TILT_MODE_X4 - Counts on both edges of phi1 and phi2 * (4x faster) * * Return: * None * *******************************************************************************/ void TILT_SetQDMode(uint32 qdMode) { uint8 enableInterrupts; enableInterrupts = CyEnterCriticalSection(); TILT_CONTROL_REG &= (uint32)~TILT_QUAD_MODE_MASK; TILT_CONTROL_REG |= qdMode; CyExitCriticalSection(enableInterrupts); }
/******************************************************************************* * Function Name: CySysPmSetWakeupPolarity ******************************************************************************** * * Summary: * Wake up from the stop mode is performed by toggling the wakeup pin, * causing a normal boot procedure to occur. This function assigns * the wakeup pin active level. Setting the wakeup pin to this level will cause * the wakeup from stop mode. The wakeup pin is active low by default. * * Parameters: * polarity: Wakeup pin active level: * Value Define Level * 0 CY_PM_STOP_WAKEUP_ACTIVE_LOW Logical zero will wakeup the chip * 1 CY_PM_STOP_WAKEUP_ACTIVE_HIGH Logical one will wakeup the chip * * Return: * None * *******************************************************************************/ void CySysPmSetWakeupPolarity(uint32 polarity) { uint8 interruptState; interruptState = CyEnterCriticalSection(); CY_PM_PWR_STOP_REG = (CY_PM_STOP_WAKEUP_ACTIVE_LOW != polarity) ? (CY_PM_PWR_STOP_REG | CY_PM_PWR_STOP_POLARITY) : (CY_PM_PWR_STOP_REG & (uint32) (~CY_PM_PWR_STOP_POLARITY)); CyExitCriticalSection(interruptState); }