mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
i2c: compile-time decoupling of i2c devices from adapters
This allows each device to be moved (at compile time) to a different adapter. This is the first step to allowing devices to be attached to different i2c adapters.
This commit is contained in:
parent
ec6d550225
commit
feacec468d
@ -112,6 +112,7 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
|
||||
#define PIOS_I2C_MAX_DEVS 1
|
||||
extern uint32_t pios_i2c_main_adapter_id;
|
||||
#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_main_adapter_id)
|
||||
#define PIOS_I2C_ESC_ADAPTER (pios_i2c_main_adapter_id)
|
||||
|
||||
//-------------------------
|
||||
// SPI
|
||||
|
@ -115,6 +115,7 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8
|
||||
#define PIOS_I2C_MAX_DEVS 1
|
||||
extern uint32_t pios_i2c_main_adapter_id;
|
||||
#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_main_adapter_id)
|
||||
#define PIOS_I2C_ESC_ADAPTER (pios_i2c_main_adapter_id)
|
||||
|
||||
//------------------------
|
||||
// PIOS_BMP085
|
||||
|
@ -93,7 +93,7 @@ bool PIOS_I2C_ESC_SetSpeed(uint8_t speed[4])
|
||||
}
|
||||
};
|
||||
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
}
|
||||
|
||||
bool PIOS_SetMKSpeed(uint8_t motornum, uint8_t speed) {
|
||||
@ -115,7 +115,7 @@ bool PIOS_SetMKSpeed(uint8_t motornum, uint8_t speed) {
|
||||
}
|
||||
};
|
||||
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
}
|
||||
|
||||
bool PIOS_SetAstec4Address(uint8_t new_address) {
|
||||
@ -134,7 +134,7 @@ bool PIOS_SetAstec4Address(uint8_t new_address) {
|
||||
}
|
||||
};
|
||||
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
}
|
||||
|
||||
bool PIOS_SetAstec4Speed(uint8_t motornum, uint8_t speed) {
|
||||
@ -161,7 +161,7 @@ bool PIOS_SetAstec4Speed(uint8_t motornum, uint8_t speed) {
|
||||
}
|
||||
};
|
||||
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user