Skip to content

RPC library API docs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2f38268
add ping
paulvha Feb 16, 2024
7af8623
ping: fix alignment
andreagilardoni Nov 21, 2024
46e6416
ping: make api compatible to WiFiNINA and WiFi101
pennam Nov 22, 2024
030bdf8
ping: fix timeout in case of count > 1
pennam Nov 22, 2024
fec1109
ping: add missing method
pennam Nov 22, 2024
4974e2f
WiFiPing: add info about minimum required firmware version
pennam Nov 27, 2024
3a81b22
WiFiPing: remove WIFI_FIRMWARE_LATEST_VERSION check
pennam Nov 27, 2024
9f0dc38
Merge pull request #395 from andreagilardoni/ping
pennam Nov 27, 2024
fee8ca9
freertos: start scheduler and loop task on header inclusion
facchinm Jun 26, 2024
9666fc2
codestyle unification
andreagilardoni May 27, 2024
af0787a
added possibility to get fw version of wifi module as uint32
andreagilardoni May 27, 2024
66e417a
Merge pull request #326 from andreagilardoni/wifi-uint32-version
pennam Nov 27, 2024
e817519
Unifying codestyle
andreagilardoni Jul 17, 2024
ccd5d5c
Improving parse function in modem class
andreagilardoni Jul 17, 2024
cf5ea5e
adding a third level of debug
andreagilardoni Jul 18, 2024
f33f6e3
removing unused methods
andreagilardoni Jul 22, 2024
69dbc7d
Merge pull request #349 from andreagilardoni/at-improvements
pennam Nov 27, 2024
0f3333b
[preferences] adding getType command
andreagilardoni Nov 14, 2024
30ba157
[preferences] improving string get and put
andreagilardoni Nov 14, 2024
0901777
[preferences] add example for type support checking
pennam Nov 27, 2024
7c59871
Merge pull request #393 from andreagilardoni/prefernces-fixes
pennam Nov 28, 2024
428df2a
Merge pull request #369 from facchinm/freertos_wrap_loop
pennam Nov 28, 2024
8094bbf
implementing non blocking download functions in ota interface
andreagilardoni May 24, 2024
d8c676b
adding example for ota non blocking download
andreagilardoni May 24, 2024
3bd4ebd
OTANonBlocking: add info about minimum required firmware version
pennam Nov 28, 2024
1085b24
Initialize local variable for AP config
alrvid Nov 28, 2024
1c4b997
Merge pull request #325 from andreagilardoni/non-blocking-ota-download
pennam Nov 28, 2024
7cfd0e7
examples: uno r4 wifi fix print about required firmware version
pennam Nov 28, 2024
e6500c1
WiFiS3 ping add missing parameter
pennam Nov 28, 2024
ea4ccce
Merge pull request #400 from arduino/alrvid-patch-1
sebromero Nov 28, 2024
983e92b
WiFiUdp: fix Wsign-compare
pennam Nov 28, 2024
1b27373
WiFiSSLClient: fix Wsign-compare
pennam Nov 28, 2024
ba39680
WiFiFileSystem: add missing return value
pennam Nov 28, 2024
9172976
WiFiClient: fix Wreorder
pennam Nov 28, 2024
0a0e7a4
WiFiClient: fix Wsign-compare
pennam Nov 28, 2024
118cdb0
WiFi: remove unused variable
pennam Nov 28, 2024
6bac645
Modem: suppress Wunused-parameter
pennam Nov 28, 2024
75bbb30
Modem: add explicit fall through
pennam Nov 28, 2024
c7ad094
TextWithArduinoGraphics: add note about ArduinoGraphics dependency (#…
pennam Nov 28, 2024
96f3a8c
Merge pull request #403 from pennam/ping-param-fix
pennam Nov 28, 2024
8bb82e1
Merge pull request #402 from pennam/fw-version-fix
pennam Nov 28, 2024
04d998d
Merge pull request #404 from pennam/wifis3-warnings
pennam Nov 28, 2024
443a404
Serial: split uart events TX_COMPLETE from TX_DATA_EMPTY
Hsubtnarg May 28, 2024
51e2905
Serial: initialize tx flags to avoid locks
pennam Nov 29, 2024
03b4a91
Merge pull request #405 from pennam/fix-flush
pennam Nov 29, 2024
149197b
Preferences: adding missing return statement
andreagilardoni Dec 4, 2024
7535391
Merge pull request #410 from andreagilardoni/preferences-hotfix
pennam Dec 4, 2024
95113d2
Publish 1.3.1
pennam Dec 5, 2024
3a3cfe4
Move freertos hook between setup() and loop()
facchinm Dec 9, 2024
acb578e
Provide FreeRTOS hook only for PortentaC33
facchinm Dec 9, 2024
b83fd20
freertos: declare start_freertos_on_header_inclusion only if required
facchinm Dec 12, 2024
51b909d
Merge pull request #414 from facchinm/freertos_hook_move
facchinm Dec 12, 2024
3f6a552
RPC api docs added
BenjaminDannegard Dec 18, 2024
4ee9347
Added api.md file for RTC
BenjaminDannegard Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ portenta_c33.build.fpu=-mfpu=fpv5-sp-d16
portenta_c33.build.float-abi=-mfloat-abi=hard

portenta_c33.build.board=PORTENTA_C33
portenta_c33.build.defines=-DF_CPU=200000000
portenta_c33.build.defines=-DF_CPU=200000000 -DPROVIDE_FREERTOS_HOOK
portenta_c33.vid.0=0x2341
portenta_c33.pid.0=0x0068
portenta_c33.vid.1=0x2341
Expand Down
28 changes: 17 additions & 11 deletions cores/arduino/Serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ void UART::WrapperCallback(uart_callback_args_t *p_args) {
{
break;
}
case UART_EVENT_TX_COMPLETE:
case UART_EVENT_TX_DATA_EMPTY:
case UART_EVENT_TX_COMPLETE: // This is call when the transmission is complete
{
//uint8_t to_enqueue = uart_ptr->txBuffer.available() < uart_ptr->uart_ctrl.fifo_depth ? uart_ptr->txBuffer.available() : uart_ptr->uart_ctrl.fifo_depth;
//while (to_enqueue) {
uart_ptr->tx_done = true;
uart_ptr->tx_complete = true;
break;
}
case UART_EVENT_TX_DATA_EMPTY: // This is called when the buffer is empty
{ // Last byte is transmitting, but ready for more data
uart_ptr->tx_empty = true;
break;
}
case UART_EVENT_RX_CHAR:
Expand All @@ -87,6 +89,8 @@ UART::UART(int _pin_tx, int _pin_rx, int _pin_rts, int _pin_cts):
rx_pin(_pin_rx),
rts_pin(_pin_rts),
cts_pin(_pin_cts),
tx_empty(true),
tx_complete(true),
init_ok(false) {
/* -------------------------------------------------------------------------- */
uart_cfg.txi_irq = FSP_INVALID_VECTOR;
Expand All @@ -109,9 +113,10 @@ bool UART::setUpUartIrqs(uart_cfg_t &cfg) {
size_t UART::write(uint8_t c) {
/* -------------------------------------------------------------------------- */
if(init_ok) {
tx_done = false;
tx_empty = false;
tx_complete = false;
R_SCI_UART_Write(&uart_ctrl, &c, 1);
while (!tx_done) {}
while (!tx_empty) {}
return 1;
}
else {
Expand All @@ -121,9 +126,10 @@ size_t UART::write(uint8_t c) {

size_t UART::write(uint8_t* c, size_t len) {
if(init_ok) {
tx_done = false;
tx_empty = false;
tx_complete = false;
R_SCI_UART_Write(&uart_ctrl, c, len);
while (!tx_done) {}
while (!tx_empty) {}
return len;
}
else {
Expand Down Expand Up @@ -322,7 +328,7 @@ int UART::read() {
/* -------------------------------------------------------------------------- */
void UART::flush() {
/* -------------------------------------------------------------------------- */
while(txBuffer.available());
while(!tx_complete);
}

/* -------------------------------------------------------------------------- */
Expand All @@ -335,4 +341,4 @@ size_t UART::write_raw(uint8_t* c, size_t len) {
i++;
}
return len;
}
}
3 changes: 2 additions & 1 deletion cores/arduino/Serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class UART : public arduino::HardwareSerial {
arduino::SafeRingBufferN<SERIAL_BUFFER_SIZE> rxBuffer;
arduino::SafeRingBufferN<SERIAL_BUFFER_SIZE> txBuffer;

volatile bool tx_done;
volatile bool tx_empty;
volatile bool tx_complete;

sci_uart_instance_ctrl_t uart_ctrl;
uart_cfg_t uart_cfg;
Expand Down
4 changes: 4 additions & 0 deletions cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void unsecure_registers() {
#define str(s) #s

extern "C" void Stacktrace_Handler(void);
extern "C" __attribute__((weak)) void start_freertos_on_header_inclusion() {}

void arduino_main(void)
{
Expand Down Expand Up @@ -112,6 +113,9 @@ void arduino_main(void)
#endif
startAgt();
setup();
#ifdef PROVIDE_FREERTOS_HOOK
start_freertos_on_header_inclusion();
#endif
while (1)
{
loop();
Expand Down
23 changes: 23 additions & 0 deletions libraries/Arduino_FreeRTOS/src/portable/FSP/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,29 @@ static void prvTaskExitError(void);

#endif

#ifdef PROVIDE_FREERTOS_HOOK
void loop_thread_func(void* arg) {
while (1)
{
loop();
}
}

static TaskHandle_t loop_task;
void start_freertos_on_header_inclusion() {
xTaskCreate(
(TaskFunction_t)loop_thread_func,
"Loop Thread",
4096 / 4, /* usStackDepth in words */
NULL, /* pvParameters */
4, /* uxPriority */
&loop_task /* pxCreatedTask */
);

vTaskStartScheduler();
}
#endif

/* Arduino specific overrides */
void delay(uint32_t ms) {
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TextAnimation works only when ArduinoGraphics is installed and used.
// ArduinoGraphics is an external library and needs to be installed using
// Library Manager.
// To use ArduinoGraphics APIs, please include BEFORE Arduino_LED_Matrix
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TextAnimation works only when ArduinoGraphics is installed and used.
// ArduinoGraphics is an external library and needs to be installed using
// Library Manager.
// To use ArduinoGraphics APIs, please include BEFORE Arduino_LED_Matrix and TextAnimation
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/ESPhost/examples/ESP32_TEST/ESP32_TEST.ino
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void connectAccessPoint() {
int i = stoi(ap_str);

Serial.println(">>> [APP]: Connecting to Access Point");
WifiApCfg_t ap;
WifiApCfg_t ap{};
memcpy(ap.ssid,access_point_list[i].ssid,SSID_LENGTH);
memcpy(ap.pwd,pwd.c_str(),pwd.size());
memcpy(ap.bssid,access_point_list[i].bssid,BSSID_LENGTH);
Expand Down
139 changes: 139 additions & 0 deletions libraries/OTAUpdate/examples/OTANonBlocking/OTANonBlocking.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
OTANonBlocking

This sketch demonstrates how to make an OTA Update on the UNO R4 WiFi.
Upload the sketch and wait for the invasion!

It requires at least version 0.5.0 of USB Wifi bridge firmware

*/


#include "WiFiS3.h"
#include "OTAUpdate.h"
#include "root_ca.h"
#include "arduino_secrets.h"

char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)

int status = WL_IDLE_STATUS;

OTAUpdate ota;
static char const OTA_FILE_LOCATION[] = "https://downloads.arduino.cc/ota/UNOR4WIFI_Animation.ota";

/* -------------------------------------------------------------------------- */
void setup() {
/* -------------------------------------------------------------------------- */
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the Wi-Fi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with Wi-Fi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}

// attempt to connect to Wi-Fi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);

// wait 1 seconds for connection:
delay(1000);
}

printWiFiStatus();

Serial.println("ota.begin()");
int ret = ota.begin("/update.bin");
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.begin() error: ");
Serial.println((int)ret);
return;
}

Serial.println("ota.setCACert()");
ret = ota.setCACert(root_ca);
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.setCACert() error: ");
Serial.println((int)ret);
return;
}

Serial.println("ota.startDownload()");
int ota_size = ota.startDownload(OTA_FILE_LOCATION, "/update.bin");
if(ota_size <= 0) {
Serial.println("ota.startDownload() error: ");
Serial.println(ota_size);
Serial.println("Make sure your WiFi firmware version is at least 0.5.0");
return;
}

Serial.println("ota.downloadProgress()");
while((ret = ota.downloadProgress()) < ota_size) {
Serial.print("Progress ");
Serial.print(ret);
Serial.print("/");
Serial.println(ota_size);
delay(100);
}

if(ret < 0){
Serial.println("ota.downloadProgress() error: ");
Serial.println((int)ret);
return;
}

Serial.println("ota.verify()");
ret = ota.verify();
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.verify() error: ");
Serial.println((int)ret);
return;
}
\
Serial.println("ota.update()");
ret = ota.update("/update.bin");
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.update() error: ");
Serial.println((int)ret);
return;
}
}

/* -------------------------------------------------------------------------- */
void loop() {
/* -------------------------------------------------------------------------- */
delay(1000);
}

/* -------------------------------------------------------------------------- */
void printWiFiStatus() {
/* -------------------------------------------------------------------------- */
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
2 changes: 2 additions & 0 deletions libraries/OTAUpdate/examples/OTANonBlocking/arduino_secrets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""
Loading
Loading