1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

Increase the PINIO Limit to 8 (#14378)

* awful but it does it

* increased pinio limit to 8

* reverted erroneously modified files

* updated piniobox.c to mirror pinio changes

* updated array size

* Update src/main/pg/pinio.c

Conditional pinioN if greater than 4.

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

* Update src/main/pg/pinio.c

conditionally assign more pinio boxes if more than 4

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

* Update pinio.h

revert to default of 4 pinio pins

* Update src/main/pg/piniobox.c

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

---------

Co-authored-by: Anonymous <user@example.com>
Co-authored-by: Anonymous <email@address.example>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
This commit is contained in:
heronprecision-1 2025-05-17 16:10:11 -04:00 committed by GitHub
parent 8f3c02f403
commit 7ef4e092c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 60 additions and 0 deletions

View file

@ -38,6 +38,20 @@
#ifndef PINIO4_PIN #ifndef PINIO4_PIN
#define PINIO4_PIN NONE #define PINIO4_PIN NONE
#endif #endif
#if PINIO_COUNT > 4
#ifndef PINIO5_PIN
#define PINIO5_PIN NONE
#endif
#ifndef PINIO6_PIN
#define PINIO6_PIN NONE
#endif
#ifndef PINIO7_PIN
#define PINIO7_PIN NONE
#endif
#ifndef PINIO8_PIN
#define PINIO8_PIN NONE
#endif
#endif
#ifndef PINIO1_CONFIG #ifndef PINIO1_CONFIG
#define PINIO1_CONFIG PINIO_CONFIG_MODE_OUT_PP #define PINIO1_CONFIG PINIO_CONFIG_MODE_OUT_PP
@ -55,6 +69,22 @@
#define PINIO4_CONFIG PINIO_CONFIG_MODE_OUT_PP #define PINIO4_CONFIG PINIO_CONFIG_MODE_OUT_PP
#endif #endif
#ifndef PINIO5_CONFIG
#define PINIO5_CONFIG PINIO_CONFIG_MODE_OUT_PP
#endif
#ifndef PINIO6_CONFIG
#define PINIO6_CONFIG PINIO_CONFIG_MODE_OUT_PP
#endif
#ifndef PINIO7_CONFIG
#define PINIO7_CONFIG PINIO_CONFIG_MODE_OUT_PP
#endif
#ifndef PINIO8_CONFIG
#define PINIO8_CONFIG PINIO_CONFIG_MODE_OUT_PP
#endif
PG_REGISTER_WITH_RESET_FN(pinioConfig_t, pinioConfig, PG_PINIO_CONFIG, 0); PG_REGISTER_WITH_RESET_FN(pinioConfig_t, pinioConfig, PG_PINIO_CONFIG, 0);
void pgResetFn_pinioConfig(pinioConfig_t *config) void pgResetFn_pinioConfig(pinioConfig_t *config)
@ -63,10 +93,20 @@ void pgResetFn_pinioConfig(pinioConfig_t *config)
config->ioTag[1] = IO_TAG(PINIO2_PIN); config->ioTag[1] = IO_TAG(PINIO2_PIN);
config->ioTag[2] = IO_TAG(PINIO3_PIN); config->ioTag[2] = IO_TAG(PINIO3_PIN);
config->ioTag[3] = IO_TAG(PINIO4_PIN); config->ioTag[3] = IO_TAG(PINIO4_PIN);
#if PINIO_COUNT > 4
config->ioTag[4] = IO_TAG(PINIO5_PIN);
config->ioTag[5] = IO_TAG(PINIO6_PIN);
config->ioTag[6] = IO_TAG(PINIO7_PIN);
config->ioTag[7] = IO_TAG(PINIO8_PIN);
#endif
config->config[0] = PINIO1_CONFIG; config->config[0] = PINIO1_CONFIG;
config->config[1] = PINIO2_CONFIG; config->config[1] = PINIO2_CONFIG;
config->config[2] = PINIO3_CONFIG; config->config[2] = PINIO3_CONFIG;
config->config[3] = PINIO4_CONFIG; config->config[3] = PINIO4_CONFIG;
config->config[4] = PINIO5_CONFIG;
config->config[5] = PINIO6_CONFIG;
config->config[6] = PINIO7_CONFIG;
config->config[7] = PINIO8_CONFIG;
} }
#endif #endif

View file

@ -46,6 +46,22 @@
#define PINIO4_BOX PERMANENT_ID_NONE #define PINIO4_BOX PERMANENT_ID_NONE
#endif #endif
#ifndef PINIO5_BOX
#define PINIO5_BOX PERMANENT_ID_NONE
#endif
#ifndef PINIO6_BOX
#define PINIO6_BOX PERMANENT_ID_NONE
#endif
#ifndef PINIO7_BOX
#define PINIO7_BOX PERMANENT_ID_NONE
#endif
#ifndef PINIO8_BOX
#define PINIO8_BOX PERMANENT_ID_NONE
#endif
PG_REGISTER_WITH_RESET_FN(pinioBoxConfig_t, pinioBoxConfig, PG_PINIOBOX_CONFIG, 1); PG_REGISTER_WITH_RESET_FN(pinioBoxConfig_t, pinioBoxConfig, PG_PINIOBOX_CONFIG, 1);
void pgResetFn_pinioBoxConfig(pinioBoxConfig_t *config) void pgResetFn_pinioBoxConfig(pinioBoxConfig_t *config)
@ -54,6 +70,10 @@ void pgResetFn_pinioBoxConfig(pinioBoxConfig_t *config)
config->permanentId[1] = PINIO2_BOX; config->permanentId[1] = PINIO2_BOX;
config->permanentId[2] = PINIO3_BOX; config->permanentId[2] = PINIO3_BOX;
config->permanentId[3] = PINIO4_BOX; config->permanentId[3] = PINIO4_BOX;
// rest is reset to NONE
for (unsigned i = 4; i < PINIO_COUNT; i++) {
config->permanentId[i] = PERMANENT_ID_NONE;
}
} }
#endif #endif