I2CBUS: Calculate I2C-settings as compiletime instead at runtime.

We can reduce the i2c-settings to just one byte, and this new const value
can directly be used by the I2C-peripheral without additional computation.
This saves 1-xdata load and a lot of bit-shifting.

I see a codesize savings of +200 bytes.
This commit is contained in:
René van Dorst committed 2026-09-20 11:25:34 +02:00
1 parent b92fba870c
commit f65d14f452
5 files changed
+59 -91

No files matched your search

+1 -8
View File
@@ -49,13 +49,6 @@
// #define MACHINE_PB_2132
// #define MACHINE_HASIVO_S600W_4GT_2XGT_SE
typedef struct {
// GPIO pins for SDA/SCL
uint8_t sda;
uint8_t scl;
} i2c_bus_t;
#define LED_27 1
// SYSTEM LED
#define LED_28_SYS 2
@@ -74,7 +67,7 @@ struct sfp_port
uint8_t pin_los; // gpio number 0-63, 0xFF = don't have it?
uint8_t pin_tx_disable; // gpio number 0-63, 0xFF = not present
uint8_t sds;
i2c_bus_t i2c;
uint8_t i2c;
};
struct machine {