void AL_writeRegister (int number, unsigned char data) { /* logMessage(LOG_DEBUG, "AL_writeRegister: %2.2X=%2.2X", number, data); */ writePort1(ALP_REGISTER, number); AL_writeDelay(6); writePort1(ALP_DATA, data); AL_writeDelay(35); }
static void BrButtons(vbButtons *dest) { char i; dest->bigbuttons = 0; dest->keypressed = 0; for (i = 47; i>=40; i--) { writePort1(LPTPORT, i); vbsleep(VBDELAY); if ((readPort1(LPTSTATUSPORT) & 0x08)==0) { dest->bigbuttons |= (1 << (i-40)); dest->keypressed = 1; } } dest->routingkey = 0; for (i = 40; i>0; i--) { writePort1(LPTPORT, i-1); vbsleep(VBDELAY); if ((readPort1(LPTSTATUSPORT) & 0x08)==0) { dest->routingkey = i; dest->keypressed = 1; break; } } }
/** * write a single port - function required for wiringPi interface * @param pin - port relative to pinBase * @param newState - value to port should be set to 0 - OFF, 1 - ON * @return new value of complete port */ int Max7312::writePort(int pin, bool newState){ if(isLowerPort(pin)){ if(newState){ SETBIT(_port1_data, (GET_LOWER_PIN_ID(pin))); } else { CLEARBIT(_port1_data, (GET_LOWER_PIN_ID(pin))); } writePort1(_port1_data); return _port1_data; } else { if(newState){ SETBIT(_port2_data, (GET_HIGHER_PIN_ID(pin))); } else { CLEARBIT(_port2_data, (GET_HIGHER_PIN_ID(pin))); } writePort2(_port2_data); return _port2_data; } }
static void vbdisplay(unsigned char *vbBuf) { int i,j; char b; for (j = 0; j<VBSIZE; j++) { for (i = 7; i>=0; i--) { b = (vbBuf[j] << i) & VBLPTDATA; writePort1(LPTPORT, b); vbclockpause(); writePort1(LPTPORT, b | VBLPTCLOCK); vbclockpause(); } } writePort1(LPTPORT, b | VBLPTCLOCK); for (i = 0; i<=7; i++) vbclockpause(); writePort1(LPTPORT, 0); for (i = 0; i<=7; i++) vbclockpause(); writePort1(LPTPORT, VBLPTSTROBE); for (i = 0; i<=7; i++) vbclockpause(); writePort1(LPTPORT, 0); vbclockpause(); }
static void serialWritePort (SerialDevice *serial, unsigned char port, unsigned char value) { writePort1(serialPortBase(serial)+port, value); }
void vbsleep(long x) { int i; for (i = 0; i<x; i++) writePort1(0x80, 1); }