/* is received ir-code in one of the wakeup-slots? wakeup if true */ void check_wakeups(IRMP_DATA *ir) { if(host_running()) return; uint8_t i, idx; uint8_t buf[SIZEOF_IR]; for (i=0; i < WAKE_SLOTS; i++) { idx = (MACRO_DEPTH + 1) * SIZEOF_IR/2 * MACRO_SLOTS + SIZEOF_IR/2 * i; eeprom_restore(buf, idx); if (!memcmp(buf, ir, sizeof(buf))) Wakeup(); } }
void Wakeup(void) { AlarmValue = 0xFFFFFFFF; if(host_running()) return; /* USB wakeup */ USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); /* motherboard switch: WAKEUP_PIN short high (resp. low in case of SimpleCircuit) */ #ifdef SimpleCircuit GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_RESET); #else GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_SET); #endif /* SimpleCircuit */ delay_ms(500); #ifdef SimpleCircuit GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_SET); #else GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_RESET); #endif /* SimpleCircuit */ }
void Wakeup(void) { AlarmValue = 0xFFFFFFFF; if(host_running()) return; /* USB wakeup */ Resume(RESUME_START); /* motherboard power switch: WAKEUP_PIN short high (resp. low in case of SimpleCircuit) */ #ifdef SimpleCircuit GPIO_WriteBit(WAKEUP_PORT, WAKEUP_PIN, Bit_RESET); #else GPIO_WriteBit(WAKEUP_PORT, WAKEUP_PIN, Bit_SET); #endif /* SimpleCircuit */ delay_ms(500); #ifdef SimpleCircuit GPIO_WriteBit(WAKEUP_PORT, WAKEUP_PIN, Bit_SET); #else GPIO_WriteBit(WAKEUP_PORT, WAKEUP_PIN, Bit_RESET); #endif /* SimpleCircuit */ fast_toggle(); /* let software know, PC was powered on by firmware, TODO make configurable & use Eeprom */ send_ir_on_delay = 90; }