本文整理汇总了C++中spiwrite函数的典型用法代码示例。如果您正苦于以下问题:C++ spiwrite函数的具体用法?C++ spiwrite怎么用?C++ spiwrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spiwrite函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Cdixon1526,项目名称:RFDUINO-Adafruit_HX8357-compatible,代码行数:25,代码来源:Adafruit_HX8357.cpp
示例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
}
开发者ID:FrancescoErmini,项目名称:ThesisTest,代码行数:51,代码来源:Adafruit_PN532.cpp
示例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
}
开发者ID:wasdpkj,项目名称:Microduino-IDE-Support,代码行数:14,代码来源:Adafruit_VS1053.cpp
示例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);
}
开发者ID:microbuilder,项目名称:spiflash,代码行数:14,代码来源:SPIFlash.cpp
示例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;
}
开发者ID:dysanf,项目名称:WaveGlide,代码行数:34,代码来源:Adafruit_SSD1351.cpp
示例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 */
}
开发者ID:GadgetFactory,项目名称:DesignLab,代码行数:26,代码来源:SmallFS.cpp
示例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
}
开发者ID:kylestew,项目名称:CreativeCoding,代码行数:7,代码来源:TFT_ILI9163C.cpp
示例8: digitalWrite
void SSD1306::ssd1306_command(uint8_t c) {
digitalWrite(cs, HIGH);
digitalWrite(dc, LOW);
digitalWrite(cs, LOW);
spiwrite(c);
digitalWrite(cs, HIGH);
}
开发者ID:Rhapsody950521,项目名称:GoKit-Arduino-MCU,代码行数:7,代码来源:SSD1306.cpp
示例9: digitalWrite
void Adafruit_HX8357::writedata(uint8_t c) {
digitalWrite(_dc, HIGH);
digitalWrite(_sclk, LOW);
digitalWrite(_cs, LOW);
spiwrite(c);
digitalWrite(_cs, HIGH);
}
开发者ID:Cdixon1526,项目名称:RFDUINO-Adafruit_HX8357-compatible,代码行数:7,代码来源:Adafruit_HX8357.cpp
示例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;
}
开发者ID:MattDurr,项目名称:HomeAutomationLabs,代码行数:7,代码来源:stlcd.c
示例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;
}
开发者ID:microbuilder,项目名称:spiflash,代码行数:29,代码来源:SPIFlash.cpp
示例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;
}
开发者ID:georgesk,项目名称:expeyes-web,代码行数:28,代码来源:spitest.c
示例14: spiwrite
void GL_ST7735::pushColor(uint16_t color) {
*portOutputRegister(rsport) |= rspin;
*portOutputRegister(csport) &= ~ cspin;
spiwrite(color >> 8);
spiwrite(color);
*portOutputRegister(csport) |= cspin;
}
开发者ID:vaj4088,项目名称:LCD_Experiments,代码行数:9,代码来源:GL_ST7735.cpp
示例15: digitalWrite
void Adafruit_SSD1351::writeData(uint8_t c) {
digitalWrite(_rs, HIGH);
digitalWrite(_cs, LOW);
// Serial.print("D ");
spiwrite(c);
digitalWrite(_cs, HIGH);
}
开发者ID:codiak6335,项目名称:Adafruit_SSD1351_Library,代码行数:9,代码来源:Adafruit_SSD1351.cpp
示例16: digitalWrite
void Zpu_ILI9340::writedata(uint8_t c) {
digitalWrite(_dc, HIGH);
digitalWrite(_sclk, LOW);
digitalWrite(_cs, LOW);
spiwrite(c);
digitalWrite(_cs, HIGH);
}
开发者ID:yukiyahakase,项目名称:sample,代码行数:9,代码来源:Zpu_ILI9340.cpp
示例17: spiwrite
void Adafruit_ST7735::writedata(uint8_t c) {
*rsport |= rspinmask;
*csport &= ~cspinmask;
//Serial.print("D ");
spiwrite(c);
*csport |= cspinmask;
}
开发者ID:mokipcs,项目名称:Adafruit-ST7735-Library,代码行数:9,代码来源:Adafruit_ST7735.cpp
示例18: digitalWrite
uint8_t Adafruit_PN532::readspistatus(void) {
digitalWrite(_ss, LOW);
delay(2);
spiwrite(PN532_SPI_STATREAD);
// read byte
uint8_t x = spiread();
digitalWrite(_ss, HIGH);
return x;
}
开发者ID:FrancescoErmini,项目名称:ThesisTest,代码行数:10,代码来源:Adafruit_PN532.cpp
示例19: spiwrite
void Adafruit_SSD1331::pushColor(uint16_t color) {
// 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,代码行数:10,代码来源:Adafruit_SSD1331.cpp
注:本文中的spiwrite函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论