Mercurial > public > ostc4
diff Small_CPU/Src/i2c.c @ 241:2b9775f71e30 div-fixes-5
cleanup: factor out I2C1_Status() and cleanup type
Having a function that returns global data is rather useless. Further,
use HAL_StatusTypeDef directly, instead of typecasting between a
HAL defined enum and our uint_8t. Cleanup only.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 08 Apr 2019 11:18:40 +0200 |
parents | e4207f0aaa4b |
children | 4fe5400567e7 |
line wrap: on
line diff
--- a/Small_CPU/Src/i2c.c Mon Apr 08 11:49:13 2019 +0200 +++ b/Small_CPU/Src/i2c.c Mon Apr 08 11:18:40 2019 +0200 @@ -23,13 +23,6 @@ } */ -//TODO: remove this function. Why return a global variable? -HAL_StatusTypeDef I2C1_Status(void) -{ -return (HAL_StatusTypeDef)global.I2C_SystemStatus; -} - - GPIO_PinState HAL_I2C_Read_Data_PIN(void) { return HAL_GPIO_ReadPin(I2Cx_SDA_GPIO_PORT,I2Cx_SDA_PIN); @@ -57,7 +50,6 @@ return HAL_I2C_Read_Data_PIN(); } -//TODO: make this void. return is never used HAL_StatusTypeDef MX_I2C1_Init(void) { I2cHandle.Instance = I2Cx; @@ -77,7 +69,7 @@ { scheduleSpecial_Evaluate_DataSendToSlave(); } - return (HAL_StatusTypeDef)global.I2C_SystemStatus; + return global.I2C_SystemStatus; } @@ -104,10 +96,9 @@ I2C_Error_count(); } - return (HAL_StatusTypeDef)global.I2C_SystemStatus; + return global.I2C_SystemStatus; } -// TODO: return value never used HAL_StatusTypeDef I2C_Master_Receive( uint16_t DevAddress, uint8_t *pData, uint16_t Size) { if(global.I2C_SystemStatus != HAL_OK)