Skip to content

Commit

Permalink
* Fix for cpp preprocessor end bracket misplacement in regard of othe…
Browse files Browse the repository at this point in the history
…r endif directives in headers

* rationalization of includes (globals.h included at less possible places)
* comments and warnings/errors refactoring
  • Loading branch information
SMFSW committed Dec 9, 2020
1 parent 3ed998a commit 39c652e
Show file tree
Hide file tree
Showing 100 changed files with 230 additions and 169 deletions.
2 changes: 1 addition & 1 deletion ADS1115.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ FctERR NONNULL__ ADS1115_Read(I2C_slave_t * pSlave, uint16_t * data, const uint1

/****************************************************************/
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_ADS1115 in globals.h with an I2C instance for this to work!"
#warning "You have to define I2C_ADS1115 for component to be enabled!"
#endif
#endif
/****************************************************************/
8 changes: 4 additions & 4 deletions ADS1115.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#endif

#include "sarmfsw.h"
#include "globals.h"

#include "I2C_component.h"
#include "I2C_peripheral.h"
Expand All @@ -29,7 +28,7 @@


#ifndef I2C_ADS1115_NB
//! \note Define I2C_ADS1115_NB in globals.h or at project to enable multiple peripherals of this type
//! \note Define I2C_ADS1115_NB to enable multiple peripherals of this type
#define I2C_ADS1115_NB 1 //!< Number of ADS1115 peripherals
#endif

Expand All @@ -42,7 +41,7 @@
#define ADS1115_ADDR_SCL 0x4B //!< ADS1115 address (ADR tied to SCL)

#ifndef ADS1115_BASE_ADDR
//! \note Define ADS1115_BASE_ADDR in globals.h or at project to change default device base address
//! \note Define ADS1115_BASE_ADDR to change default device base address
#define ADS1115_BASE_ADDR ADS1115_ADDR_GND //!< ADS1115 Base address
#endif

Expand Down Expand Up @@ -227,10 +226,11 @@ FctERR NONNULL__ ADS1115_Read(I2C_slave_t * pSlave, uint16_t * data, const uint1
#include "ADS1115_proc.h" // Include procedures
#include "ADS1115_ex.h" // Include extensions

#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __ADS1115_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion ADS1115_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,11 @@ float NONNULL__ ADS1115_Get_converted_value_V(ADS1115_t * pCpnt, const uint8_t c


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __ADS1115_EX_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion ADS1115_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ __INLINE void INLINE__ ADS1115_handler_all(void) {


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __ADS1115_PROC_H__ */
/****************************************************************/
2 changes: 1 addition & 1 deletion AMG88.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ FctERR NONNULL__ AMG88_Read_Word(I2C_slave_t * pSlave, uint16_t * data, const ui

/****************************************************************/
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_AMG88 in globals.h with an I2C instance for this to work!"
#warning "You have to define I2C_AMG88 for component to be enabled!"
#endif
#endif
/****************************************************************/
8 changes: 4 additions & 4 deletions AMG88.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#endif

#include "sarmfsw.h"
#include "globals.h"

#include "I2C_component.h"
#include "I2C_peripheral.h"
Expand All @@ -23,7 +22,7 @@


#ifndef I2C_AMG88_NB
//! \note Define I2C_AMG88_NB in globals.h or at project to enable multiple peripherals of this type
//! \note Define I2C_AMG88_NB to enable multiple peripherals of this type
#define I2C_AMG88_NB 1 //!< Number of AMG88 peripherals
#endif

Expand All @@ -33,7 +32,7 @@
#define AMG88_ADDR 0x68 //!< AMG88 address

#ifndef AMG88_BASE_ADDR
//! \note Define AMG88_BASE_ADDR in globals.h or at project to change default device base address
//! \note Define AMG88_BASE_ADDR to change default device base address
#define AMG88_BASE_ADDR AMG88_ADDR //!< AMG88 Base address
#endif

Expand Down Expand Up @@ -450,10 +449,11 @@ FctERR NONNULL__ AMG88_Read_Word(I2C_slave_t * pSlave, uint16_t * data, const ui
#include "AMG88_proc.h" // Include procedures
#include "AMG88_ex.h" // Include extensions

#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AMG88_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion AMG88_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,11 @@ __INLINE FctERR NONNULL_INLINE__ AMG88_Get_Pixel_Raw(AMG88_t * pCpnt, uint16_t *


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AMG88_EX_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion AMG88_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ __INLINE void INLINE__ AMG88_handler_all(void) {


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AMG88_PROC_H__ */
/****************************************************************/
2 changes: 1 addition & 1 deletion APDS9930.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ FctERR NONNULL__ APDS9930_Write_Special(I2C_slave_t * pSlave, const APDS9930_spe

/****************************************************************/
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_APDS9930 in globals.h with an I2C instance for this to work!"
#warning "You have to define I2C_APDS9930 for component to be enabled!"
#endif
#endif
/****************************************************************/
Expand Down
10 changes: 5 additions & 5 deletions APDS9930.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#endif

#include "sarmfsw.h"
#include "globals.h"

#include "I2C_component.h"
#include "I2C_peripheral.h"
Expand All @@ -22,7 +21,7 @@
/****************************************************************/

#ifndef I2C_APDS9930_NB
//! \note Define I2C_APDS9930_NB in globals.h or at project to enable multiple peripherals of this type
//! \note Define I2C_APDS9930_NB to enable multiple peripherals of this type
#define I2C_APDS9930_NB 1 //!< Number of APDS9930 peripherals
#endif

Expand All @@ -32,7 +31,7 @@
#define APDS9930_ADDR 0x39 //!< APDS9930 address

#ifndef APDS9930_BASE_ADDR
//! \note Define APDS9930_BASE_ADDR in globals.h or at project to change default device base address
//! \note Define APDS9930_BASE_ADDR to change default device base address
#define APDS9930_BASE_ADDR APDS9930_ADDR //!< APDS9930 Base address
#endif

Expand Down Expand Up @@ -219,7 +218,7 @@ typedef union uAPDS9930_REG__CONFIG {
struct PACK__ {
uint8_t PDL :1; //!< Proximity drive level. When asserted, the proximity LDR drive current is reduced by 9
uint8_t WLONG :1; //!< Wait Long. When asserted, the wait cycles are increased by a factor 12x from that programmed in the WTIME register.
uint8_t AGL :1; //!< ALS gain level. When asserted, the 1× and 8× ALS gain (AGAIN) modes are scaled by 0.16. Otherwise, AGAIN is scaled by 1. Do not use with AGAIN greater than 8×.
uint8_t AGL :1; //!< ALS gain level. When asserted, the 1 and 8 ALS gain (AGAIN) modes are scaled by 0.16. Otherwise, AGAIN is scaled by 1. Do not use with AGAIN greater than 8.
uint8_t :5;
} Bits;
} uAPDS9930_REG__CONFIG;
Expand Down Expand Up @@ -344,10 +343,11 @@ FctERR NONNULL__ APDS9930_Write_Special(I2C_slave_t * pSlave, const APDS9930_spe
#include "APDS9930_proc.h" // Include procedures
#include "APDS9930_ex.h" // Include extensions

#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9930_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion APDS9930_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,11 @@ __INLINE FctERR NONNULL_INLINE__ APDS9930_Get_Prox(APDS9930_t * pCpnt, uint16_t


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9930_EX_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion APDS9930_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ __INLINE void INLINE__ APDS9930_handler_all(void) {


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9930_PROC_H__ */
/****************************************************************/
2 changes: 1 addition & 1 deletion APDS9960.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ FctERR NONNULL__ APDS9960_Write_Special(I2C_slave_t * pSlave, const APDS9960_spe

/****************************************************************/
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_APDS9960 in globals.h with an I2C instance for this to work!"
#warning "You have to define I2C_APDS9960 for component to be enabled!"
#endif
#endif
/****************************************************************/
8 changes: 4 additions & 4 deletions APDS9960.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#endif

#include "sarmfsw.h"
#include "globals.h"

#include "I2C_component.h"
#include "I2C_peripheral.h"
Expand All @@ -23,7 +22,7 @@


#ifndef I2C_APDS9960_NB
//! \note Define I2C_APDS9960_NB in globals.h or at project to enable multiple peripherals of this type
//! \note Define I2C_APDS9960_NB to enable multiple peripherals of this type
#define I2C_APDS9960_NB 1 //!< Number of APDS9960 peripherals
#endif

Expand All @@ -33,7 +32,7 @@
#define APDS9960_ADDR 0x39 //!< APDS9960 address

#ifndef APDS9960_BASE_ADDR
//! \note Define APDS9960_BASE_ADDR in globals.h or at project to change default device base address
//! \note Define APDS9960_BASE_ADDR to change default device base address
#define APDS9960_BASE_ADDR APDS9960_ADDR //!< APDS9960 Base address
#endif

Expand Down Expand Up @@ -479,10 +478,11 @@ FctERR NONNULL__ APDS9960_Write_Special(I2C_slave_t * pSlave, const APDS9960_spe
#include "APDS9960_proc.h" // Include procedures
#include "APDS9960_ex.h" // Include extensions

#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9960_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion APDS9960_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,11 @@ __INLINE FctERR NONNULL_INLINE__ APDS9960_Get_Prox(APDS9960_t * pCpnt, uint8_t *


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9960_EX_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion APDS9960_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ __INLINE void INLINE__ APDS9960_handler_all(void) {


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __APDS9960_PROC_H__ */
/****************************************************************/
2 changes: 1 addition & 1 deletion AT42QT1244.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ FctERR NONNULL__ AT42QT1244_Read(I2C_slave_t * pSlave, uint8_t * data, const uin

/****************************************************************/
#elif !defined(NO_WARN_I2C_DRIVERS)
#warning "You have to define I2C_AT42QT1244 in globals.h with an I2C instance for this to work!"
#warning "You have to define I2C_AT42QT1244 for component to be enabled!"
#endif
#endif
/****************************************************************/
10 changes: 5 additions & 5 deletions AT42QT1244.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#endif

#include "sarmfsw.h"
#include "globals.h"

#include "I2C_component.h"
#include "I2C_peripheral.h"
Expand All @@ -23,7 +22,7 @@
// TODO: doxygen

#ifndef I2C_AT42QT1244_NB
//! \note Define I2C_AT42QT1244_NB in globals.h or at project to enable multiple peripherals of this type
//! \note Define I2C_AT42QT1244_NB to enable multiple peripherals of this type
#define I2C_AT42QT1244_NB 1 //!< Number of AT42QT1244 peripherals
#endif

Expand All @@ -36,12 +35,12 @@
#define AT42QT1244_ADDR_A01 117 //!< AT42QT1244 address (A0 & A1 tied to PWR)

#ifndef AT42QT1244_BASE_ADDR
//! \note Define AT42QT1244_BASE_ADDR in globals.h or at project to change default device base address
//! \note Define AT42QT1244_BASE_ADDR to change default device base address
#define AT42QT1244_BASE_ADDR AT42QT1244_ADDR //!< AT42QT1244 Base address
#endif

#ifndef AT42QT1244_CHECK_CRC
//! \note Define AT42QT1244_CHECK_CRC in globals.h or at project to change CRC check behavior
//! \note Define AT42QT1244_CHECK_CRC to change CRC check behavior
#define AT42QT1244_CHECK_CRC 1 //!< AT42QT1244 read transactions CRC check
#endif

Expand Down Expand Up @@ -322,10 +321,11 @@ FctERR NONNULL__ AT42QT1244_Read(I2C_slave_t * pSlave, uint8_t * data, const uin
#include "AT42QT1244_proc.h" // Include procedures
#include "AT42QT1244_ex.h" // Include extensions

#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AT42QT1244_H__ */
/****************************************************************/
3 changes: 2 additions & 1 deletion AT42QT1244_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ int NONNULL__ AT42QT1244_is_Calib_Pending(AT42QT1244_t * pCpnt);


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AT42QT1244_EX_H__ */
/****************************************************************/
5 changes: 3 additions & 2 deletions AT42QT1244_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/****************************************************************/

#ifndef AT42QT1244_GET_KEYS_ONLY
//! \note Define AT42QT1244_GET_KEYS_ONLY in globals.h or at project to change read behavior
//! \note Define AT42QT1244_GET_KEYS_ONLY to change read behavior
#define AT42QT1244_GET_KEYS_ONLY 0 //!< AT42QT1244 get keys status only
#endif

Expand Down Expand Up @@ -137,10 +137,11 @@ __INLINE void INLINE__ AT42QT1244_handler_all(void) {


/****************************************************************/
#endif

#ifdef __cplusplus
}
#endif

#endif
#endif /* __AT42QT1244_PROC_H__ */
/****************************************************************/
Loading

0 comments on commit 39c652e

Please sign in to comment.