Example #1
0
void
SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
{
  int bSend = 0, bRecv = 0;
  while (bSend<size || bRecv<size) {
    int r = jshSPISend(WLAN_SPI, (bSend<size)?data[bSend]:-1);
    bSend++;
    if (bSend>0 && r>=0) bRecv++;
  }

  jshDelayMicroseconds(10); // because of final clock pulse
}
Example #2
0
void lcdIdle_PCD8544(JsGraphics *gfx) {
  if (changeX1>=changeX2 && changeY1>=changeY2) {
    // write...
    int cy1 = changeY1 >> 3;
    int cy2 = changeY2 >> 3;
    int x,y;
    jshPinOutput(CE, 0);
    for (y=cy1;y<=cy2;y++) {
      jshPinOutput(DC, 0); // command
      jshSPISend(dev, 0x40 | y); // Y addr
      jshSPISend(dev, 0x80); // X addr
      jshPinOutput(DC, 1); // data
      for (x=changeX1;x<=changeX2;x++) 
        jshSPISend(dev, pixels[x+y*LCD_WIDTH]);
    }      
    jshPinOutput(DC, 0); // command
    jshSPISend(dev, 0x40); // reset?
    jshPinOutput(CE, 1);

    changeX1 = LCD_WIDTH;
    changeY1 = LCD_HEIGHT;
    changeX2 = 0;
    changeY2 = 0;
  }
Example #3
0
static uint8_t wizchip_rw(uint8_t data) {
  int r = jshSPISend(ETH_SPI, data);
  if (r<0) r = jshSPISend(ETH_SPI, -1);
  return (uint8_t)r;
}
Example #4
0
static uint8_t wizchip_rw(uint8_t data) {
  assert(networkGetCurrent());
  int r = jshSPISend(networkGetCurrent()->data.device, data);
  if (r<0) r = jshSPISend(networkGetCurrent()->data.device, -1);
  return (uint8_t)r;
}