Skip to content

Commit

Permalink
Generic driver includes (#128)
Browse files Browse the repository at this point in the history
* Adding in ifdef flag to conditionally add in different HAL's of different STM32 platforms

* Adding in new include into every directory to get projects with no drivers to build
  • Loading branch information
nwdepatie authored Jun 3, 2024
1 parent 1ad3828 commit aaca92f
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 17 deletions.
3 changes: 1 addition & 2 deletions general/include/LTC4015.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#define LTC4015_H_

#include <stdint.h>
#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_i2c.h"
#include "stm32xx_hal.h"

//Device address
#define LTC4015_ADDR_68 (0x68)
Expand Down
3 changes: 1 addition & 2 deletions general/include/lsm6dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#ifndef LSM6DSO_H
#define LSM6DSO_H
#include <stdint.h>
#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_i2c.h"
#include "stm32xx_hal.h"

#define LSM6DSO_I2C_ADDRESS 0x6A << 1 /* Shifted because datasheet said to */
// Not sure if these are all needed, also not sure if more need to be added
Expand Down
3 changes: 1 addition & 2 deletions general/include/ltc68041.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ Copyright 2013 Linear Technology Corp. (LTC)
#ifndef LTC68041_H
#define LTC68041_H

#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_spi.h"
#include "stm32xx_hal.h"

#define LTC_MAX_RETRIES 10
#define LTC_BAD_READ 0xFEEEEEEE
Expand Down
3 changes: 1 addition & 2 deletions general/include/m24c32.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#include <stdint.h>
#include <string.h>
#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_i2c.h"
#include "stm32xx_hal.h"

#define M24C32_I2C_ADDR 0x50
#define M24C32_PAGE_SIZE 32
Expand Down
3 changes: 1 addition & 2 deletions general/include/max7314.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

/* Drivers for MAX7314AEG+T */

#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_i2c.h"
#include "stm32xx_hal.h"
#include <stdbool.h>

typedef enum {
Expand Down
3 changes: 1 addition & 2 deletions general/include/pi4ioe.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#define PI4IOE_H

#include <stdint.h>
#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_i2c.h"
#include "stm32xx_hal.h"

typedef struct
{
Expand Down
2 changes: 1 addition & 1 deletion general/include/sht30.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef sht30_h
#define sht30_h

#include "stm32f4xx_hal.h"
#include "stm32xx_hal.h"
#include <stdint.h>
#include <stdbool.h>

Expand Down
16 changes: 16 additions & 0 deletions general/include/stm32xx_hal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef STM32XX_HAL_H
#define STM32XX_HAL_H

#ifdef STM32F405xx
#include "stm32f4xx_hal.h"
#endif

#ifdef STM32H745xx
#include "stm32h7xx_hal.h"
#endif

#ifdef STM32G431xx
#include "stm32g4xx_hal.h"
#endif

#endif /* STM32XX_HAL_H*/
3 changes: 1 addition & 2 deletions platforms/stm32f405/include/can.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <stdbool.h>
#include <stddef.h>

#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_can.h"
#include "stm32xx_hal.h"
#include "c_utils.h"

/*
Expand Down
16 changes: 16 additions & 0 deletions platforms/stm32f405/include/stm32xx_hal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef STM32XX_HAL_H
#define STM32XX_HAL_H

#ifdef STM32F405xx
#include "stm32f4xx_hal.h"
#endif

#ifdef STM32H745xx
#include "stm32h7xx_hal.h"
#endif

#ifdef STM32G431xx
#include "stm32g4xx_hal.h"
#endif

#endif /* STM32XX_HAL_H*/
3 changes: 1 addition & 2 deletions platforms/stm32g431/include/fdcan.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <stdbool.h>
#include <stddef.h>

#include "stm32g4xx_hal.h"
#include "stm32g4xx_hal_fdcan.h"
#include "stm32xx_hal.h"

/* function pointer type for the callback */
typedef void (*can_callback_t)(FDCAN_HandleTypeDef *hcan);
Expand Down
16 changes: 16 additions & 0 deletions platforms/stm32g431/include/stm32xx_hal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef STM32XX_HAL_H
#define STM32XX_HAL_H

#ifdef STM32F405xx
#include "stm32f4xx_hal.h"
#endif

#ifdef STM32H745xx
#include "stm32h7xx_hal.h"
#endif

#ifdef STM32G431xx
#include "stm32g4xx_hal.h"
#endif

#endif /* STM32XX_HAL_H*/

0 comments on commit aaca92f

Please sign in to comment.