|
28 | 28 | #define ALIGN_PTR(p,a) ((p & (a-1)) ?(((uintptr_t)p + a) & ~(uintptr_t)(a-1)) : p)
|
29 | 29 |
|
30 | 30 | // Include all image sensor drivers here.
|
31 |
| -#ifdef ARDUINO_PORTENTA_H7_M7 |
| 31 | +#if defined (ARDUINO_PORTENTA_H7_M7) || defined (ARDUINO_PORTENTA_H7_M4) |
32 | 32 |
|
33 | 33 | #define DCMI_TIM (TIM1)
|
34 | 34 | #define DCMI_TIM_PIN (GPIO_PIN_1)
|
@@ -65,7 +65,7 @@ arduino::MbedI2C CameraWire(I2C_SDA2, I2C_SCL2);
|
65 | 65 |
|
66 | 66 | // DCMI GPIO pins struct
|
67 | 67 | static const struct { GPIO_TypeDef *port; uint16_t pin; } dcmi_pins[] = {
|
68 |
| -#ifdef ARDUINO_PORTENTA_H7_M7 |
| 68 | +#if defined (ARDUINO_PORTENTA_H7_M7) || defined (ARDUINO_PORTENTA_H7_M4) |
69 | 69 | {GPIOA, GPIO_PIN_4 },
|
70 | 70 | {GPIOA, GPIO_PIN_6 },
|
71 | 71 | {GPIOI, GPIO_PIN_4 },
|
@@ -146,7 +146,7 @@ void HAL_DCMI_MspInit(DCMI_HandleTypeDef *hdcmi)
|
146 | 146 | hgpio.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
147 | 147 | hgpio.Alternate = GPIO_AF13_DCMI;
|
148 | 148 |
|
149 |
| -#ifdef ARDUINO_PORTENTA_H7_M7 |
| 149 | +#if defined (ARDUINO_PORTENTA_H7_M7) || defined (ARDUINO_PORTENTA_H7_M4) |
150 | 150 | /* Enable GPIO clocks */
|
151 | 151 | __HAL_RCC_GPIOA_CLK_ENABLE();
|
152 | 152 | __HAL_RCC_GPIOH_CLK_ENABLE();
|
@@ -365,7 +365,7 @@ Camera::Camera(ImageSensor &sensor) :
|
365 | 365 |
|
366 | 366 | int Camera::reset()
|
367 | 367 | {
|
368 |
| -#ifdef ARDUINO_PORTENTA_H7_M7 |
| 368 | +#if defined (ARDUINO_PORTENTA_H7_M7) || defined (ARDUINO_PORTENTA_H7_M4) |
369 | 369 | // Reset sensor.
|
370 | 370 | digitalWrite(PC_13, LOW);
|
371 | 371 | HAL_Delay(10);
|
@@ -605,9 +605,10 @@ int Camera::grabFrame(FrameBuffer &fb, uint32_t timeout)
|
605 | 605 |
|
606 | 606 | HAL_DCMI_Suspend(&hdcmi);
|
607 | 607 |
|
608 |
| - // Invalidate buffer after DMA transfer. |
609 |
| - SCB_InvalidateDCache_by_Addr((uint32_t*) framebuffer, framesize); |
610 |
| - |
| 608 | + #if defined(__CORTEX_M7) // only invalidate buffer for Cortex M7 |
| 609 | + // Invalidate buffer after DMA transfer. |
| 610 | + SCB_InvalidateDCache_by_Addr((uint32_t*) framebuffer, framesize); |
| 611 | + #endif |
611 | 612 | return 0;
|
612 | 613 | }
|
613 | 614 |
|
|
0 commit comments