Renaming TWI_SLAVE_ID to TWI_DEVICE_ID

This commit is contained in:
Lukas Pajak 2025-01-08 08:55:45 +01:00
parent 27320b4629
commit 2426943a15
3 changed files with 8 additions and 8 deletions

View file

@ -43,8 +43,8 @@ minimal base & privileged ISA `rv32e_zicsr_zifencei` only to ensure it can work
| `TWI_EN` | `0` | `0`, `1` | Set `1` to enable the usage of the SPI module (including load/store executables from/to SPI flash options)
| `TWI_CLK_PRSC` | `CLK_PRSC_64` | `CLK_PRSC_2` `CLK_PRSC_4` `CLK_PRSC_8` `CLK_PRSC_64` `CLK_PRSC_128` `CLK_PRSC_1024` `CLK_PRSC_2024` `CLK_PRSC_4096` | TWI clock pre-scaler (dividing main processor clock)
| `TWI_CLK_DIV` | `3` | `0` ... `15` | TWI clock divider (dividing twi clock)
| `TWI_SLAVE_ID` | `0x50` | `0x00` ... `0x7F` | First TWI slave ID to start. Is incremented until the end of the program is reached, when `TWI_ADDR_BYTES` is `1`.
| `TWI_ADDR_BYTES` | `1` | `1`, `2` | TWI memory address size in number of bytes. When `TWI_ADDR_BYTES` is `1`, `TWI_SLAVE_ID` the gets incremented as well.
| `TWI_DEVICE_ID` | `0x50` | `0x00` ... `0x7F` | First TWI slave ID to start. Is incremented until the end of the program is reached, when `TWI_ADDR_BYTES` is `1`.
| `TWI_ADDR_BYTES` | `1` | `1`, `2` | TWI memory address size in number of bytes. When `TWI_ADDR_BYTES` is `1`, `TWI_DEVICE_ID` the gets incremented as well.
|=======================
[IMPORTANT]

View file

@ -123,8 +123,8 @@
#endif
/** TWI First Slave ID */
#ifndef TWI_SLAVE_ID
#define TWI_SLAVE_ID 0x50
#ifndef TWI_DEVICE_ID
#define TWI_DEVICE_ID 0x50
#endif
/** TWI Memory address width (in numbers of bytes; 1 or 2) */
@ -603,7 +603,7 @@ void get_exe(int src) {
#elif (TWI_EN)
else {
PRINT_TEXT("Loading from TWI slaves, starting with ");
PRINT_XNUM(TWI_SLAVE_ID);
PRINT_XNUM(TWI_DEVICE_ID);
PRINT_TEXT("...\n");
}
#endif
@ -1040,9 +1040,9 @@ uint32_t twi_read_addr(uint32_t addr) {
address.uint32 = addr;
#if (TWI_ADDR_BYTES == 1)
uint8_t device_id = address.uint8[TWI_ADDR_BYTES] + TWI_SLAVE_ID;
uint8_t device_id = address.uint8[TWI_ADDR_BYTES] + TWI_DEVICE_ID;
#elif (TWI_ADDR_BYTES == 2)
uint8_t device_id = TWI_SLAVE_ID;
uint8_t device_id = TWI_DEVICE_ID;
#else
#error "Unsupported TWI_ADDR_BYTES configuration!"
#endif

View file

@ -42,7 +42,7 @@ USER_FLAGS += \
#USER_FLAGS += -DTWI_EN=1
#USER_FLAGS += -DTWI_CLK_PRSC=CLK_PRSC_64
#USER_FLAGS += -DTWI_CLK_DIV=3
#USER_FLAGS += -DTWI_SLAVE_ID=0x50
#USER_FLAGS += -DTWI_DEVICE_ID=0x50
#USER_FLAGS += -DTWI_ADDR_BYTES=1
# Set path to NEORV32 root directory