Skip to content

Commit ee724e8

Browse files
committed
WiFi: use default instance if available
1 parent a66db5b commit ee724e8

File tree

11 files changed

+73
-63
lines changed

11 files changed

+73
-63
lines changed

examples/ArduinoOnMbed/ArduinoOnMbed.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "WiFi.h"
22
#include "WiFiSSLClient.h"
33
//#include "WiFiESP8266.h"
4-
#include "WiFiODINW2.h"
4+
//#include "WiFiODINW2.h"
55
#include "TLSSocket.h"
66
#include <MQTTClient.h>
77

@@ -36,7 +36,7 @@ const char CA_CERTIFICATES[] = "-----BEGIN CERTIFICATE-----\n"
3636
"-----END CERTIFICATE-----\n";
3737

3838

39-
#define TEST_SSL
39+
//#define TEST_SSL
4040

4141
#ifndef TEST_SSL
4242
WiFiClient net;
@@ -45,6 +45,8 @@ WiFiSSLClient net;
4545
#endif
4646
MQTTClient client;
4747

48+
#define Serial Serial1
49+
4850
unsigned long lastMillis = 0;
4951

5052
void messageReceived(String &topic, String &payload) {
@@ -58,17 +60,16 @@ void setup() {
5860
String b = a + 12;
5961
String c = a + "18";
6062
Serial.begin(115200);
63+
while (!Serial) {}
6164
delay(100);
6265
Serial.println(a);
6366
Serial.println(b);
6467
Serial.println(c);
6568
a += "68";
6669
Serial.println(a);
67-
//delay(2000);
68-
Serial.println(USBRX);
69-
Serial.println(USBTX);
70+
delay(2000);
7071
printf("now\n\r");
71-
int ret = WiFi.begin("BCMI", "ArduinoccRulez");
72+
int ret = WiFi.begin("AndroidCulo", "Sesamo1.");
7273
Serial.println("Wifibegin " + String(ret));
7374

7475
#ifndef TEST_SSL

examples/Demo_CES_mjpeg/Demo_CES_mjpeg.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void setup() {
5959
//edid_set_framebuffer_bits_per_pixel(&recognized_edid, 16, 0);
6060
//set_display_mode(&recognized_edid, EDID_MODE_720x480_60Hz);
6161
//anx7625_dp_start(0, &recognized_edid, EDID_MODE_1280x720_60Hz);
62-
anx7625_dp_start(0, &recognized_edid);
62+
anx7625_dp_start(0, &recognized_edid, EDID_MODE_800x600_59Hz);
6363

6464
SDRAM.begin(getFramebufferEnd());
6565

@@ -111,10 +111,11 @@ void setup() {
111111
LCD_X_Size = stm32_getXSize();
112112
LCD_Y_Size = stm32_getYSize();
113113

114-
/*
114+
while (1) {
115115
stm32_LCD_DrawImage((void*)texture_raw, (void *)getNextFrameBuffer(), 300, 300, DMA2D_INPUT_RGB565);
116116
stm32_LCD_DrawImage((void*)texture_raw, (void *)getNextFrameBuffer(), 300, 300, DMA2D_INPUT_RGB565);
117-
*/
117+
}
118+
118119
JPEG_Handle.Instance = JPEG;
119120
HAL_JPEG_Init(&JPEG_Handle);
120121
}

examples/Doom/Doom.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#include "QSPIFBlockDevice.h"
1+
#include "SDMMCBlockDevice.h"
22
#include "FATFileSystem.h"
33
#include "doomgeneric.h"
44

5-
QSPIFBlockDevice block_device(PD_11, PD_12, PF_7, PD_13,
6-
PF_10, PG_6, QSPIF_POLARITY_MODE_1, MBED_CONF_QSPIF_QSPI_FREQ);
5+
SDMMCBlockDevice block_device;
76

87
mbed::FATFileSystem fs("fs");
98

examples/Envie_camera/Envie_camera.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ mbed::DigitalOut pin(PD_4);
77
void setup() {
88

99
Serial.begin(115200);
10+
while (!Serial);
1011
pin = 1;
11-
delay(1000);
1212

1313
// put your setup code here, to run once:
1414
cam.begin();
1515
cam.snapshot();
16+
1617
}
1718

1819
void loop() {

examples/RPC_m4/RPC_m4.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ void loop() {
1717
digitalWrite(LED_BUILTIN, LOW);
1818
delay(1000);
1919
RPC1.println("test");
20-
auto res = RPC1.client.call("add", 12, 45).as<int>();;
21-
RPC1.println(res);
20+
//auto res = RPC1.client.call("add", 12, 45).as<int>();;
21+
//RPC1.println(res);
2222
}

libraries/ENVIE_Camera/camera.cpp

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#define LCD_FRAME_BUFFER 0xC0000000 /* LCD Frame buffer of size 800x480 in ARGB8888 */
88
#define CAMERA_FRAME_BUFFER 0xC0200000
99

10-
#define QVGA_RES_X 320
11-
#define QVGA_RES_Y 240
10+
#define QVGA_RES_X 96
11+
#define QVGA_RES_Y 96
1212

13-
#define CAM_W_RES 324
14-
#define CAM_H_RES 244
13+
#define CAM_W_RES 96
14+
#define CAM_H_RES 96
1515
#define CAM_PIXEL_IMAGE_SIZE (CAM_H_RES * CAM_W_RES)
1616
#define SKIP_FRAMES 10
1717

@@ -206,12 +206,17 @@ uint8_t BSP_CAMERA_Init(uint32_t Resolution)
206206
BSP_CAMERA_MspInit(&hdcmi_discovery, NULL);
207207
HAL_DCMI_Init(phdcmi);
208208

209+
/*
210+
* @param YSize DCMI Line number
211+
* @param XSize DCMI Pixel per line
212+
* @param X0 DCMI window X offset
213+
* @param Y0 DCMI window Y offset
214+
* @retval HAL status
215+
*/
216+
//HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize)
217+
209218
/*
210-
HAL_DCMI_ConfigCROP(phdcmi, // Crop in the middle of the VGA picture
211-
(CAMERA_VGA_RES_X - CAMERA_480x272_RES_X)/2,
212-
(CAMERA_VGA_RES_Y - CAMERA_480x272_RES_Y)/2,
213-
(CAMERA_480x272_RES_X * 2) - 1,
214-
CAMERA_480x272_RES_Y - 1);
219+
HAL_DCMI_ConfigCROP(phdcmi, (324 - 96) / 2, (244 - 96 / 2), 96, 96);
215220
HAL_DCMI_EnableCROP(phdcmi);
216221
*/
217222

@@ -367,7 +372,7 @@ static uint32_t GetSize(uint32_t Resolution)
367372
break;
368373
case CAMERA_R320x240:
369374
{
370-
size = 324 * 244;
375+
size = 96 * 96;
371376
}
372377
break;
373378
case CAMERA_R480x272:
@@ -399,7 +404,7 @@ void BSP_CAMERA_ErrorCallback(void)
399404

400405
void BSP_CAMERA_FrameEventCallback(void)
401406
{
402-
camera_frame_ready = 1;
407+
camera_frame_ready++;
403408
}
404409

405410

@@ -472,65 +477,68 @@ void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
472477
}
473478

474479

475-
int CameraClass::begin(void)
480+
int CameraClass::begin(int horizontalResolution, int verticalResolution)
476481
{
477482
CameraResX = QVGA_RES_X;
478483
CameraResY = QVGA_RES_Y;
479484

480485
SDRAM.begin(LCD_FRAME_BUFFER);
481486

482-
for (int i=0; i<1000; i++) {
483-
*((uint8_t*)LCD_FRAME_BUFFER + i) = 0x55;
484-
}
485-
486-
printf("Clean ram\n");
487-
488-
for (int i=0; i<1000; i++) {
489-
printf("%02x ", *((uint8_t*)LCD_FRAME_BUFFER + i));
490-
if (i % 16 == 0) {
491-
printf("\n");
492-
}
493-
}
494-
495487
/*## Camera Initialization and capture start ############################*/
496488
/* Initialize the Camera in QVGA mode */
497489
if(BSP_CAMERA_Init(CAMERA_R320x240) != 1)
498490
{
499-
printf("BSP_CAMERA_Init failed\n");
500491
return 0;
501492
}
502493

503494
}
504495

505-
int CameraClass::snapshot(void)
496+
int CameraClass::start(void)
506497
{
507-
printf("Start snapshot\n");
508498
HIMAX_Mode(HIMAX_Streaming);
509499

510500
/* Start the Camera Snapshot Capture */
511-
BSP_CAMERA_SnapshotStart((uint8_t *)LCD_FRAME_BUFFER);
512-
//BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER);
501+
BSP_CAMERA_ContinuousStart((uint8_t *)LCD_FRAME_BUFFER);
513502

514503
/* Wait until camera frame is ready : DCMI Frame event */
515504
while(camera_frame_ready == 0)
516505
{
517506
}
507+
}
518508

519-
delay(100);
509+
uint8_t* CameraClass::grab(void)
510+
{
511+
HIMAX_Mode(HIMAX_Streaming);
520512

521-
printf("Snapshot done\n");
522-
523-
printf("Print ram\n");
513+
/* Start the Camera Snapshot Capture */
514+
BSP_CAMERA_ContinuousStart((uint8_t *)LCD_FRAME_BUFFER);
524515

525-
for (int i=0; i<1000; i++) {
526-
printf("%02x ", *((uint8_t*)LCD_FRAME_BUFFER + i));
527-
if (i % 16 == 0) {
528-
printf("\n");
529-
}
516+
/* Wait until camera frame is ready : DCMI Frame event */
517+
while(camera_frame_ready == 0)
518+
{
530519
}
520+
}
521+
522+
uint8_t* CameraClass::snapshot(void)
523+
{
524+
printf("Start snapshot\n");
525+
HIMAX_Mode(HIMAX_Streaming);
526+
527+
/* Start the Camera Snapshot Capture */
528+
BSP_CAMERA_SnapshotStart((uint8_t *)LCD_FRAME_BUFFER);
529+
530+
/* Wait until camera frame is ready : DCMI Frame event */
531+
while(camera_frame_ready == 0)
532+
{
533+
}
534+
535+
HIMAX_Mode(HIMAX_Standby);
536+
531537
/* Stop the camera to avoid having the DMA2D work in parallel of Display */
532538
/* which cause perturbation of LTDC */
533-
BSP_CAMERA_Stop();
539+
BSP_CAMERA_Suspend();
540+
541+
return (uint8_t *)LCD_FRAME_BUFFER;
534542
}
535543

536544

libraries/ENVIE_SDRAM/SDRAM.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extern "C" {
55

66
int SDRAMClass::begin(uint32_t start_address) {
77

8+
printf("FMC_SDRAM_DEVICE->SDCMR: %x\n", FMC_SDRAM_DEVICE->SDCMR);
89
if (FMC_SDRAM_DEVICE->SDCMR == 0x00000000U) {
910
printf("initializing external ram\n");
1011
bool ret = sdram_init();

libraries/Himax_HM01B0/himax.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ static regval_list_t himax_default_regs[] = {
157157
{0x3010, 0x01}, // 324 x 244 pixel
158158
{0x0383, 0x01},
159159
{0x0387, 0x01},
160-
{0x0390, 0x00},
160+
{0x0390, 0x03},
161161
{0x3011, 0x70},
162162
{0x3059, 0x02},
163163
{0x3060, 0x00},
164+
//{0x0601, 0x01},
164165
{IMG_ORIENTATION, 0x01}, // change the orientation
165166
{0x0104, 0x01}
166167
};

libraries/WiFi/src/WiFi.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ NetworkInterface *arduino::WiFiClass::getNetwork() {
5757
return wifi_if;
5858
}
5959

60+
#if defined(ARDUINO_ENVIE_M7) || defined(ARDUINO_ENVIE_M4)
61+
arduino::WiFiClass WiFi(WiFiInterface::get_default_instance());
62+
#endif
63+
6064
// every specialization library should declare its own WiFI object: eg
6165
//
6266
// static ESP8266Interface wifi_if(PD_8, PD_9);

variants/MTB_MURATA_ABZ/defines.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
-DDEVICE_USTICKER=1
3535
-DDEVICE_WATCHDOG=1
3636
-D__MBED__=1
37-
-DMBED_BUILD_TIMESTAMP=1578671453.0131822
37+
-DMBED_BUILD_TIMESTAMP=1580311026.79433
3838
-D__MBED_CMSIS_RTOS_CM
3939
-DTARGET_CORTEX
4040
-DTARGET_CORTEX_M

variants/MTB_MURATA_ABZ/includes.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
-iwithprefixbefore/mbed/platform/cxxsupport
1515
-iwithprefixbefore/mbed/platform
1616
-iwithprefixbefore/mbed/hal/usb
17-
-iwithprefixbefore/mbed/hal/storage_abstraction
1817
-iwithprefixbefore/mbed/hal
19-
-iwithprefixbefore/mbed/features/unsupported/dsp/dsp
20-
-iwithprefixbefore/mbed/features/unsupported/dsp/cmsis_dsp
21-
-iwithprefixbefore/mbed/features/unsupported/dsp/
22-
-iwithprefixbefore/mbed/features/storage/system_storage
23-
-iwithprefixbefore/mbed/features/storage/nvstore
2418
-iwithprefixbefore/mbed/features/storage/kvstore/tdbstore
2519
-iwithprefixbefore/mbed/features/storage/kvstore/securestore
2620
-iwithprefixbefore/mbed/features/storage/kvstore/kv_map

0 commit comments

Comments
 (0)