本文整理汇总了C++中spiwrite函数的典型用法代码示例。如果您正苦于以下问题:C++ spiwrite函数的具体用法?C++ spiwrite怎么用?C++ spiwrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spiwrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAddrWindow
void Adafruit_HX8357::drawFastVLine(int16_t x, int16_t y, int16_t h,
uint16_t color) {
// Rudimentary clipping
if((x >= _width) || (y >= _height)) return;
if((y+h-1) >= _height)
h = _height-y;
setAddrWindow(x, y, x, y+h-1);
uint8_t hi = color >> 8, lo = color;
//*dcport |= dcpinmask;
digitalWrite(_dc, HIGH);
//*csport &= ~cspinmask;
digitalWrite(_cs, LOW);
while (h--) {
spiwrite(hi);
spiwrite(lo);
}
//*csport |= cspinmask;
digitalWrite(_cs, HIGH);
}
示例2: puts
void Adafruit_PN532::spiwritecommand(uint8_t* cmd, uint8_t cmdlen) {
uint8_t checksum;
cmdlen++;
#ifdef PN532DEBUG
puts("\nSending: ");
#endif
digitalWrite(_ss, LOW);
delay(2); // or whatever the delay is for waking up the board
spiwrite(PN532_SPI_DATAWRITE);
checksum = PN532_PREAMBLE + PN532_PREAMBLE + PN532_STARTCODE2;
spiwrite(PN532_PREAMBLE);
spiwrite(PN532_PREAMBLE);
spiwrite(PN532_STARTCODE2);
spiwrite(cmdlen);
spiwrite(~cmdlen + 1);
spiwrite(PN532_HOSTTOPN532);
checksum += PN532_HOSTTOPN532;
#ifdef PN532DEBUG
puts(" 0x"); puts("riga 964"); //puts(PN532_PREAMBLE, HEX);
puts(" 0x"); puts("riga 965"); //puts(PN532_PREAMBLE, HEX);
puts(" 0x"); puts("riga966"); //puts(PN532_STARTCODE2, HEX);
puts(" 0x"); puts("riga 967"); //puts(cmdlen, HEX);
puts(" 0x"); puts("riga 968"); //puts(~cmdlen + 1, HEX);
puts(" 0x");puts("riga 969"); // puts(PN532_HOSTTOPN532, HEX);
#endif
for (uint8_t i=0; i<cmdlen-1; i++) {
spiwrite(cmd[i]);
checksum += cmd[i];
#ifdef PN532DEBUG
puts(" 0x"); puts("riga 976");
#endif
}
spiwrite(~checksum);
spiwrite(PN532_POSTAMBLE);
digitalWrite(_ss, HIGH);
#ifdef PN532DEBUG
puts(" 0x"); puts("riga 985"); //puts(~checksum, HEX);
puts(" 0x"); puts("riga 986"); //puts(PN532_POSTAMBLE, HEX);
puts();
#endif
}
示例3: digitalWrite
void Adafruit_VS1053::sciWrite(uint8_t addr, uint16_t data) {
#ifdef SPI_HAS_TRANSACTION
if (useHardwareSPI) SPI.beginTransaction(VS1053_CONTROL_SPI_SETTING);
#endif
digitalWrite(_cs, LOW);
spiwrite(VS1053_SCI_WRITE);
spiwrite(addr);
spiwrite(data >> 8);
spiwrite(data & 0xFF);
digitalWrite(_cs, HIGH);
#ifdef SPI_HAS_TRANSACTION
if (useHardwareSPI) SPI.endTransaction();
#endif
}
示例4: digitalWrite
void SPIFlash::GetManufacturerInfo (uint8_t *manufID, uint8_t *deviceID)
{
// W25Q16BV_CMD_MANUFDEVID (0x90) provides both the JEDEC manufacturer
// ID and the device ID
digitalWrite(_ss, LOW);
spiwrite(W25Q16BV_CMD_MANUFDEVID);
spiwrite(0x00); // Dummy write
spiwrite(0x00); // Dummy write
spiwrite(0x00); // Dummy write
*manufID = spiread();
*deviceID = spiread();
digitalWrite(_ss, HIGH);
}
示例5: switch
void Adafruit_SSD1351::drawPixel(int16_t x, int16_t y, uint16_t color)
{
// Transform x and y based on current rotation.
switch (getRotation()) {
// Case 0: No rotation
case 1: // Rotated 90 degrees clockwise.
swap(x, y);
x = WIDTH - x - 1;
break;
case 2: // Rotated 180 degrees clockwise.
x = WIDTH - x - 1;
y = HEIGHT - y - 1;
break;
case 3: // Rotated 270 degrees clockwise.
swap(x, y);
y = HEIGHT - y - 1;
break;
}
// Bounds check.
if ((x >= SSD1351WIDTH) || (y >= SSD1351HEIGHT)) return;
if ((x < 0) || (y < 0)) return;
goTo(x, y);
// setup for data
*rsport |= rspinmask;
*csport &= ~ cspinmask;
spiwrite(color >> 8);
spiwrite(color);
*csport |= cspinmask;
}
示例6: spi_disable
void SmallFS_class::seek_if_needed(unsigned address)
{
register_t spibasedata=&SPIDATA;
if (address!=offset)
{
offset = address;
spi_disable();
spi_enable();
#ifdef SMALLFSDEBUG
Serial.print("Seeking to ");
Serial.println(address);
#endif
/*
spiwrite(spibasedata,0x0B);
spiwrite(spibasedata,address>>16);
spiwrite(spibasedata,address>>8);
spiwrite(spibasedata,address);
spiwrite(spibasedata,0);
spiwrite(spibasedata,0); // Read ahead
*/
address+=0x0B000000;
spiwrite(spibasedata+2,address>>16); /* 16-bit write */
address<<=16;
spiwrite(spibasedata+6,address); /* 32-bit Includes read-ahead */
}
示例7: spiwrite
void TFT_ILI9163C::writedata16(uint16_t d){
rsport->PIO_SODR |= rspinmask;//HI
csport->PIO_CODR |= cspinmask;//LO
spiwrite(d >> 8);
spiwrite(d);
csport->PIO_SODR |= cspinmask;//HI
}
示例8: digitalWrite
void SSD1306::ssd1306_command(uint8_t c) {
digitalWrite(cs, HIGH);
digitalWrite(dc, LOW);
digitalWrite(cs, LOW);
spiwrite(c);
digitalWrite(cs, HIGH);
}
示例9: digitalWrite
void Adafruit_HX8357::writedata(uint8_t c) {
digitalWrite(_dc, HIGH);
digitalWrite(_sclk, LOW);
digitalWrite(_cs, LOW);
spiwrite(c);
digitalWrite(_cs, HIGH);
}
示例10: switch
void Adafruit_SSD1331::drawPixel(int16_t x, int16_t y, uint16_t color)
{
if ((x < 0) || (x >= width()) || (y < 0) || (y >= height())) return;
// check rotation, move pixel around if necessary
switch (getRotation()) {
case 1:
swap(x, y);
x = WIDTH - x - 1;
break;
case 2:
x = WIDTH - x - 1;
y = HEIGHT - y - 1;
break;
case 3:
swap(x, y);
y = HEIGHT - y - 1;
break;
}
goTo(x, y);
// setup for data
*portOutputRegister(rsport) |= rspin;
*portOutputRegister(csport) &= ~ cspin;
spiwrite(color >> 8);
spiwrite(color);
*portOutputRegister(csport) |= cspin;
}
开发者ID:frostfire1337,项目名称:Adafruit-SSD1331-OLED-Driver-Library-for-Arduino,代码行数:31,代码来源:Adafruit_SSD1331.cpp
示例11: st7565_data
void st7565_data(uint8_t c) {
A0_PORT |= _BV(A0);
CSACTIVE;
spiwrite(c);
CSPASSIVE;
}
示例12: WriteEnable
uint32_t SPIFlash::EraseChip (void)
{
// Wait until the device is ready or a timeout occurs
if (WaitForReady())
return 0;
// Make sure the chip is write enabled
WriteEnable (1);
// Make sure the write enable latch is actually set
uint8_t status;
status = readstatus();
if (!(status & SPIFLASH_STAT_WRTEN))
{
// Throw a write protection error (write enable latch not set)
return 0;
}
// Send the erase chip command
digitalWrite(_ss, LOW);
spiwrite(W25Q16BV_CMD_CHIPERASE);
digitalWrite(_ss, HIGH);
// Wait until the busy bit is cleared before exiting
// This can take up to 10 seconds according to the datasheet!
while (readstatus() & SPIFLASH_STAT_BUSY);
return 1;
}
示例13: main
int main()
{
int k;
DDRB = (1 << PB7) | (1 << PB5) | (1 << PB4) | (1 << PB3) | (1 << PB2) ; // SCK, MOSI, CE. D/C and RST outputs
SPCR = (1<<SPE) | (1<<MSTR) | (1<<SPR1); //Enable SPI, Master, set clock rate fck/16
PORTB &= ~RST;
delay_100us(1);
PORTB = RST;
spiwrite(0x21); // extended instruction mode
spiwrite(0x90); // Vop
//spiwrite(0x14); // bias to 100b
//spiwrite(0x20); // normal instruction mode
spiwrite(0x0D); // normal mode
PORTB |= DOC; // enter data mode
for(;;) //k = 0; k < 5; ++k)
{
spiwrite(0x1f);
spiwrite(0x5);
spiwrite(0x7);
spiwrite(0x0);
}
return 0;
}
示例14: spiwrite
void GL_ST7735::pushColor(uint16_t color) {
*portOutputRegister(rsport) |= rspin;
*portOutputRegister(csport) &= ~ cspin;
spiwrite(color >> 8);
spiwrite(color);
*portOutputRegister(csport) |= cspin;
}
示例15: digitalWrite
void Adafruit_SSD1351::writeData(uint8_t c) {
digitalWrite(_rs, HIGH);
digitalWrite(_cs, LOW);
// Serial.print("D ");
spiwrite(c);
digitalWrite(_cs, HIGH);
}