# HG changeset patch # User David Douard # Date 1633374935 -7200 # Node ID 48f29a1d43d65fa70638bf109b37fc9261100ac4 # Parent d9c5eaf85fabd95030f25d49b3cc128a74a0b7a9 Clean several compilation warnings diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/keypad/Keypad.cpp --- a/lib/keypad/Keypad.cpp Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/keypad/Keypad.cpp Mon Oct 04 21:15:35 2021 +0200 @@ -47,7 +47,7 @@ { // activate column col _columns[col].write(1); - ThisThread::sleep_for(5); + ThisThread::sleep_for(5ms); for(row=0; row<_nrows; row++) { if (_rows[row].read()) @@ -71,7 +71,7 @@ } _columns[col].write(0); col = (col+1) % _ncols; - ThisThread::sleep_for(5); + ThisThread::sleep_for(5ms); } } diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/keypad/Keypad.h --- a/lib/keypad/Keypad.h Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/keypad/Keypad.h Mon Oct 04 21:15:35 2021 +0200 @@ -1,4 +1,3 @@ - #ifndef KEYPAD_H #define KEYPAD_H @@ -7,7 +6,6 @@ #include - typedef Callback keyevent_callback_t; class Keypad { diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/unigraphic/GraphicsDisplay.cpp --- a/lib/unigraphic/GraphicsDisplay.cpp Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/unigraphic/GraphicsDisplay.cpp Mon Oct 04 21:15:35 2021 +0200 @@ -277,9 +277,9 @@ { char_x=x; char_y=y; - int j,i,b; + unsigned int j, i, b; unsigned char* zeichen; - unsigned char z,w,v, wtot; + unsigned char z, w, v, wtot; /* // read font parameter from start of array offset = font[0]; // bytes / char @@ -301,6 +301,8 @@ // so if the char to write crosses the width, do not display it return; } + wtot = 0; + if ((c < firstch) || (c > lastch)) { // test char range - if not exist fill with blank window(char_x, char_y, fonthor*fontzoomhor, fontvert*fontzoomver); // char box window_pushpixel(_background, fontzoomhor*fonthor*fontvert*fontzoomver); //(color, howmany) @@ -353,7 +355,7 @@ void GraphicsDisplay::Bitmap_BW(Bitmap_s bm, int x, int y) { - int h,v,b; + unsigned int h,v,b; // int cropX; char d; if(x<0) x=0; @@ -376,17 +378,15 @@ } if(auto_up) copy_to_lcd(); } -void GraphicsDisplay::Bitmap(int x, int y, int w, int h,unsigned char *bitmap) +void GraphicsDisplay::Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap) { int j; unsigned char padd; unsigned short *bitmap_ptr = (unsigned short *)bitmap; padd = w%2; // the lines are padded to multiple of 4 bytes in a bitmap - if(x<0) x=0; - else if(x>=oriented_width) return; - if(y<0) y=0; - else if(y>=oriented_height) return; + if(x >= oriented_width) return; + if(y >= oriented_height) return; int cropX = (x+w)-oriented_width; if(cropX<0) cropX=0; int cropY = (y+h)-oriented_height; diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/unigraphic/GraphicsDisplay.h --- a/lib/unigraphic/GraphicsDisplay.h Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/unigraphic/GraphicsDisplay.h Mon Oct 04 21:15:35 2021 +0200 @@ -42,9 +42,9 @@ /** Bitmap */ struct Bitmap_s{ - int xSize; - int ySize; - int Byte_in_Line; + unsigned int xSize; + unsigned int ySize; + unsigned int Byte_in_Line; char* data; }; @@ -243,7 +243,7 @@ * cast the pointer to (unsigned char *) : * tft.Bitmap(10,40,309,50,(unsigned char *)scala); */ - void Bitmap(int x, int y, int w, int h,unsigned char *bitmap); + void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char *bitmap); /** paint monochrome bitmap to screen * @@ -349,22 +349,21 @@ private: - unsigned char* font; // display width and height related to current orientation - int oriented_width; - int oriented_height; + unsigned int oriented_width; + unsigned int oriented_height; // text char location - int char_x; - int char_y; + unsigned int char_x; + unsigned int char_y; - int fontoffset;// bytes / char (short) - int fonthor; // hor size of font (char) - int fontvert; // ver size of font (char) - int fontbpl; // bytes per line (char) - int fontzoomver; // size multiplier - int fontzoomhor; // size multiplier + unsigned int fontoffset;// bytes / char (short) + unsigned int fonthor; // hor size of font (char) + unsigned int fontvert; // ver size of font (char) + unsigned int fontbpl; // bytes per line (char) + unsigned int fontzoomver; // size multiplier + unsigned int fontzoomhor; // size multiplier unsigned char firstch; // first ascii code present in font array (usually 32) unsigned char lastch; // last ascii code present in font array (usually 127) bool auto_up; // autoupdate flag for LCD diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/unigraphic/SSD1322.cpp --- a/lib/unigraphic/SSD1322.cpp Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/unigraphic/SSD1322.cpp Mon Oct 04 21:15:35 2021 +0200 @@ -98,7 +98,7 @@ const char *name) : GraphicsDisplay(name), screensize_X(DISPLAY_WIDTH), screensize_Y(DISPLAY_HEIGHT), - _BPP(BPP), _PAGES(DISPLAY_HEIGHT/8*BPP), + _PAGES(DISPLAY_HEIGHT/8*BPP), _BPP(BPP), _IC_X_SEGS(IC_X_SEGS), _IC_Y_COMS(IC_Y_COMS), _IC_PAGES(IC_Y_COMS/8*BPP), _spi(mosi, miso, sclk), _DC(DC), _CS(CS), _RST(reset) @@ -138,13 +138,13 @@ void SSD1322::hw_reset() { - ThisThread::sleep_for(15); + ThisThread::sleep_for(15ms); _DC = 1; _CS = 1; _RST = 0; // display reset - ThisThread::sleep_for(2); + ThisThread::sleep_for(2ms); _RST = 1; // end reset - ThisThread::sleep_for(100); + ThisThread::sleep_for(100ms); } void SSD1322::bus_enable(bool enable) @@ -188,7 +188,7 @@ // Enable Nibble Re-map,Scan from COM[N-1] to COM0, // Disable COM Split Odd Even // Enable Dual COM mode - unsigned char d; + unsigned char d = 0; switch (mode) { case(NONE): @@ -324,9 +324,10 @@ if((x >= screensize_X) || (y >= screensize_Y)) return 0; unsigned short page = y * _BPP / 8; + /* to be used in correct implementation... unsigned char pos = y & ((8 / _BPP) - 1); // position in page unsigned char mask = (( 1 << _BPP) - 1); - + */ //FAUX return (_pixelBuffer[(x + page*screensize_X)]); // = (_pixelBuffer[(x + page*screensize_X)] & ~(mask<<(pos*_BPP))) | ((color&mask)<<(pos*_BPP)); } @@ -355,9 +356,6 @@ void SSD1322::copy_to_lcd(void) { - unsigned int x, y; - unsigned int i; - pixel_buffer_mutex.lock(); memcpy((void*)_trBuffer, (const void*)_pixelBuffer, @@ -372,6 +370,9 @@ _CS = 0; _spi.transfer((uint8_t*) _trBuffer, 64*128, (uint8_t*) NULL, 0, _spiEventCb); #else + unsigned int x, y; + unsigned int i; + i = 0; for(y=0; y<64; y++) for(x=0; x<128; x++) diff -r d9c5eaf85fab -r 48f29a1d43d6 lib/unigraphic/SSD1322.h --- a/lib/unigraphic/SSD1322.h Mon Oct 04 21:14:39 2021 +0200 +++ b/lib/unigraphic/SSD1322.h Mon Oct 04 21:15:35 2021 +0200 @@ -207,13 +207,6 @@ protected: - mbed::SPI _spi; - DigitalOut _CS; - DigitalOut _RST; - DigitalOut _DC; - volatile DISPLAY_BUFFER_TYPE _pixelBuffer[DISPLAY_BUFFER_ELEMENTS]; // one full frame buffer - DISPLAY_BUFFER_TYPE _trBuffer[DISPLAY_BUFFER_ELEMENTS]; // for sending - const int screensize_X; const int screensize_Y; const int _PAGES; @@ -222,6 +215,13 @@ const int _IC_Y_COMS; const int _IC_PAGES; + mbed::SPI _spi; + DigitalOut _DC; + DigitalOut _CS; + DigitalOut _RST; + volatile DISPLAY_BUFFER_TYPE _pixelBuffer[DISPLAY_BUFFER_ELEMENTS]; // one full frame buffer + DISPLAY_BUFFER_TYPE _trBuffer[DISPLAY_BUFFER_ELEMENTS]; // for sending + // pixel location int cur_x; int cur_y; diff -r d9c5eaf85fab -r 48f29a1d43d6 platformio.ini --- a/platformio.ini Mon Oct 04 21:14:39 2021 +0200 +++ b/platformio.ini Mon Oct 04 21:15:35 2021 +0200 @@ -21,6 +21,7 @@ platform = ststm32 framework = mbed platform_packages = +# framework-mbed @ file:///home/david/perso/embed/platformio/framework-mbed framework-mbed @ https://github.com/douardda/mbed-os.git#platformio board = hp34970_fp_f303rd board_build.mbed.ldscript = @@ -34,8 +35,8 @@ [env:fp_stlink] platform = ststm32 framework = mbed -platform_packages = - framework-mbed @ https://github.com/douardda/mbed-os.git#platformio +#platform_packages = +# framework-mbed @ https://github.com/douardda/mbed-os.git#platformio board = hp34970_fp_f303rd board_build.mbed.ldscript = $PROJECTSRC_DIR/../TARGET_HP34970_FP_F303RD/STM32F303XE.ld diff -r d9c5eaf85fab -r 48f29a1d43d6 src/def_f446re.h --- a/src/def_f446re.h Mon Oct 04 21:14:39 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#if !defined(DEF_F446RE_H) - - -#define DEF_F446RE_H -/******************************************************/ -/* F446RE */ -/******************************************************/ -// TODO: use TARGET_NUCLEO_F446RE or similar -// UART -// USBTX PA_2 -// USBRX PA_3 -// display -#define DSP_MOSI PB_15 // blue -#define DSP_MISO PB_14 // NC -#define DSP_SCLK PB_13 // yellow -#define DSP_CS PB_12 // green -#define DSP_RST PB_5 // green -#define DSP_DC PB_4 // red - -// UART for RX (CPU->DP) -#define HP_RX PC_11 // serial3 RX -#define HP_TX PC_10 // serial3 TX - -// RST pin (handle this by hand) -#define HP_RST PC_12 - -// encoder -#define KP_ENC1 PC_4 -#define KP_ENC2 PC_5 - -// keypad -#define KP_R0 PC_0 // I-6 -#define KP_R1 PC_1 // II-5 -#define KP_R2 PC_2 // I-5 -#define KP_R3 PC_3 // II-4 - - -#define KP_C0 PB_0 // I-4 -#define KP_C1 PA_6 // I-2 -#define KP_C2 PA_7 // I-3 -#define KP_C3 PA_10 // I-1 -#define KP_C4 PD_2 // II-1 - -// misc -#define DBGPIN PC_6 - -#ifdef HAVE_PC -BufferedSerial pc(USBTX, USBRX, 115200); -#endif -DigitalOut led(LED1); -#define HAS_LED -#endif diff -r d9c5eaf85fab -r 48f29a1d43d6 src/display.cpp --- a/src/display.cpp Mon Oct 04 21:14:39 2021 +0200 +++ b/src/display.cpp Mon Oct 04 21:15:35 2021 +0200 @@ -278,7 +278,6 @@ void Display::draw_flag(uint8_t flagid) { - uint8_t i; uint8_t bgcolor = 0x00, fgcolor = 0x0F; ::printf(" FLAG %X:", flagid); diff -r d9c5eaf85fab -r 48f29a1d43d6 src/hp34comm.cpp --- a/src/hp34comm.cpp Mon Oct 04 21:14:39 2021 +0200 +++ b/src/hp34comm.cpp Mon Oct 04 21:15:35 2021 +0200 @@ -30,6 +30,15 @@ } +void HPSerial::reset(void) +{ + sendbuf.reset(); + cmdbuf.reset(); + cur_state = STATE_IDLE; + cur_gstate = GSTATE_IDLE; +} + + // SEND related methods void HPSerial::sendkey(uint8_t keycode) { diff -r d9c5eaf85fab -r 48f29a1d43d6 src/hp34comm.h --- a/src/hp34comm.h Mon Oct 04 21:14:39 2021 +0200 +++ b/src/hp34comm.h Mon Oct 04 21:15:35 2021 +0200 @@ -25,6 +25,7 @@ HPSerial(PinName tx, PinName rx); + void reset(void); bool cmd_available(void); bool pop(CMD& cmd); bool cmd_buf_full(void);