| 105 | } |
| 106 | |
| 107 | void modSPIActivateConfiguration(modSPIConfiguration config) |
| 108 | { |
| 109 | modSPIFlush(); |
| 110 | |
| 111 | if (config == gConfig) |
| 112 | return; |
| 113 | |
| 114 | if (gConfig) { |
| 115 | (gConfig->doChipSelect)(0, gConfig); |
| 116 | if (!config) { |
| 117 | gConfig = config; |
| 118 | return; |
| 119 | } |
| 120 | if (config->reserved == gConfig->reserved) { |
| 121 | gConfig = config; |
| 122 | (gConfig->doChipSelect)(1, gConfig); |
| 123 | return; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | gConfig = config; |
| 128 | if (gConfig) { |
| 129 | WRITE_PERI_REG(SPI_FLASH_CLOCK(HSPI), gConfig->reserved); |
| 130 | |
| 131 | (gConfig->doChipSelect)(1, gConfig); |
| 132 | } |
| 133 | |
| 134 | if (config) |
| 135 | modSPISetMode(config->mode); |
| 136 | } |
| 137 | |
| 138 | // data must be long aligned |
| 139 | uint8_t ICACHE_RAM_ATTR modSpiLoadBufferAsIs(uint8_t *data, uint8_t bytes) |
no test coverage detected