Fix compile warnings from clang8; this class still needs more work though.

This commit is contained in:
Stephen Anthony 2019-03-03 15:18:58 -03:30
parent 6e5e61f995
commit 784793cae3
2 changed files with 10 additions and 14 deletions

View File

@ -18,29 +18,25 @@
#include <cstdio> #include <cstdio>
#include "System.hxx" #include "System.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "MT24LC256.hxx" #include "MT24LC256.hxx"
#define DEBUG_EEPROM 0 //#define DEBUG_EEPROM
// FIXME - Change to more proper C++ code, to eliminate warnings from clang8 // FIXME - It seems we only need OSystem here to print a message; I think this
// It seems we only need OSystem here to print a message; I think this
// can be abstracted away from the class; perhaps use a lambda to // can be abstracted away from the class; perhaps use a lambda to
// register a callback when a write happens?? // register a callback when a write happens??
#if DEBUG_EEPROM #ifdef DEBUG_EEPROM
char jpee_msg[256]; static char jpee_msg[256];
#define JPEE_LOG0(msg) jpee_logproc(msg) #define JPEE_LOG0(msg) jpee_logproc(msg)
#define JPEE_LOG1(msg,arg1) sprintf(jpee_msg,(msg),(arg1)), jpee_logproc(jpee_msg) #define JPEE_LOG1(msg,arg1) sprintf(jpee_msg,(msg),(arg1)), jpee_logproc(jpee_msg)
#define JPEE_LOG2(msg,arg1,arg2) sprintf(jpee_msg,(msg),(arg1),(arg2)), jpee_logproc(jpee_msg) #define JPEE_LOG2(msg,arg1,arg2) sprintf(jpee_msg,(msg),(arg1),(arg2)), jpee_logproc(jpee_msg)
#else #else
#define JPEE_LOG0(msg) { } #define JPEE_LOG0(msg)
#define JPEE_LOG1(msg,arg1) { } #define JPEE_LOG1(msg,arg1)
#define JPEE_LOG2(msg,arg1,arg2) { } #define JPEE_LOG2(msg,arg1,arg2)
#endif #endif
/* /*
@ -147,7 +143,7 @@ void MT24LC256::update()
// we only do the write when they have the same 'timestamp' // we only do the write when they have the same 'timestamp'
if(myCyclesWhenSDASet == myCyclesWhenSCLSet) if(myCyclesWhenSDASet == myCyclesWhenSCLSet)
{ {
#if DEBUG_EEPROM #ifdef DEBUG_EEPROM
cerr << endl << " I2C_PIN_WRITE(SCL = " << mySCL cerr << endl << " I2C_PIN_WRITE(SCL = " << mySCL
<< ", SDA = " << mySDA << ")" << " @ " << mySystem.cycles() << endl; << ", SDA = " << mySDA << ")" << " @ " << mySystem.cycles() << endl;
#endif #endif
@ -414,7 +410,7 @@ bool MT24LC256::jpee_timercheck(int mode)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int MT24LC256::jpee_logproc(char const *st) int MT24LC256::jpee_logproc(const char* const st)
{ {
cerr << " " << st << endl; cerr << " " << st << endl;
return 0; return 0;

View File

@ -77,7 +77,7 @@ class MT24LC256
void jpee_data_start(); void jpee_data_start();
void jpee_data_stop(); void jpee_data_stop();
void jpee_clock_fall(); void jpee_clock_fall();
int jpee_logproc(char const *st); int jpee_logproc(const char* const st);
bool jpee_timercheck(int mode); bool jpee_timercheck(int mode);
void update(); void update();