Пример #1
0
static uint8_t readReg8(uint8_t reg, uint8_t dat)
{
    uint8_t ret;
    CD_COMMAND;
    CS_ACTIVE;
    xchg8(reg);
	CD_DATA;                    //should do a flush()
	ret = xchg8(dat);           //only safe to read @ SCK=16MHz
    CS_IDLE;
    return ret;
}
Пример #2
0
void ILI9341_kbv::begin(uint16_t ID)
{
    _lcd_ID = ID;
    uint8_t *p = (uint8_t *) tableNNNN;
    int16_t size = sizeof(tableNNNN);
    reset();
    while (size > 0) {
	    uint8_t cmd = pgm_read_byte(p++);
	    uint8_t len = pgm_read_byte(p++);
	    if (cmd == TFTLCD_DELAY8) {
		    delay(len);
		    len = 0;
		} else {
		    CS_ACTIVE;
		    WriteCmd(cmd);
		    for (uint8_t d = 0; d < len; d++) {
			    uint8_t x = pgm_read_byte(p++);
			    xchg8(x);
		    }
		    CS_IDLE;
	    }
	    size -= len + 2;
    }
    setRotation(0);             //PORTRAIT
}
Пример #3
0
int16_t ILI9341_kbv::readGRAM(int16_t x, int16_t y, uint16_t * block, int16_t w, int16_t h)
{
    uint8_t r, g, b;
	  int16_t n = w * h;    // we are NEVER going to read > 32k pixels at once
    setAddrWindow(x, y, x + w - 1, y + h - 1);
    CS_ACTIVE;
    WriteCmd(ILI9341_CMD_MEMORY_READ);

    // needs 1 dummy read
    r = xchg8(0xFF);
    while (n-- > 0) {
        r = xchg8(0xFF);
        g = xchg8(0xFF);
        b = xchg8(0xFF);
		*block++ = color565(r, g, b);
    }
    CS_IDLE;
    setAddrWindow(0, 0, width() - 1, height() - 1);
    return 0;
}
Пример #4
0
  //----------------------------------------------------------------------------------------------------
  // Support for intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest).
  //
  // Arguments:
  //
  //     exchange_value - GR_I0
  //     dest           - GR_I1
  //
  // Results:
  //
  //     GR_RET - the value previously stored in dest
  //
  address generate_atomic_xchg_ptr() {
    StubCodeMark mark(this, "StubRoutines", "atomic_xchg_ptr");

    const Register exchange_value = GR_I0;
    const Register dest           = GR_I1;

    address start = __ emit_fd();

    __ mf();

    __ xchg8(GR_RET, dest, exchange_value);

    __ ret();

    return start;
  }