| 326 | i2c_dma_init_intern(i2c_dma); |
| 327 | } |
| 328 | I2CMasterInterface::I2CMasterInterface(uint8_t block, int8_t sda, int8_t scl, uint32_t clock) : m_sda(sda), m_scl(scl), m_clock(clock) |
| 329 | { |
| 330 | if (sda == -1 || scl == -1) |
| 331 | { |
| 332 | i2c = nullptr; |
| 333 | return; |
| 334 | } |
| 335 | i2c = _hardwareBlocks[block]; |
| 336 | printf("i2c: %d %d %d %d\r\n", sda, scl, block, clock); |
| 337 | // if we have already set up DMA, then we do not want to set it up again |
| 338 | if ((i2c == i2c0 && i2c_dma_list[0].device_count == 0) || (i2c == i2c1 && i2c_dma_list[1].device_count == 0)) |
| 339 | { |
| 340 | i2c_init(i2c, clock); |
| 341 | gpio_set_function(sda, GPIO_FUNC_I2C); |
| 342 | gpio_set_function(scl, GPIO_FUNC_I2C); |
| 343 | |
| 344 | gpio_pull_up(sda); |
| 345 | gpio_pull_up(scl); |
| 346 | printf("setup!\r\n"); |
| 347 | } |
| 348 | } |
| 349 | I2CMasterInterface::~I2CMasterInterface() |
| 350 | { |
| 351 | } |
nothing calls this directly
no outgoing calls
no test coverage detected