本文整理汇总了C++中INTClearFlag函数的典型用法代码示例。如果您正苦于以下问题:C++ INTClearFlag函数的具体用法?C++ INTClearFlag怎么用?C++ INTClearFlag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INTClearFlag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __ISR
// UART 2 interrupt handler
// it is set at priority level 2
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
unsigned char databyte;
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
databyte = UARTGetDataByte(UART2);
databyte++;
// Echo what we just received.
PutCharacter(databyte);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
}
}
示例2: __ISR
// UART 2 interrupt handler
// it is set at priority level 2
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
// Echo what we just received.
PutCharacter(UARTGetDataByte(UART2));
// Toggle LED to indicate UART activity
mPORTAToggleBits(BIT_7);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
}
}
示例3: FIFOUART1_initialize
//******************************************************************************
//Public Function Definitions
//******************************************************************************
void FIFOUART1_initialize()
{
UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | //Sets the data transfer size to 8-bits per frame.�
UART_PARITY_NONE | //Disables parity bit generation.�
UART_STOP_BITS_1); //1 stop bit per frame (default).�
UARTSetDataRate(UART1, GetPeripheralClock(), FIFOUART1_BAUD_RATE);
//Interrupt Stuff
INTSetVectorPriority(INT_UART_1_VECTOR, INT_PRIORITY_LEVEL_5);
INTSetVectorSubPriority(INT_UART_1_VECTOR, INT_SUB_PRIORITY_LEVEL_0);
INTClearFlag(INT_U1RX);
INTClearFlag(INT_U1TX);
//configure what triggers UART1 itnerrupts
UARTSetFifoMode(UART1,
UART_INTERRUPT_ON_TX_BUFFER_EMPTY | //TX interrupt will occur when the TX buffer is empty.�
UART_INTERRUPT_ON_RX_NOT_EMPTY); //RX interrupt will occur whenever the RX buffer has any data.�
//Enable UART1 Rx Interrupt
INTEnable(INT_U1RX, INT_ENABLED);
//Enable UART1 Tx Interrupt
//INTEnable(INT_U1TX, INT_ENABLED);
UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
}
示例4: MyCyclone_Init
void MyCyclone_Init(void)
{
// Configure Reset Pin = GPIO_2[10] = RD7
mPORTDClearBits(RST_FPGA);
mPORTDSetPinsDigitalOut(RST_FPGA);
// Do a Reset
mPORTDSetBits(RST_FPGA);
mPORTDClearBits(RST_FPGA);
// Do Interrupts Initialization
// Set RD8/INT1 and RD9/INT2 as inputs
mPORTDSetPinsDigitalIn(BIT_8 | BIT_9);
// Clear corresponding bits in INTCON for falling edge trigger
INTCONCLR = _INTCON_INT1EP_MASK | _INTCON_INT2EP_MASK;
// Set up interrupt prioirty and sub-priority
INTSetVectorPriority(INT_EXTERNAL_1_VECTOR, My_INT_EXTERNAL_1_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_1_VECTOR, My_INT_EXTERNAL_1_SUB_PRIORITY);
INTSetVectorPriority(INT_EXTERNAL_2_VECTOR, My_INT_EXTERNAL_2_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_2_VECTOR, My_INT_EXTERNAL_2_SUB_PRIORITY);
// Clear the interrupt flags
INTClearFlag(INT_INT1);
INTClearFlag(INT_INT2);
// Enable INT1 & INT2
INTEnable(INT_INT1, INT_ENABLED);
INTEnable(INT_INT2, INT_ENABLED);
// Enable KEY0 and KEY1 interrupts and IOs of the MyExpansionBoard_IO_v2
MyCyclone_Write(CYCLONE_CONFIG,CYCLONE_ENABLE_INT_KEY0 | CYCLONE_ENABLE_INT_KEY1 | CYCLONE_ENABLE_IO_AB | CYCLONE_ENABLE_IO_CD);
}
示例5: __ISR
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
// Clear the RX interrupt Flag
INTClearFlag(INT_SOURCE_UART_RX(UART2));
// Code to be executed on RX interrupt:
COMMAND = UARTGetDataByte(UART2);
// Echo what we just received.
PutCharacter(COMMAND);
}
// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
// Clear the TX interrupt Flag
INTClearFlag(INT_SOURCE_UART_TX(UART2));
// Code to be executed on TX interrupt:
//none
}
}
示例6: ConfigSPIComms
BOOL ConfigSPIComms(void)
{
SpiChnClose(RPI_SPI_CHANNEL);
/* do I need to configure this? */
INTEnable(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI_TX(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI_ERROR(RPI_SPI_CHANNEL),INT_DISABLED);
INTEnable(INT_SOURCE_SPI(RPI_SPI_CHANNEL),INT_DISABLED);
SPI_DATA_IN_DIRECTION = TRIS_IN;
SPI_DATA_OUT_DIRECTION = TRIS_OUT;
SPI_CLOCK_IN_DIRECTION = TRIS_IN;
SPI_SELECT_IN_DIRECTION = TRIS_IN;
SPI.RXCount=0;
SPI.TXCount=0;
SPI.address=0;
SPI.command=TRISTHIS_SPI_NO_COMMAND;
SpiChnOpen(RPI_SPI_CHANNEL,
SPI_OPEN_SLVEN|SPI_OPEN_CKE_REV|SPI_OPEN_MODE8|SPI_OPEN_SSEN,
0);
//TODO: Not acting consistently? RPI needs to send -b 8 -H parameters to spidev
/* configure interrupts */
INTSetVectorPriority(INT_VECTOR_SPI(RPI_SPI_CHANNEL), INT_PRIORITY_LEVEL_3);
INTSetVectorSubPriority(INT_VECTOR_SPI(RPI_SPI_CHANNEL),
INT_SUB_PRIORITY_LEVEL_1);
INTClearFlag(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL));
INTEnable(INT_SOURCE_SPI_RX(RPI_SPI_CHANNEL),INT_ENABLED);
INTClearFlag(INT_SOURCE_SPI_TX(RPI_SPI_CHANNEL));
INTClearFlag(INT_SOURCE_SPI_ERROR(RPI_SPI_CHANNEL));
INTClearFlag(INT_SOURCE_SPI(RPI_SPI_CHANNEL));
//INTEnable(INT_SOURCE_SPI(RPI_SPI_CHANNEL),INT_ENABLED);
/* configure change notice, as I can't figure out any other way to */
/* trigger the beginning of the slave select with just the SPI peripheral */
/* buuut the change notice pins are not on the SS pins, so a white wire is*/
/* needed */
/* tie chip enable CE0 to pin20/RE5 CE1 */
SPI_SELECT_CN_DIRECTION=TRIS_IN;
CNCONbits.w=0;
CNCONSET=_CNCON_ON_MASK;
CNENbits.w=0;
CNENSET=_CNEN_CNEN7_MASK;
CNTemp=CE_PORT; /* read for change notice */
RPI_SPI_RX_OVERFLOW_CLEAR;
SPI1CONbits.STXISEL=0b01;
SPI.status.w=0;
INTClearFlag(INT_CN);
INTSetVectorPriority(INT_CHANGE_NOTICE_VECTOR, INT_PRIORITY_LEVEL_2);
INTSetVectorSubPriority(INT_CHANGE_NOTICE_VECTOR, INT_SUB_PRIORITY_LEVEL_1);
return TRUE;
}
示例7: __ISR
void __ISR(_TIMER_4_VECTOR, IPL2SOFT) tick_timer_isr() {
INTClearFlag(INT_T4);
ColourEngine::Tick();
//toggle(PIO_LED2);
// Power toggle
if (_PORT(PIO_BTN1) == HIGH) {
last_btn1 = HIGH;
}
else if (last_btn1 == HIGH) {
last_btn1 = LOW;
power = (power == OFF) ? ON : OFF;
ColourEngine::SetPower(power, 1000);
}
// Switch mode
if (_PORT(PIO_BTN2) == HIGH) {
last_btn2 = HIGH;
}
else if (last_btn2 == HIGH) {
last_btn2 = LOW;
if (mode++ == (int)ColourEngine::NUM_MODES-1)
mode = 0;
ColourEngine::SetMode(static_cast<ColourEngine::mode_t>(mode), Q15(0.0001));
}
}
示例8: AD_Init
/**
* @Function AD_Init
* @param None
* @return SUCCESS or ERROR
* @brief Initializes the A/D subsystem and enable battery voltage monitoring.
* @author Max Dunne, 2013.08.10 */
char AD_Init(void)
{
if (ADActive) {
return ERROR;
}
int pin = 0;
//ensure that the battery monitor is active
ActivePins = BAT_VOLTAGE_MONITOR;
ADActive = TRUE;
AD_SetPins();
for (pin = 0; pin < NUM_AD_PINS; pin++) {
ADValues[pin] = -1;
}
INTEnable(INT_AD1, INT_DISABLED);
INTClearFlag(INT_AD1);
INTSetVectorPriority(INT_ADC_VECTOR, 1);
INTSetVectorSubPriority(INT_ADC_VECTOR, 3);
INTEnable(INT_AD1, INT_ENABLED);
EnableADC10();
ADNewData = FALSE;
//wait for first reading to ensure battery monitor starts in the right spot
while (!AD_IsNewDataReady()) {
#ifdef AD_DEBUG_VERBOSE
PutChar('.');
#endif
}
//set the first values for the battery monitor filter
Filt_BatVoltage = AD_ReadADPin(BAT_VOLTAGE_MONITOR);
CurFilt_BatVoltage = Filt_BatVoltage;
PrevFilt_BatVoltage = Filt_BatVoltage;
return SUCCESS;
}
示例9: WF_EintInit
void WF_EintInit(void)
{
/* disable the external interrupt */
INTEnable(INT_INT1, INT_DISABLED); // disable interrupt
#if !defined(TCPIP_STACK_USE_EVENT_NOTIFICATION)
SYS_INT_DynamicRegister(MRFWB0M_INT_SOURCE, WF_NoEventISR, 0);
// #else the MRF ISR is already hooked by MRF24W_MACEventInit()!
#endif
/* configure IO pin as input and External Interrupt pin*/
/* set the I/O high since we do not have pull-ups */
INT1Rbits.INT1R = 0x0d; //select INT1 pin = RPE8
ANSELEbits.ANSE8 = 0; /* configure IO pin as input and External Interrupt pin*/
WF_INT_IO = 1; // PORTEbits.RE8 = 1; /* configure IO pin as input and External Interrupt pin*/
WF_INT_TRIS = 1; //TRISEbits.TRISE8 = 1 ; // ; /* set the I/O high since we do not have pull-ups */
WF_INT_EDGE = 0; //INTCONbits.INT1EP = 0; /* falling edge triggered */
/* clear and enable the interrupt */
INTClearFlag(INT_INT1) ; // clear status
INTSetVectorPriority(INT_EXTERNAL_1_VECTOR, 5); //set security level to 5
INTSetVectorSubPriority(INT_EXTERNAL_1_VECTOR,1); //set sub_security level to 1
// INTEnable(INT_INT1, INT_ENABLED); // Should not enable interrupt here
//---
}
示例10: __ISR
//=============================================
// Configure the ADC interrupt handler
//=============================================
void __ISR(_ADC_VECTOR, ADC_INT_PRIORITY) AdcInterruptHandler(void)
{
oAdcReady = 1;
Adc.Read(); // Read the enabled channels and puts them in Adc.Var.adcReadValues[]
INTClearFlag(INT_AD1); // Clear the ADC conversion done interrupt Flag
}
示例11: __ISR
/**
* @Function ADCIntHandler
* @param None
* @return None
* @brief Interrupt Handler for A/D. Reads all used pins into buffer.
* @note This function is not to be called by the user
* @author Max Dunne, 2013.08.25 */
void __ISR(_ADC_VECTOR, ipl1) ADCIntHandler(void)
{
unsigned char CurPin = 0;
INTClearFlag(INT_AD1);
for (CurPin = 0; CurPin <= PinCount; CurPin++) {
ADValues[CurPin] = ReadADC10(CurPin); //read in new set of values
}
//calculate new filtered battery voltage
Filt_BatVoltage = (Filt_BatVoltage * KEEP_FILT + AD_ReadADPin(BAT_VOLTAGE_MONITOR) * ADD_FILT) >> SHIFT_FILT;
SampleCount++;
if (SampleCount > PointsPerBatSamples) {//if sample time has passed
PrevFilt_BatVoltage = CurFilt_BatVoltage;
CurFilt_BatVoltage = Filt_BatVoltage;
SampleCount = 0;
//check for battery undervoltage check
if ((CurFilt_BatVoltage <= BAT_VOLTAGE_LOCKOUT) && (PrevFilt_BatVoltage <= BAT_VOLTAGE_LOCKOUT) && (AD_ReadADPin(BAT_VOLTAGE_MONITOR) > BAT_VOLTAGE_NO_BAT)) {
BOARD_End();
while (1) {
printf("Battery is undervoltage with reading %d, Stack is inoperable until charging\r\n", AD_ReadADPin(BAT_VOLTAGE_MONITOR));
while (!IsTransmitEmpty());
}
}
}
//if pins are changed add pins
if (PinsToAdd | PinsToRemove) {
AD_SetPins();
}
ADNewData = TRUE;
}
示例12: comms_tx_packet
//*************************************
//*************************************
//********** COMMS TX PACKET **********
//*************************************
//*************************************
//Call with:
// comms_tx_byte Check this is zero before loading comms_tx_buffer (confirms last tx is complete)
// comms_tx_buffer[] The packet data to send with the command in byte 0:1. The Length will automatically be added to bytes 2:3 by this function
// packet_length The number of data bytes excluding the checksum (which is automatically added by the tx function)
void comms_tx_packet (WORD packet_length)
{
//Packet format:
// CommandH | CommandL | LengthH | LengthL | 0-# Data Bytes | Checksum H | Checksum L
//Check last tx is complete
if (comms_tx_byte)
return;
if (packet_length > COMMS_TX_BUFFER_LENGTH)
return;
//----- START TX -----
comms_tx_no_of_bytes_to_tx = packet_length; //no of bytes to tx (excluding checksum)
//Set the length bytes
comms_tx_buffer[2] = (BYTE)(packet_length >> 8);
comms_tx_buffer[3] = (BYTE)(packet_length & 0x00ff);
//comms_rx_no_of_bytes_to_rx = 0xfffe; //If you want to reset rx
//comms_rx_1ms_timeout_timer = ;
comms_tx_byte = 0;
comms_tx_chksum = (WORD)comms_tx_buffer[0];
INTClearFlag(INT_SOURCE_UART_TX(COMMS_UART_NAME));
UARTSendDataByte(COMMS_UART_NAME, comms_tx_buffer[comms_tx_byte++]); //Manually trigger the first tx
INTEnable(INT_SOURCE_UART_TX(COMMS_UART_NAME), INT_ENABLED);
}
示例13: MyMIWI_Init
void MyMIWI_Init(void) {
// Configure Pins for MRF24J40MB
mPORTESetBits(RST_MIWI);
mPORTESetPinsDigitalOut(RST_MIWI);
mPORTBSetBits(MIWI_WAKE);
mPORTBSetPinsDigitalOut(MIWI_WAKE);
// Configure the INT3 controller for MIWI
// Set RD10/INT3 as input
mPORTDSetPinsDigitalIn(BIT_10);
// Clear corresponding bits in INTCON for falling edge trigger
INTCONCLR = _INTCON_INT3EP_MASK;
// Set up interrupt prioirty and sub-priority
INTSetVectorPriority(INT_EXTERNAL_3_VECTOR, My_INT_EXTERNAL_3_PRIORITY);
INTSetVectorSubPriority(INT_EXTERNAL_3_VECTOR, My_INT_EXTERNAL_3_SUB_PRIORITY);
// Clear the interrupt flags
INTClearFlag(INT_INT3);
// Enable INT3
INTEnable(INT_INT3, INT_ENABLED);
// WARNING : Change in file MRF24J40.c in Microchip Application Library
// the line : void __ISR(_EXTERNAL_1_VECTOR, ipl4) _INT1Interrupt(void)
// by : void __ISR(_EXTERNAL_3_VECTOR, ipl4) _INT3Interrupt(void)
}
示例14: __ISR
void __ISR(_TIMER_4_VECTOR, IPL7AUTO) TimerBlinkHandler(void)
{
// check the LED blink flags
if (V.blink_alt) {
if (V.blink & 0b00000001) LEDS.out_bits.b0 = !LEDS.out_bits.b0;
if (V.blink & 0b00000010) LEDS.out_bits.b1 = !LEDS.out_bits.b0;
if (V.blink & 0b00000100) LEDS.out_bits.b2 = !LEDS.out_bits.b2;
if (V.blink & 0b00001000) LEDS.out_bits.b3 = !LEDS.out_bits.b2;
if (V.blink & 0b00010000) LEDS.out_bits.b4 = !LEDS.out_bits.b4;
if (V.blink & 0b00100000) LEDS.out_bits.b5 = !LEDS.out_bits.b4;
if (V.blink & 0b01000000) LEDS.out_bits.b6 = !LEDS.out_bits.b6;
if (V.blink & 0b10000000) LEDS.out_bits.b7 = !LEDS.out_bits.b6;
} else {
if (V.blink & 0b00000001) LEDS.out_bits.b0 = !LEDS.out_bits.b0;
if (V.blink & 0b00000010) LEDS.out_bits.b1 = !LEDS.out_bits.b1;
if (V.blink & 0b00000100) LEDS.out_bits.b2 = !LEDS.out_bits.b2;
if (V.blink & 0b00001000) LEDS.out_bits.b3 = !LEDS.out_bits.b3;
if (V.blink & 0b00010000) LEDS.out_bits.b4 = !LEDS.out_bits.b4;
if (V.blink & 0b00100000) LEDS.out_bits.b5 = !LEDS.out_bits.b5;
if (V.blink & 0b01000000) LEDS.out_bits.b6 = !LEDS.out_bits.b6;
if (V.blink & 0b10000000) LEDS.out_bits.b7 = !LEDS.out_bits.b7;
}
Drive_leds();
V.blink_count++;
INTClearFlag(INT_T4);
}
示例15: __ISR
/**
* This is the ISR for the ADC1 peripheral. It has been enabled to run continuously. Reads all 8
* samples from the ADC, averages them, and stores them in a module-level variable for use in the
* main event loop.
*/
void __ISR(_ADC_VECTOR, IPL2AUTO) AdcHandler(void)
{
// Clear the interrupt flag.
INTClearFlag(INT_AD1);
}