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

-6
View File
@@ -71,12 +71,6 @@
/* Not available GPIO */
#define GPIO_NA 0xFF
/* Convert SDA PIN GPIO to I2C bus number */
uint8_t i2c_bus_from_sda_pin(uint8_t sda_pin) __banked;
/* Convert SCL PIN GPIO to I2C bus number */
uint8_t i2c_bus_from_scl_pin(uint8_t scl_pin) __banked;
/*
* Setup a GPIO pin as input
* pin: GPIO pin number 0-63