本文整理汇总了C++中GlobalInterruptEnable函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalInterruptEnable函数的具体用法?C++ GlobalInterruptEnable怎么用?C++ GlobalInterruptEnable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalInterruptEnable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
* the loaded application code.
*/
int main(void)
{
/* Setup hardware required for the bootloader */
SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */
GlobalInterruptEnable();
while (RunBootloader)
{
CDC_Task();
USB_USBTask();
/* Time out and start the sketch if one is present */
if (Timeout > TIMEOUT_PERIOD){
RunBootloader = false;}
}
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
for (;;);
}
示例2: main
int main(void)
{
SetupHardware();
GlobalInterruptEnable();
sei();
for (;;)
{
if (tx_ticks > 0)
{
tx_ticks--;
}
else if (tx_ticks == 0)
{
LEDs_TurnOnLEDs(LEDS_LED2); // on = off?
}
if (rx_ticks > 0)
{
rx_ticks--;
}
else if (rx_ticks == 0)
{
LEDs_TurnOnLEDs(LEDS_LED1); // on = off?
}
MIDI_To_Arduino();
MIDI_To_Host();
USB_USBTask();
}
}
示例3: main
/**
* /brief Main function for the focuser firmware
*/
int main(int argc, char *argv[]) {
// initialize the
unsigned short d = 10;
led_on();
while (d--) {
_delay_ms(100);
led_off();
_delay_ms(100);
led_on();
}
led_off();
// initialize USB, but USB requests will only be handled when
// interrupts are enabled below
USB_Init(USB_DEVICE_OPT_FULLSPEED);
// start the timer, this also enables the watchdog timer
timer_start();
// enable interrupts so that USB processing can begin
GlobalInterruptEnable();
// do nothing
for (;;) {
if (saveneeded) {
motor_save();
}
if (newserial) {
serial_write();
}
}
}
示例4: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
stdout=&mystdout;
stdin=&mystdin;
SetupHardware();
//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
//Eval Prototype Sharp Reset Pin
//DDRB &= ~RESET_PIN; //Set Input
//PORTB |= RESET_PIN; //Set High
//DDRB |= RESET_PIN; //Set Output
//Drude Sharp LCD Reset PIN
PORTF |= RESETN_PIN; //Set High
DDRF |= RESETN_PIN; //Set Output
//Digitizer Interrupt
//DDRB &= ~(_BV(7)); //PB7 input
//PORTB &= ~(1<<PB7); //PB7 low
PORTB |= (_BV(7)); //Set high (input pullup)
//IP4787CZ32Y HDMI ESD interface chip (HDMI_ACT PIN) Active-High (Test-Point 12)
PORTF |= (_BV(PF1)); //Set high (input pullup)
//Toshiba Interrupt Pin
PORTE |= (_BV(PE6)); //Set high (input pullup)
//Toshiba Standby Pin
PORTF |= (_BV(PF4)); //Set high (input pullup)
//Toshiba Reset Pin - Active Low
PORTC |= (_BV(PC7)); //Set high (input pullup)
//LCD-CABC
//PORTF |= (_BV(PF7)); //Set high (defaults to input pullup)
//DDRF &= ~(_BV(PF7)); //Set output
//PORTF |= (_BV(PF7)); //Set low
//LED-PWM
PORTD |= (_BV(PD6)); //Set high (defaults to input pullup)
//PORTD &= ~(_BV(PD6)); //Set low
//DDRD &= ~(_BV(PD6)); //Set output
RingBuffer_InitBuffer(&FromHost_Buffer, FromHost_Buffer_Data, sizeof(FromHost_Buffer_Data));
init_screen(0x1F); //magic number!
mxt_list_types();
for (;;)
{
HandleSerial();
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
HID_Device_USBTask(&Digitizer_HID_Interface);
USB_USBTask();
HandleDigitizer();
}
}
示例5: main
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
USB_USBTask();
uint8_t ReceivedData[VENDOR_IO_EPSIZE];
memset(ReceivedData, 0x00, sizeof(ReceivedData));
Endpoint_SelectEndpoint(VENDOR_OUT_EPADDR);
if (Endpoint_IsOUTReceived())
{
Endpoint_Read_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(VENDOR_IN_EPADDR);
Endpoint_Write_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL);
Endpoint_ClearIN();
}
}
}
示例6: main
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Mouse Host/Device Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
/* Determine which USB mode we are currently in */
if (USB_CurrentMode == USB_MODE_Host)
{
MouseHost_Task();
HID_Host_USBTask(&Mouse_HID_Host_Interface);
}
else
{
HID_Device_USBTask(&Mouse_HID_Device_Interface);
}
USB_USBTask();
}
}
示例7: main
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
* the loaded application code.
*/
int main(void)
{
/* Setup hardware required for the bootloader */
SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */
GlobalInterruptEnable();
while (RunBootloader)
{
CDC_Task();
USB_USBTask();
}
/* Wait a short time to end all USB transactions and then disconnect */
_delay_us(1000);
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
for (;;);
}
示例8: main
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
while (RunBootloader || TicksSinceLastCommand++ < 0xFF)
{
MS_Device_USBTask(&Disk_MS_Interface);
USB_USBTask();
}
/* Wait a short time to end all USB transactions and then disconnect */
_delay_us(1000);
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
for (;;);
}
示例9: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
RingBuffer_InitBuffer(&USBtoUSART_Buffer, USBtoUSART_Buffer_Data, sizeof(USBtoUSART_Buffer_Data));
RingBuffer_InitBuffer(&USARTtoUSB_Buffer, USARTtoUSB_Buffer_Data, sizeof(USARTtoUSB_Buffer_Data));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
/* Only try to read in bytes from the CDC interface if the transmit buffer is not full */
if (!(RingBuffer_IsFull(&USBtoUSART_Buffer)))
{
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
if (!(ReceivedByte < 0))
RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
}
/* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */
uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);
if (BufferCount)
{
Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address);
/* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data
* until it completes as there is a chance nothing is listening and a lengthy timeout could occur */
if (Endpoint_IsINReady())
{
/* Never send more than one bank size less one byte to the host at a time, so that we don't block
* while a Zero Length Packet (ZLP) to terminate the transfer is sent if the host isn't listening */
uint8_t BytesToSend = MIN(BufferCount, (CDC_TXRX_EPSIZE - 1));
/* Read bytes from the USART receive buffer into the USB IN endpoint */
while (BytesToSend--)
{
/* Try to send the next byte of data to the host, abort if there is an error without dequeuing */
if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface,
RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError)
{
break;
}
/* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */
RingBuffer_Remove(&USARTtoUSB_Buffer);
}
}
}
/* Load the next byte from the USART transmit buffer into the USART */
if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer));
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
示例10: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog */
MCUSR = 0;
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
serial_init();
GlobalInterruptEnable();
//LED_CONFIG;
/* Hardware Initialization */
LEDs_Init();
PIN_CONFIG(4);
PIN_CONFIG(5);
PIN_CONFIG(6);
PIN_CONFIG(7);
while(!started);
USB_Init();
}
示例11: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
_setBrightness(50);
for (;;)
{
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
DS1302_clock_burst_read((uint8_t *) &rtc);
_setDigit( rtc.Seconds % 10 );
_setBrightness( 50 );
_delay_ms(4);
}
}
示例12: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
GlobalInterruptEnable();
for (;;)
{
/* Read in next LED colour command from the host */
uint8_t ColourUpdate = fgetc(&USBSerialStream);
/* Top 3 bits select the LED, bottom 5 control the brightness */
uint8_t Channel = (ColourUpdate & 0b11100000);
uint8_t Duty = (ColourUpdate & 0b00011111);
if (Channel & (1 << 5))
SoftPWM_Channel1_Duty = Duty;
if (Channel & (1 << 6))
SoftPWM_Channel2_Duty = Duty;
if (Channel & (1 << 7))
SoftPWM_Channel3_Duty = Duty;
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
示例13: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
TCP_Init();
Webserver_Init();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface))
{
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength);
Ethernet_ProcessPacket(&FrameIN, &FrameOUT);
if (FrameOUT.FrameLength)
{
RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, &FrameOUT.FrameData, FrameOUT.FrameLength);
FrameOUT.FrameLength = 0;
}
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
TCP_TCPTask(&Ethernet_RNDIS_Interface, &FrameOUT);
RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask();
}
}
示例14: main
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
GlobalInterruptEnable();
while(1)
{
DebounceUpdate();
EncoderUpdate();
LedUpdate();
SendSerial();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
HID_Device_USBTask(&Mouse_HID_Interface);
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
示例15: main
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
* the loaded application code.
*/
int main(void)
{
/* David Cox
* In my application is needs internal pullups activated on special pins on these ports as soon as possible.
*/
PORTB = 0xFF;
PORTC = 0xFF;
PORTF = 0xFF;
/* Setup hardware required for the bootloader */
SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */
GlobalInterruptEnable();
while (RunBootloader)
{
CDC_Task();
USB_USBTask();
}
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Unlock the forced application start mode of the bootloader if it is restarted */
MagicBootKey = MAGIC_BOOT_KEY;
/* Enable the watchdog and force a timeout to reset the AVR */
wdt_enable(WDTO_250MS);
for (;;);
}