Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3e6fa13
first upload
elral Aug 16, 2024
3f1f3bd
add generic RP2350B board
elral Aug 16, 2024
2d32c2a
fixed wrong FirmwareBaseName
elral Aug 16, 2024
d65e2ec
reduce frequnecy for shifting data
elral Aug 17, 2024
7d23654
fixed wrong reset file
elral Aug 17, 2024
e0d6204
preliminary board definition to get every board compiled
elral Aug 17, 2024
c7c32cd
better difines for the boards
elral Aug 17, 2024
c73ce6e
for testing inject branch for Pico 2 from Earle Phil Hower
elral Aug 25, 2024
276eec1
Fixed wrong VID/PID for RP2350 boards
elral Aug 26, 2024
b354518
Merge branch 'RP2350_support' of https://github.com/elral/MobiFlight-…
elral Aug 26, 2024
efcab5b
RP2350 has same define as RP2040
elral Aug 26, 2024
47050c8
increase message size
elral Aug 27, 2024
0e64718
fixed wrong messagebuffer size
elral Aug 28, 2024
a58e1e6
platform is released for Pico 2 support
elral Aug 29, 2024
e5de049
no platform packages required, fixed wronf type definition for Pico2
elral Sep 4, 2024
65ab83f
Merge branch 'main' into RP2350_support
elral Sep 5, 2024
369263e
add generic B variant
elral Sep 11, 2024
e25cb4b
fixed wrong volumeLabel
elral Sep 12, 2024
dab43a7
fixed naming in comment from .ini file
elral Sep 13, 2024
9994df5
add preliminary VID/PID
elral Sep 13, 2024
02a7a44
fixed wrong volume label for Pico2
elral Sep 13, 2024
a0dd286
revert PID/VID changes
elral Sep 13, 2024
d76217d
add reset file for Pico2
elral Sep 13, 2024
65e387d
again adding VID/PID, EEPROM clear takes them from Pico
elral Sep 13, 2024
d72ab1a
generic Pico2 variants moved to Template repo
elral Sep 13, 2024
8658432
Merge branch 'MobiFlight:main' into RP2350_support
elral Sep 17, 2024
64e8159
Merge branch 'MobiFlight:main' into RP2350_support
elral Oct 1, 2024
2f830a5
UniqueID not for Pico2 for now
elral Oct 2, 2024
3cfffab
Merge branch 'RP2350_support' of https://github.com/elral/MobiFlight-…
elral Oct 2, 2024
9309de6
own implementation of getting UniqueID
elral Oct 5, 2024
3ca6c67
don't use UniquieID only for Pico2 with PSRAM
elral Oct 17, 2024
d9139cb
correct PID for pico2 via setting in platformio.ini file
elral Oct 20, 2024
8bba619
Merge branch 'MobiFlight:main' into RP2350_support
elral Oct 22, 2024
1f5b386
Merge branch 'MobiFlight:main' into RP2350_support
elral Oct 27, 2024
422d30e
Merge branch 'main' into RP2350_support
elral Jan 7, 2025
a3ffa1e
use board file from Pico
elral Jan 20, 2025
c10c921
Merge branch 'MobiFlight:main' into RP2350_support
elral Feb 12, 2025
bfcfa24
Merge branch 'MobiFlight:main' into RP2350_support
elral Feb 25, 2025
52fdd00
Merge branch 'MobiFlight:main' into RP2350_support
elral Jul 30, 2025
ca0cde8
Merge branch 'MobiFlight:main' into RP2350_support
elral Aug 22, 2025
886a635
Merge branch 'MobiFlight:main' into Pico2_support
elral Oct 30, 2025
d73663e
add Pico2 reset file, move Pico2 json file to new folder structure
elral Oct 30, 2025
1dd3193
add picture for Pico2
elral Oct 30, 2025
29e260f
read SN for Pico2 from chip and not flash
elral Jan 24, 2026
e7b92d0
Update src/MF_Modules/MFShiftData.cpp
elral Jan 30, 2026
a4de518
comment shortened acc. copilot
elral Jan 30, 2026
c61aade
Merge branch 'Pico2_support' of https://github.com/elral/MobiFlight-F…
elral Jan 30, 2026
e74f838
changes according copilot
elral Apr 6, 2026
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
Binary file added _Boards/raspberry_pico2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
202 changes: 202 additions & 0 deletions _Boards/raspberrypi_pico2.board.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"$schema": "./mfboard.schema.json",
"UsbDriveSettings": {
"VolumeLabel": "RP2350",
"VerificationFileName": "INFO_UF2.TXT"
},
"Connection": {
"ConnectionDelay": 1250,
"DelayAfterFirmwareUpdate": 1250,
"DtrEnable": true,
"EEPROMSize": 1496,
"ExtraConnectionRetry": false,
"ForceResetOnFirmwareUpdate": true,
"MessageSize": 96
},
"HardwareIds": ["^VID_2E8A&PID_F00A"],
"Info": {
"CanInstallFirmware": true,
"CanResetBoard": true,
"FirmwareBaseName": "mobiflight_raspberrypico2",
"FirmwareExtension": "uf2",
"FriendlyName": "Raspberry Pico2",
"LatestFirmwareVersion": "0.0.1",
"MobiFlightType": "MobiFlight RaspiPico2",
"ResetFirmwareFile": "reset.raspberry_pico2_1_0_2.uf2"
},
"ModuleLimits": {
"MaxAnalogInputs": 3,
"MaxInputShifters": 6,
"MaxButtons": 26,
"MaxEncoders": 13,
"MaxLcdI2C": 2,
"MaxLedSegments": 6,
"MaxOutputs": 26,
"MaxServos": 8,
"MaxShifters": 6,
"MaxSteppers": 6,
"MaxInputMultiplexer": 6,
"MaxCustomDevices": 0
},
"Pins": [
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 0
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 1
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 2
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 3
},
{
"isAnalog": false,
"isI2C": true,
"isPWM": true,
"Pin": 4
},
{
"isAnalog": false,
"isI2C": true,
"isPWM": true,
"Pin": 5
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 6
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 7
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 8
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 9
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 10
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 11
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 12
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 13
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 14
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 15
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 16
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 17
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 18
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 19
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 20
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 21
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 22
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A0",
"Pin": 26
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A1",
"Pin": 27
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A2",
"Pin": 28
}
]
}
Binary file added _Boards/reset.raspberry_pico2_1_0_2.uf2
Binary file not shown.
32 changes: 31 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ lib_deps =
custom_lib_deps_Atmel =
arduino-libraries/Servo @ 1.1.8
custom_lib_deps_Pico =
ricaun/ArduinoUniqueID @ ^1.3.0
build_flags =
-DMF_REDUCE_FUNCT_LEDCONTROL
-DMAXCALLBACKS=35
Expand Down Expand Up @@ -187,3 +186,34 @@ lib_deps =
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}

; Build settings for the Raspberry Pico2 original
[env:mobiflight_raspberrypico2]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico2
framework = arduino
board_build.core = earlephilhower ; select new core
board_build.filesystem_size = 0M ; configure filesystem size. Default 0 Mbyte.
lib_ldf_mode = chain+
upload_protocol = mbed ; for debugging upoading can be changed to picoprobe
;debug_tool = picoprobe ; and uncomment this for debugging w/ picoprobe
;board_build.arduino.earlephilhower.usb_manufacturer = Custom Manufacturer
;board_build.arduino.earlephilhower.usb_product = Ultra Cool Product
;board_build.arduino.earlephilhower.usb_vid = 0x2E8A
board_build.arduino.earlephilhower.usb_pid = 0xF00A
build_flags =
${env.build_flags}
'-DMOBIFLIGHT_TYPE="MobiFlight RaspiPico2"'
'-DMOBIFLIGHT_NAME="MobiFlight RaspiPico2"'
-DMEMLEN_CONFIG=1496 ; max. size for config which wil be stored in EEPROM
-DMEMLEN_NAMES_BUFFER=1000 ; max. size for configBuffer, contains only names from inputs
-DMF_MAX_DEVICEMEM=1000 ; max. memory size for devices
-I./_Boards/RaspberryPi/Pico
build_src_filter =
${env.build_src_filter}
lib_deps =
${env.lib_deps}
${env.custom_lib_deps_Pico}
monitor_speed = 115200
extra_scripts =
${env.extra_scripts}
32 changes: 18 additions & 14 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
#include "Button.h"
#include "Encoder.h"
#include "Output.h"
#if !defined(ARDUINO_ARCH_AVR)
#if !defined(ARDUINO_ARCH_AVR) && !defined(ARDUINO_ARCH_RP2040)
#include "ArduinoUniqueID.h"
#endif
#ifdef ARDUINO_ARCH_RP2040
#include <pico/unique_id.h>
#endif

#ifdef MF_ANALOG_SUPPORT
#include "Analog.h"
Expand Down Expand Up @@ -69,10 +72,13 @@ const uint8_t MEM_OFFSET_SERIAL = MEM_OFFSET_NAME + MEM_LEN_NAME;
const uint8_t MEM_LEN_SERIAL = 11;
const uint8_t MEM_OFFSET_CONFIG = MEM_OFFSET_NAME + MEM_LEN_NAME + MEM_LEN_SERIAL;

// 3 characters for "SN-", n characters for uniqueID plus terminating NULL
#ifdef ARDUINO_ARCH_AVR
char serial[11]; // 3 characters for "SN-",7 characters for "xyz-zyx" plus terminating NULL
char serial[11] = {0};
#elif ARDUINO_ARCH_RP2040
char serial[3 + (PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2) + 1] = {0};
#else
char serial[3 + UniqueIDsize * 2 + 1]; // 3 characters for "SN-", UniqueID as HEX String, terminating NULL
char serial[3 + UniqueIDsize * 2 + 1] = {0};
#endif
char name[MEM_LEN_NAME] = MOBIFLIGHT_NAME;
const int MEM_LEN_CONFIG = MEMLEN_CONFIG;
Expand Down Expand Up @@ -654,11 +660,7 @@ void generateRandomSerial()
// and getting the command to send the info's to the connector is always the same.
// additional double check if it's really a new board, should reduce Jaimes problem
randomSeed(millis());
serial[0] = 'S';
serial[1] = 'N';
serial[2] = '-';
serial[6] = '-';
serial[10] = 0x00;
strcpy(serial, "SN-000-000");
uint16_t randomSerial = random(4095);
for (uint8_t i = 3; i < 6; i++) {
serial[i] = (randomSerial & 0x000F) + 48; // convert from 4bit to HEX string
Expand All @@ -676,14 +678,16 @@ void generateRandomSerial()
cmdMessenger.sendCmd(kDebug, F("Serial number generated"));
#endif
}
#endif

#if !defined(ARDUINO_ARCH_AVR)
#elif ARDUINO_ARCH_RP2040
void readUniqueSerial()
{
strcpy(serial, "SN-");
pico_get_unique_board_id_string(serial + 3, sizeof(serial) - 3);
}
#else
void readUniqueSerial()
{
serial[0] = 'S';
serial[1] = 'N';
serial[2] = '-';
strcpy(serial, "SN-");
for (size_t i = 0; i < UniqueIDsize; i++) {
serial[3 + i * 2] = (UniqueID[i] >> 4) + 48;
if (serial[3 + i * 2] >= 58) serial[3 + i * 2] += 7;
Expand Down
5 changes: 3 additions & 2 deletions src/MF_InputShifter/MFInputShifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//

#include "MFInputShifter.h"
#include "MFShiftData.h"
#include "allocateMem.h"

inputShifterEvent MFInputShifter::_inputHandler = NULL;
Expand Down Expand Up @@ -61,12 +62,12 @@ void MFInputShifter::poll(uint8_t doTrigger)
digitalWrite(_clockPin, HIGH); // Preset clock to retrieve first bit
digitalWrite(_latchPin, HIGH); // Disable input latching and enable shifting

// Multiple chained modules are handled one at a time. As shiftIn() keeps getting
// Multiple chained modules are handled one at a time. As shiftInData() keeps getting
// called it will pull in the data from each chained module.
for (uint8_t module = 0; module < _moduleCount; module++) {
uint8_t currentState;

currentState = shiftIn(_dataPin, _clockPin, MSBFIRST);
currentState = shiftInData(_dataPin, _clockPin, MSBFIRST);

// If an input changed on the current module from the last time it was read
// then hand it off to figure out which bits specifically changed.
Expand Down
41 changes: 41 additions & 0 deletions src/MF_Modules/MFShiftData.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "MFShiftData.h"

uint8_t shiftInData(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
{
uint8_t value = 0;
uint8_t i;

for (i = 0; i < 8; ++i) {
if (bitOrder == LSBFIRST)
value |= digitalRead(dataPin) << i;
else
value |= digitalRead(dataPin) << (7 - i);
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
#if !defined(ARDUINO_ARCH_AVR) && !defined(ARDUINO_ARCH_RP2040)
delayMicroseconds(1);
#endif
}
return value;
}

void shiftOutData(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{
uint8_t i;

for (i = 0; i < 8; i++) {
if (bitOrder == LSBFIRST) {
digitalWrite(dataPin, val & 1);
val >>= 1;
} else {
digitalWrite(dataPin, (val & 128) != 0);
val <<= 1;
}

digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
#if !defined(ARDUINO_ARCH_AVR) && !defined(ARDUINO_ARCH_RP2040)
delayMicroseconds(1);
#endif
}
}
6 changes: 6 additions & 0 deletions src/MF_Modules/MFShiftData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#include <Arduino.h>

uint8_t shiftInData(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
void shiftOutData(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
Loading
Loading