Skip to content

Commit

Permalink
Fix C compile of oled files
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Sep 19, 2023
1 parent 39cf6ce commit 6557987
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/oled/I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ SOFTWARE.

#include<stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/* No. of bytes per transaction */
#define I2C_ONE_BYTE 1
#define I2C_TWO_BYTES 2
Expand All @@ -57,9 +61,13 @@ extern int i2c_read(int fd, unsigned char *read_data);
extern int i2c_read_register(int fd, unsigned char read_addr, unsigned char *read_data);
extern int i2c_read_registers(int fd, int num, unsigned char starting_addr,
unsigned char *buff_Ptr);
extern void config_i2c_struct(char *i2c_dev_path, unsigned char slave_addr, I2C_DevicePtr i2c_dev);
extern void config_i2c_struct(const char *i2c_dev_path, unsigned char slave_addr, I2C_DevicePtr i2c_dev);
extern int i2c_multiple_writes(int fd, int num, unsigned char *Ptr_buff);
extern int i2c_write_register(int fd, unsigned char reg_addr_or_cntrl, unsigned char val);

/* Exposed I2C-x Specific Functions */
extern int init_i2c_dev2(const char *i2cPath, unsigned char slave_address);

#ifdef __cplusplus
}
#endif
8 changes: 3 additions & 5 deletions src/oled/SSD1306_OLED.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ int LED_DISPLAY_TYPE = LED_DISPLAY_TYPE_SSD1306;

/* static Variables */
static unsigned char _rotation = 0,textsize = 0;
static short _width = LED_DISPLAY_WIDTH;
static short _height = LED_DISPLAY_HEIGHT;
static short _width = 128;
static short _height = 64;
static short cursor_x = 0, cursor_y = 0, textcolor = 0, textbgcolor = 0;
static bool _cp437 = false, wrap = true;




/* static struct objects */
static const GFXfont *gfxFont = nullptr;
static const GFXfont *gfxFont = 0;

void setTextFont(const GFXfont *font) {
gfxFont = font;
Expand Down
9 changes: 9 additions & 0 deletions src/oled/SSD1306_OLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ SOFTWARE.

/* Lib's */
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

#include "gfxfont.h"

/* Find Min and Max - MACROS */
Expand Down Expand Up @@ -178,3 +183,7 @@ extern short printNumber_I(int n, int base);
extern short printNumber_I_ln(int n, int base);
extern short printFloat(double number, unsigned char digits);
extern short printFloat_ln(double num, int digits);

#ifdef __cplusplus
}
#endif

0 comments on commit 6557987

Please sign in to comment.