mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
Renamed PIOS_I2C_TransferBegin => PIOS_I2C_LockDevice because it better describes what it does
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@231 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
a5d56cd537
commit
ad816dc070
@ -203,7 +203,7 @@ void PIOS_BMP085_GetValues(uint16_t *Pressure, uint16_t *Altitude, uint16_t *Tem
|
||||
int32_t PIOS_BMP085_Read(uint16_t address, uint8_t *buffer, uint8_t len)
|
||||
{
|
||||
/* Try to get the IIC peripheral */
|
||||
if(PIOS_I2C_TransferBegin(I2C_Non_Blocking) < 0) {
|
||||
if(PIOS_I2C_LockDevice(I2C_Non_Blocking) < 0) {
|
||||
/* Request a retry */
|
||||
return -2;
|
||||
}
|
||||
@ -226,7 +226,7 @@ int32_t PIOS_BMP085_Read(uint16_t address, uint8_t *buffer, uint8_t len)
|
||||
}
|
||||
|
||||
/* Release I2C peripheral */
|
||||
PIOS_I2C_TransferFinished();
|
||||
PIOS_I2C_UnlockDevice();
|
||||
|
||||
/* Return error status */
|
||||
return error < 0 ? -1 : 0;
|
||||
@ -247,7 +247,7 @@ int32_t PIOS_BMP085_Read(uint16_t address, uint8_t *buffer, uint8_t len)
|
||||
int32_t PIOS_BMP085_Write(uint16_t address, uint8_t *buffer, uint8_t len)
|
||||
{
|
||||
/* Try to get the IIC peripheral */
|
||||
if(PIOS_I2C_TransferBegin(I2C_Non_Blocking) < 0) {
|
||||
if(PIOS_I2C_LockDevice(I2C_Non_Blocking) < 0) {
|
||||
/* Request a retry */
|
||||
return -2;
|
||||
}
|
||||
@ -269,7 +269,7 @@ int32_t PIOS_BMP085_Write(uint16_t address, uint8_t *buffer, uint8_t len)
|
||||
}
|
||||
|
||||
/* Release I2C peripheral */
|
||||
PIOS_I2C_TransferFinished();
|
||||
PIOS_I2C_UnlockDevice();
|
||||
|
||||
/* Return error status */
|
||||
return error < 0 ? -1 : 0;
|
||||
|
@ -175,7 +175,7 @@ static void PIOS_I2C_InitPeripheral(void)
|
||||
* \return Non_Blocking: returns -1 to request a retry
|
||||
* \return 0 if IIC interface free
|
||||
*/
|
||||
int32_t PIOS_I2C_TransferBegin(I2CSemaphoreTypeDef semaphore_type)
|
||||
int32_t PIOS_I2C_LockDevice(I2CSemaphoreTypeDef semaphore_type)
|
||||
{
|
||||
volatile I2CRecTypeDef *i2cx = &I2CRec;
|
||||
int32_t status = -1;
|
||||
@ -201,7 +201,7 @@ int32_t PIOS_I2C_TransferBegin(I2CSemaphoreTypeDef semaphore_type)
|
||||
* Semaphore handling: releases the IIC interface for other tasks
|
||||
* \return < 0 on errors
|
||||
*/
|
||||
int32_t PIOS_I2C_TransferFinished(void)
|
||||
int32_t PIOS_I2C_UnlockDevice(void)
|
||||
{
|
||||
I2CRec.i2c_semaphore = 0;
|
||||
|
||||
|
@ -53,8 +53,8 @@ typedef enum {
|
||||
|
||||
/* Public Functions */
|
||||
extern int32_t PIOS_I2C_Init(void);
|
||||
extern int32_t PIOS_I2C_TransferBegin(I2CSemaphoreTypeDef semaphore_type);
|
||||
extern int32_t PIOS_I2C_TransferFinished(void);
|
||||
extern int32_t PIOS_I2C_LockDevice(I2CSemaphoreTypeDef semaphore_type);
|
||||
extern int32_t PIOS_I2C_UnlockDevice(void);
|
||||
extern int32_t PIOS_I2C_LastErrorGet(void);
|
||||
extern int32_t PIOS_I2C_TransferCheck(void);
|
||||
extern int32_t PIOS_I2C_TransferWait(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user