Skip to content

Commit

Permalink
v0.3: few fixes & added precomp define to hide warnings from componen…
Browse files Browse the repository at this point in the history
…t files
  • Loading branch information
SMFSW committed May 29, 2017
1 parent fb16d6b commit c1d7ce6
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 41 deletions.
14 changes: 7 additions & 7 deletions AT42QT1244.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file AT42QT1244.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief AT42QT1244 Driver code
Expand All @@ -24,17 +24,17 @@ I2C_slave AT42QT1244_hal = { { pNull, I2C_ADDR(AT42QT1244_BASE_ADDR), I2C_slave_


/*!\brief 16bits CRC calculation for AT42QT1244
** \param[in] crc - current crc value
** \param[in] data - new data for crc
** \return New CRC value
** \details 16bits crc calculation. Initial crc entry must be 0.
** The message is not augmented with 'zero' bits. polynomial = X16 + X15 + X2 + 1
** Repeat this function for each data block byte, folding the result back into the call parameter crc
** \param[in] crc - current crc value
** \param[in] data - new data for crc
** \return New CRC value
**/
static uint16_t crc16(uint16_t crc, uint8_t data)
{
crc ^= (uint16_t) (data) * 0x100;
for (int i = 7 ; i > 0 ; i--)
crc ^= (uint16_t) data * 0x100;
for (int i = 7 ; i >= 0 ; i--)
{
if (crc & 0x8000) { crc = (crc << 1) ^ 0x1021; }
else { crc <<= 1; }
Expand Down Expand Up @@ -112,7 +112,7 @@ FctERR AT42QT1244_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_AT42QT1244 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions BMP180.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file BMP180.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief BMP180 Driver code
Expand Down Expand Up @@ -81,7 +81,7 @@ FctERR BMP180_Read_Word(uint16_t * data, uint16_t addr)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_BMP180 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions DRV2605L.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file DRV2605L.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief DRV2605L Driver code
Expand Down Expand Up @@ -62,7 +62,7 @@ FctERR DRV2605L_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_DRV2605L in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions DS_GPMS.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file DS_GPMS.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief DS-GPM.S Driver code
Expand Down Expand Up @@ -62,7 +62,7 @@ FctERR GPMS_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_GPMS in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions FM24C.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file FM24C.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief FM24C Driver code
Expand All @@ -14,7 +14,7 @@
#if defined(HAL_I2C_MODULE_ENABLED)
#if defined(I2C_FM24C)
/****************************************************************/
#if defined(I2C_MB85RC256V)
#if defined(I2C_MB85RC256V) && !defined(NO_WARN_I2C_DRIVERS)
#warning "FM24CxxB -> Defined along with MB85RC256V: use with caution, might have same I2C addresses if on same I2C bus!!!"
#endif
/****************************************************************/
Expand Down Expand Up @@ -106,7 +106,7 @@ FctERR FM24C_ReadWrite(uint8_t * data, uint16_t addr, uint16_t nb, bool wr)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_FM24C in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions MB85RC256V.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file MB85RC256V.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief MB85RC256V Driver code
Expand All @@ -13,7 +13,7 @@
#if defined(HAL_I2C_MODULE_ENABLED)
#if defined(I2C_MB85RC256V)
/****************************************************************/
#if defined(I2C_FM24C)
#if defined(I2C_FM24C) && !defined(NO_WARN_I2C_DRIVERS)
#warning "MB85RC256V -> Defined along with FM24CxxB: use with caution, might have same I2C addresses if on same I2C bus!!!"
#endif
/****************************************************************/
Expand Down Expand Up @@ -78,7 +78,7 @@ FctERR MB85RC256V_Read_ID(uint8_t * data)
}

/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_MB85RC256V in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions MCP4725.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file MCP4725.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief MCP4725 Driver code
Expand Down Expand Up @@ -73,7 +73,7 @@ FctERR MCP4725_General_Call(uint8_t cmd)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_MCP4725 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions MCP9808.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file MCP9808.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief MCP9808 Driver code
Expand Down Expand Up @@ -97,7 +97,7 @@ FctERR MCP9808_Read(uint16_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_MCP9808 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion MCP9808_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// *****************************************************************************
typedef struct MCP9808_proc {
float Temperature;
bool TLower;
bool TUpper;
bool TLower;
bool TCrit;
bool NewData;
uint32_t hLast;
Expand Down
4 changes: 2 additions & 2 deletions MTCH6102.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file MTCH6102.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief MTCH6102 Driver code
Expand Down Expand Up @@ -65,7 +65,7 @@ FctERR MTCH6102_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_MTCH6102 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions PCA9624.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file PCA9624.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief PCA9624 Driver code
Expand All @@ -13,7 +13,7 @@
#if defined(HAL_I2C_MODULE_ENABLED)
#if defined(I2C_PCA9624)
/****************************************************************/
#if defined(I2C_PCA9685)
#if defined(I2C_PCA9685) && !defined(NO_WARN_I2C_DRIVERS)
#warning "PCA9624 -> Multiple PCA96xx types: use with caution if using CALL addresses if on same I2C bus!!!"
#endif
/****************************************************************/
Expand Down Expand Up @@ -66,7 +66,7 @@ FctERR PCA9624_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_PCA9624 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions PCA9685.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file PCA9685.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief PCA9685 Driver code
Expand All @@ -13,7 +13,7 @@
#if defined(HAL_I2C_MODULE_ENABLED)
#if defined(I2C_PCA9685)
/****************************************************************/
#if defined(I2C_PCA9624)
#if defined(I2C_PCA9624) && !defined(NO_WARN_I2C_DRIVERS)
#warning "PCA9685 -> Multiple PCA96xx types: use with caution if using CALL addresses if on same I2C bus!!!"
#endif
/****************************************************************/
Expand Down Expand Up @@ -65,7 +65,7 @@ FctERR PCA9685_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_PCA9685 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions PCF8523.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file PCF8523.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief PCF8523 Driver code
Expand Down Expand Up @@ -62,7 +62,7 @@ FctERR PCF8523_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_PCF8523 in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ARM I2C Drivers for various components
- use $CPNT$_Init() once
- start using $CPNT$_funcs()

- if you find warning messages annoying, you could define NO_WARN_I2C_DRIVERS (underscores between words) in compiler options to hide warning messages


## Remarks

Expand Down
4 changes: 2 additions & 2 deletions template/CPNT.c.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver code
Expand Down Expand Up @@ -71,7 +71,7 @@ FctERR $CPNT$_Read(uint8_t * data, uint16_t addr, uint16_t nb)


/****************************************************************/
#else
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_$CPNT$ in globals.h with an I2C instance for this to work!"
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion template/CPNT.h.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$.h
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver declarations
Expand Down
2 changes: 1 addition & 1 deletion template/CPNT_ex.c.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$_ex.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver extensions code
Expand Down
2 changes: 1 addition & 1 deletion template/CPNT_ex.h.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$_ex.h
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver extensions declarations
Expand Down
2 changes: 1 addition & 1 deletion template/CPNT_proc.c.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$_proc.c
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver procedures code
Expand Down
2 changes: 1 addition & 1 deletion template/CPNT_proc.h.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file $CPNT$_proc.h
** \author SMFSW
** \version v0.2
** \version v0.3
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief $CPNT$ Driver procedures declarations
Expand Down

0 comments on commit c1d7ce6

Please sign in to comment.