MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / modSPITxCommon

Function modSPITxCommon

modules/pins/spi/esp/modSPI.c:436–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436static void modSPITxCommon(modSPIConfiguration config, uint8_t *data, uint16_t count, uint8_t endian, modSPIBufferLoader loader)
437{
438 uint8_t loaded;
439
440 if (3 & (int)data) {
441 modLog("SPI tx data address not long aligned");
442 return;
443 }
444
445 modSPIActivateConfiguration(config);
446
447 if (kSPIEndianLittle == endian)
448 WRITE_PERI_REG(SPI_FLASH_USER(HSPI), SPI_FLASH_DOUT);
449 else
450 WRITE_PERI_REG(SPI_FLASH_USER(HSPI), SPI_FLASH_DOUT | SPI_WR_BYTE_ORDER); // byte swap each 32-bit long as it is transmitted
451
452 loaded = (loader)(data, (count <= SPI_BUFFER_SIZE) ? count : SPI_BUFFER_SIZE);
453 if (loaded >= count)
454 gSPIDataCount = 0;
455 else {
456 gSPIBufferLoader = loader;
457 gSPIData = data + loaded;
458 gSPIDataCount = count - loaded;
459 }
460
461 modSPIStartSend();
462
463 if (config->sync)
464 modSPIFlush();
465}
466
467void modSPITx(modSPIConfiguration config, uint8_t *data, uint16_t count)
468{

Callers 6

modSPITxFunction · 0.70
modSPITxSwap16Function · 0.70
modSPITxRGB332To16BEFunction · 0.70
modSPITxGray256To16BEFunction · 0.70
modSPITxGray16To16BEFunction · 0.70
modSPITxCLUT16To16BEFunction · 0.70

Calls 3

modSPIStartSendFunction · 0.85
modSPIFlushFunction · 0.70

Tested by

no test coverage detected