bool Gpio_stm32::write(bool level) { if (level == false) { set_low(); } else { set_high(); } return true; }
// Automagically called upon receiving a USB control message USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) { // Clean up the data we received usbRequest_t *rq = (void *)data; uchar outputID; int cmdID; outputID = (rq->bRequest); cmdID = (rq->wValue.bytes[0]); // LCD screen related commands if (outputID==BACKLIGHT_OFF) // 0: Turn backlights off set_low(BLPORT,BLPIN); else if(outputID==BACKLIGHT_ON) // 1: Turn backlights on set_high(BLPORT,BLPIN); else if(outputID==2) { // 2: Clear both displays CHA_LCDclr(); CHB_LCDclr(); } // Fan and light (PWM) related commands else if(outputID==FAN1_SPEED) { // 3: Adjust fan 1 speed if(cmdID==0) TCCR0A = TCCR0A&0x7F; // Turn off completely if we got a zero else { OCR0A = cmdID; // Take PWM value TCCR0A = TCCR0A|0x80; // Make sure this channel PWM is on } } else if(outputID==FAN2_SPEED) { // 4: Adjust fan 2 speed if(cmdID==0) TCCR0A = TCCR0A&0xDF; // Turn off completely if we got a zero else { OCR0B = cmdID; // Take PWM value TCCR0A = TCCR0A|0x20; // Make sure this channel PWM is on } } else if(outputID==LIGHT_SPEED) { // 5: Adjust light speed if(cmdID==0) TCCR2A = TCCR2A&0xDF; // Turn off completely if we got a zero else { OCR2B = cmdID; // Take PWM value TCCR2A = TCCR2A|0x20; // Make sure this channel PWM is on } } // LCD text/comms related commands else if(outputID==POST_LINEA0) // 6: Post buffer to LCD A, line 0 CHA_LCDstringLine(buff,0); else if(outputID==POST_LINEA1) // 7: Post buffer to LCD A, line 1 CHA_LCDstringLine(buff,1); else if(outputID==POST_LINEB0) // 8: Post buffer to LCD B, line 0 CHB_LCDstringLine(buff,0); else if (outputID==POST_LINEB1) // 9: Post buffer to LCD B, line 1 CHB_LCDstringLine(buff,1); else if(outputID==INIT_TRANSMIT) // 10: String incoming. Reset buffer index. addr = 0; else if(outputID==RCV_CHAR) { // 11: Got a char. Store it in the buffer. buff[addr] = cmdID; addr++; } return 0; }
inline jlong jlong_from(jint h, jint l) { jlong result = 0; // initialization to avoid warning set_high(&result, h); set_low(&result, l); return result; }
NTSTATUS event_pair_t::set_low_wait_high() { set_low(); return wait_high(); }