| 524 | } |
| 525 | |
| 526 | void doCmd(ssd1606 ssd, uint8_t cmd) |
| 527 | { |
| 528 | #if MODDEF_SSD1306_SPI |
| 529 | SCREEN_CS_DEACTIVE; // inactive in sample when toggling DC |
| 530 | SCREEN_DC_COMMAND; |
| 531 | SCREEN_CS_ACTIVE; |
| 532 | modSPITx(&ssd->config.spi, &cmd, 1); |
| 533 | modSPIFlush(); |
| 534 | #elif MODDEF_SSD1306_I2C |
| 535 | uint8_t data[2] = {0, cmd}; |
| 536 | uint8_t err = modI2CWrite(&ssd->config.i2c, data, 2, true); |
| 537 | if (err) { |
| 538 | xsMachine *the = ssd->the; |
| 539 | xsUnknownError("command failed"); |
| 540 | } |
| 541 | #endif |
| 542 | } |
| 543 | |
| 544 | #if MODDEF_SSD1306_SPI |
| 545 | void ssd1306ChipSelect(uint8_t active, modSPIConfiguration config) |
no test coverage detected