Commit 688999a7 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Modified the main CMakeLists.txt to set the compiler flags for the C++...

Modified the main CMakeLists.txt to set the compiler flags for the C++ compiler instead of the C compiler.
Solved some compilation warnings that appeared.
parent f79fe254
......@@ -18,8 +18,8 @@ IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "DEBUG")
ENDIF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -D_REENTRANT")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -D_REENTRANT")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -D_REENTRANT")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -D_REENTRANT")
ADD_SUBDIRECTORY(src)
......
......@@ -158,6 +158,8 @@ bool CUSBI2C::get_gpio(gpio_pins pin)
{
/* handle exceptions */
}
return false;
}
short int CUSBI2C::get_analog(gpio_pins pin)
......@@ -187,6 +189,8 @@ short int CUSBI2C::get_analog(gpio_pins pin)
{
/* handle exceptions */
}
return analog_value;
}
void CUSBI2C::turn_led_on(void)
......@@ -292,6 +296,7 @@ int CUSBI2C::write(unsigned char dev_id, unsigned char *data, int len)
}
}
}
return written;
}
int CUSBI2C::read(unsigned char dev_id, unsigned char *data, int len)
......@@ -299,7 +304,6 @@ int CUSBI2C::read(unsigned char dev_id, unsigned char *data, int len)
int written=0,read=0,total_read=0;
unsigned char cmd[3]={0x00,0x00,0x00};
std::list<std::string> events;
unsigned char status;
if(data==NULL)
{
......@@ -336,11 +340,13 @@ int CUSBI2C::read(unsigned char dev_id, unsigned char *data, int len)
/* handle exceptions */
}
}
return read;
}
int CUSBI2C::write_reg(unsigned char dev_id, short int address, unsigned char *data, int len)
{
int written=0,read=0,total_read=0,num=0,total_written=0;
int written=0,read=0,num=0,total_written=0;
std::list<std::string> events;
unsigned char status;
unsigned char *cmd;
......@@ -390,6 +396,8 @@ int CUSBI2C::write_reg(unsigned char dev_id, short int address, unsigned char *d
if(address<256) total_written+=num-4;
else total_written+=num-5;
}while(total_written<len);
return total_written;
}
int CUSBI2C::read_reg(unsigned char dev_id, short int address, unsigned char *data, int len)
......@@ -397,7 +405,6 @@ int CUSBI2C::read_reg(unsigned char dev_id, short int address, unsigned char *da
int written=0,read=0,total_read=0,num=0,total_num=0;
std::list<std::string> events;
unsigned char cmd[5];
unsigned char status;
do{
if((len-total_read)>60) num=60;
......@@ -437,6 +444,8 @@ int CUSBI2C::read_reg(unsigned char dev_id, short int address, unsigned char *da
}
total_read+=num;
}while(total_read<len);
return total_read;
}
void CUSBI2C::close(void)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment