Enable and squash compiler warnings.
This commit is contained in:
parent
c9c370e466
commit
72f82e49a8
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-I ./
|
CFLAGS=-I ./ -Wall -Werror
|
||||||
LDFLAGS=-static
|
LDFLAGS=-static
|
||||||
OBJS=main.o ssd1306.o linux_i2c.o
|
OBJS=main.o ssd1306.o linux_i2c.o
|
||||||
BIN=ssd1306_bin
|
BIN=ssd1306_bin
|
||||||
|
@ -52,8 +52,7 @@ uint8_t _i2c_write(uint8_t* ptr, int16_t len)
|
|||||||
if (file_i2c == 0 || ptr == 0 || len <= 0)
|
if (file_i2c == 0 || ptr == 0 || len <= 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
int32_t rc;
|
write(file_i2c, ptr, len);
|
||||||
rc = write(file_i2c, ptr, len);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -63,8 +62,7 @@ uint8_t _i2c_read(uint8_t *ptr, int16_t len)
|
|||||||
if (file_i2c == 0 || ptr == 0 || len <= 0)
|
if (file_i2c == 0 || ptr == 0 || len <= 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
int32_t rc;
|
read(file_i2c, ptr, len);
|
||||||
rc = read(file_i2c, ptr, len);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
6
main.c
6
main.c
@ -30,9 +30,9 @@ int main(int argc, char **argv)
|
|||||||
uint8_t i2c_node_address = 0;
|
uint8_t i2c_node_address = 0;
|
||||||
int x = -1;
|
int x = -1;
|
||||||
int y = -1;
|
int y = -1;
|
||||||
uint8_t line[25] = {0};
|
char line[25] = {0};
|
||||||
uint8_t msg[200] = {0};
|
char msg[200] = {0};
|
||||||
uint8_t oled_type[10] = {0};
|
char oled_type[10] = {0};
|
||||||
int clear_line = -1;
|
int clear_line = -1;
|
||||||
int clear_all = -1;
|
int clear_all = -1;
|
||||||
int orientation = -1;
|
int orientation = -1;
|
||||||
|
13
ssd1306.c
13
ssd1306.c
@ -12,10 +12,9 @@
|
|||||||
#include <ssd1306.h>
|
#include <ssd1306.h>
|
||||||
#include <font.h>
|
#include <font.h>
|
||||||
|
|
||||||
const uint8_t init_oled_type_file[] = "/tmp/.ssd1306_oled_type";
|
const char init_oled_type_file[] = "/tmp/.ssd1306_oled_type";
|
||||||
|
|
||||||
static uint8_t data_buf[1024];
|
static uint8_t data_buf[1024];
|
||||||
static int16_t data_len = 0;
|
|
||||||
static uint8_t max_lines = 0;
|
static uint8_t max_lines = 0;
|
||||||
static uint8_t max_columns = 0;
|
static uint8_t max_columns = 0;
|
||||||
static uint8_t global_x = 0;
|
static uint8_t global_x = 0;
|
||||||
@ -309,7 +308,7 @@ uint8_t ssd1306_oled_default_config(uint8_t oled_lines, uint8_t oled_columns)
|
|||||||
return _i2c_write(data_buf, i);
|
return _i2c_write(data_buf, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ssd1306_oled_write_line(uint8_t size, uint8_t* ptr)
|
uint8_t ssd1306_oled_write_line(uint8_t size, char* ptr)
|
||||||
{
|
{
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
uint16_t index = 0;
|
uint16_t index = 0;
|
||||||
@ -357,16 +356,16 @@ uint8_t ssd1306_oled_write_line(uint8_t size, uint8_t* ptr)
|
|||||||
return _i2c_write(data_buf, i);
|
return _i2c_write(data_buf, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ssd1306_oled_write_string(uint8_t size, uint8_t* ptr)
|
uint8_t ssd1306_oled_write_string(uint8_t size, char* ptr)
|
||||||
{
|
{
|
||||||
uint8_t rc = 0;
|
uint8_t rc = 0;
|
||||||
|
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
uint8_t* line = 0;
|
char* line = 0;
|
||||||
uint8_t* cr = 0;
|
char* cr = 0;
|
||||||
uint8_t buf[20];
|
char buf[20];
|
||||||
|
|
||||||
line = ptr;
|
line = ptr;
|
||||||
do {
|
do {
|
||||||
|
@ -75,8 +75,8 @@ uint8_t ssd1306_oled_set_Y(uint8_t y);
|
|||||||
uint8_t ssd1306_oled_set_XY(uint8_t x, uint8_t y);
|
uint8_t ssd1306_oled_set_XY(uint8_t x, uint8_t y);
|
||||||
uint8_t ssd1306_oled_set_rotate(uint8_t degree);
|
uint8_t ssd1306_oled_set_rotate(uint8_t degree);
|
||||||
uint8_t ssd1306_oled_default_config(uint8_t oled_lines, uint8_t oled_columns);
|
uint8_t ssd1306_oled_default_config(uint8_t oled_lines, uint8_t oled_columns);
|
||||||
uint8_t ssd1306_oled_write_line(uint8_t size, uint8_t* ptr);
|
uint8_t ssd1306_oled_write_line(uint8_t size, char* ptr);
|
||||||
uint8_t ssd1306_oled_write_string(uint8_t size, uint8_t* ptr);
|
uint8_t ssd1306_oled_write_string(uint8_t size, char* ptr);
|
||||||
uint8_t ssd1306_oled_clear_line(uint8_t row);
|
uint8_t ssd1306_oled_clear_line(uint8_t row);
|
||||||
uint8_t ssd1306_oled_clear_screen();
|
uint8_t ssd1306_oled_clear_screen();
|
||||||
uint8_t ssd1306_oled_save_resolution(uint8_t column, uint8_t row);
|
uint8_t ssd1306_oled_save_resolution(uint8_t column, uint8_t row);
|
||||||
|
Loading…
Reference in New Issue
Block a user