From 74b765e8015d38fa068283b977bc42182aa4128a Mon Sep 17 00:00:00 2001 From: Martin Jaeger <17674105+martinjaeger@users.noreply.github.com> Date: Thu, 21 Nov 2019 07:44:15 +0100 Subject: [PATCH] Trailing white spaces removed --- CONTRIBUTING.md | 8 +- lib/Adafruit_GFX/Adafruit_GFX.cpp | 58 +-- lib/Adafruit_GFX/Adafruit_GFX.h | 20 +- lib/Adafruit_GFX/Adafruit_SSD1306.h | 18 +- lib/Adafruit_GFX/glcdfont.h | 518 +++++++++---------- lib/USBDevice/USBDevice.cpp | 8 +- lib/USBDevice/USBHAL_STM32L1.cpp | 14 +- lib/USBDevice/USBRegs_STM32.h | 1 - lib/USBMIDI/USBMIDI.cpp | 16 +- lib/USBMIDI/USBMIDI.h | 2 +- lib/readme.txt | 1 - linker_flags_newlib-nano.py | 2 +- src/bl_support.cpp | 44 +- src/bl_support.h | 20 +- src/eeprom.cpp | 14 +- src/eeprom.h | 4 +- src/{half_bridge_tim.cpp => half_bridge.cpp} | 13 +- src/thingset_serial.cpp | 2 +- src/uext.cpp | 1 - src/uext.h | 6 +- test/adc_dma_stub.h | 2 +- test/main.cpp | 2 +- test/tests_bat_charger.cpp | 2 +- test/tests_dcdc.cpp | 2 +- test/tests_half_bridge.cpp | 7 +- test/tests_power_port.cpp | 2 +- 26 files changed, 391 insertions(+), 396 deletions(-) rename src/{half_bridge_tim.cpp => half_bridge.cpp} (97%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba674bf..84e6952 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ Here is a quick summary how contributions work on GitHub: 2. Clone the repository to your local computer using `git clone https://github.com/your-github-username/repository-name.git` 3. Create a new branch where you will later add your changes using `git switch -c branch-name` 4. Update the files to fix the issue or add new features -5. Use `git add your-changed-files` to add the file contents of the changed files to the so-called staging area (means +5. Use `git add your-changed-files` to add the file contents of the changed files to the so-called staging area (means they are prepared to be committed) 6. Run `git commit -m "Short message to describe the changes"` to add the staged files to the respository 7. Upload the changes to the remote repository on GitHub using `git push origin branch-name` @@ -28,10 +28,10 @@ Here is a quick summary how contributions work on GitHub: ### Important remarks: -- Better make several small [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) than +- Better make several small [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) than a single big one -- Use meaningful commit messages and pull request topics. Tell *what* was changed and not that *something* was changed. - "ADC measurements: Improved performance of temperature sensor reading" is much better than "Updates". You can also +- Use meaningful commit messages and pull request topics. Tell *what* was changed and not that *something* was changed. + "ADC measurements: Improved performance of temperature sensor reading" is much better than "Updates". You can also reference an issue with its numer (e.g. #123) in the commit message - Use the [Libre Solar coding style](https://libre.solar/docs/coding_style/) diff --git a/lib/Adafruit_GFX/Adafruit_GFX.cpp b/lib/Adafruit_GFX/Adafruit_GFX.cpp index 708ef20..769109d 100644 --- a/lib/Adafruit_GFX/Adafruit_GFX.cpp +++ b/lib/Adafruit_GFX/Adafruit_GFX.cpp @@ -1,14 +1,14 @@ /*********************************** -This is a our graphics core library, for all our displays. +This is a our graphics core library, for all our displays. We'll be adapting all the -existing libaries to use this core to make updating, support +existing libaries to use this core to make updating, support and upgrading easier! -Adafruit invests time and resources providing this open source code, -please support Adafruit and open-source hardware by purchasing +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing products from Adafruit! -Written by Limor Fried/Ladyada for Adafruit Industries. +Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution ****************************************/ @@ -31,12 +31,12 @@ void Adafruit_GFX::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) int16_t ddF_y = -2 * r; int16_t x = 0; int16_t y = r; - + drawPixel(x0, y0+r, color); drawPixel(x0, y0-r, color); drawPixel(x0+r, y0, color); drawPixel(x0-r, y0, color); - + while (x= 0) @@ -48,7 +48,7 @@ void Adafruit_GFX::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) x++; ddF_x += 2; f += ddF_x; - + drawPixel(x0 + x, y0 + y, color); drawPixel(x0 - x, y0 + y, color); drawPixel(x0 + x, y0 - y, color); @@ -67,7 +67,7 @@ void Adafruit_GFX::drawCircleHelper( int16_t x0, int16_t y0, int16_t r, uint8_t int16_t ddF_y = -2 * r; int16_t x = 0; int16_t y = r; - + while (x= 0) @@ -79,12 +79,12 @@ void Adafruit_GFX::drawCircleHelper( int16_t x0, int16_t y0, int16_t r, uint8_t x++; ddF_x += 2; f += ddF_x; - + if (cornername & 0x4) { drawPixel(x0 + x, y0 + y, color); drawPixel(x0 + y, y0 + x, color); - } + } if (cornername & 0x2) { @@ -97,7 +97,7 @@ void Adafruit_GFX::drawCircleHelper( int16_t x0, int16_t y0, int16_t r, uint8_t drawPixel(x0 - y, y0 + x, color); drawPixel(x0 - x, y0 + y, color); } - + if (cornername & 0x1) { drawPixel(x0 - y, y0 - x, color); @@ -120,7 +120,7 @@ void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t c int16_t ddF_y = -2 * r; int16_t x = 0; int16_t y = r; - + while (x= 0) @@ -132,7 +132,7 @@ void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t c x++; ddF_x += 2; f += ddF_x; - + if (cornername & 0x1) { drawFastVLine(x0+x, y0-y, 2*y+1+delta, color); @@ -153,31 +153,31 @@ void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t c void Adafruit_GFX::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { int16_t steep = abs(y1 - y0) > abs(x1 - x0); - + if (steep) { swap(x0, y0); swap(x1, y1); } - + if (x0 > x1) { swap(x0, x1); swap(y0, y1); } - + int16_t dx, dy; dx = x1 - x0; dy = abs(y1 - y0); - + int16_t err = dx / 2; int16_t ystep; - + if (y0 < y1) ystep = 1; else ystep = -1; - + for (; x0<=x1; x0++) { if (steep) @@ -204,7 +204,7 @@ void Adafruit_GFX::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t { // stupidest version - update in subclasses if desired! for (int16_t i=x; i= y1 >= y0) if (y0 > y1) { @@ -284,7 +284,7 @@ void Adafruit_GFX::fillTriangle ( int16_t x0, int16_t y0, int16_t x1, int16_t y1 swap(y0, y1); swap(x0, x1); } - + if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing a = b = x0; @@ -292,7 +292,7 @@ void Adafruit_GFX::fillTriangle ( int16_t x0, int16_t y0, int16_t x1, int16_t y1 a = x1; else if(x1 > b) b = x1; - + if(x2 < a) a = x2; else if(x2 > b) b = x2; @@ -401,16 +401,16 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c, uint16_t colo ((y + 8 * size - 1) < 0) // Clip top ) return; - + for (int8_t i=0; i<6; i++ ) { uint8_t line = 0; - if (i == 5) + if (i == 5) line = 0x0; - else + else line = font[(c*5)+i]; - + for (int8_t j = 0; j<8; j++) { if (line & 0x1) diff --git a/lib/Adafruit_GFX/Adafruit_GFX.h b/lib/Adafruit_GFX/Adafruit_GFX.h index d3c2240..df4e135 100644 --- a/lib/Adafruit_GFX/Adafruit_GFX.h +++ b/lib/Adafruit_GFX/Adafruit_GFX.h @@ -1,14 +1,14 @@ /*********************************** -This is a our graphics core library, for all our displays. +This is a our graphics core library, for all our displays. We'll be adapting all the -existing libaries to use this core to make updating, support +existing libaries to use this core to make updating, support and upgrading easier! -Adafruit invests time and resources providing this open source code, -please support Adafruit and open-source hardware by purchasing +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing products from Adafruit! -Written by Limor Fried/Ladyada for Adafruit Industries. +Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution ****************************************/ @@ -25,7 +25,7 @@ All text above must be included in any redistribution static inline void swap(int16_t &a, int16_t &b) { int16_t t = a; - + a = b; b = t; } @@ -68,7 +68,7 @@ class Adafruit_GFX : public Stream virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; // this is optional virtual void invertDisplay(bool i) {}; - + // Stream implementation - provides printf() interface // You would otherwise be forced to use writeChar() virtual int _putc(int value) { return writeChar(value); }; @@ -76,7 +76,7 @@ class Adafruit_GFX : public Stream #ifdef GFX_WANT_ABSTRACTS // these are 'generic' drawing functions, so we can share them! - + /** Draw a Horizontal Line * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h */ @@ -95,7 +95,7 @@ class Adafruit_GFX : public Stream */ void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color); void drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color); - + /** Draw and fill a circle * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h */ @@ -110,7 +110,7 @@ class Adafruit_GFX : public Stream * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h */ void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); - + /** Draw a rounded rectangle * @note GFX_WANT_ABSTRACTS must be defined in Adafruit_GFX_config.h */ diff --git a/lib/Adafruit_GFX/Adafruit_SSD1306.h b/lib/Adafruit_GFX/Adafruit_SSD1306.h index 3d84f9f..94d4cbb 100644 --- a/lib/Adafruit_GFX/Adafruit_SSD1306.h +++ b/lib/Adafruit_GFX/Adafruit_SSD1306.h @@ -4,14 +4,14 @@ This is a library for our Monochrome OLEDs based on SSD1306 drivers Pick one up today in the adafruit shop! ------> http://www.adafruit.com/category/63_98 -These displays use SPI to communicate, 4 or 5 pins are required to +These displays use SPI to communicate, 4 or 5 pins are required to interface -Adafruit invests time and resources providing this open source code, -please support Adafruit and open-source hardware by purchasing +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing products from Adafruit! -Written by Limor Fried/Ladyada for Adafruit Industries. +Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution *********************************************************************/ @@ -58,13 +58,13 @@ public: }; void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC); - + // These must be implemented in the derived transport driver virtual void command(uint8_t c) = 0; virtual void data(uint8_t c) = 0; virtual void drawPixel(int16_t x, int16_t y, uint16_t color); - /// Clear the display buffer + /// Clear the display buffer void clearDisplay(void); virtual void invertDisplay(bool i); @@ -72,7 +72,7 @@ public: void display(); /// Fill the buffer with the AdaFruit splash screen. virtual void splash(); - + protected: virtual void sendDisplayBuffer() = 0; DigitalOut2 rst; @@ -203,11 +203,11 @@ protected: buff[0] = 0x40; // Data Mode // send display buffer in 16 byte chunks - for(uint16_t i=0, q=buffer.size(); i http://www.adafruit.com/category/63_98 -These displays use SPI to communicate, 4 or 5 pins are required to +These displays use SPI to communicate, 4 or 5 pins are required to interface -Adafruit invests time and resources providing this open source code, -please support Adafruit and open-source hardware by purchasing +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing products from Adafruit! -Written by Limor Fried/Ladyada for Adafruit Industries. +Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution *********************************************************************/ @@ -19,267 +19,267 @@ All text above, and the splash screen must be included in any redistribution /* * Modified by Neal Horman 7/14/2012 for use in LPC1768 */ - + #ifndef FONT5X7_H #define FONT5X7_H // standard ascii 5x7 font static unsigned char font[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, - 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, - 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, - 0x18, 0x3C, 0x7E, 0x3C, 0x18, - 0x1C, 0x57, 0x7D, 0x57, 0x1C, - 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, - 0x00, 0x18, 0x3C, 0x18, 0x00, - 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, - 0x00, 0x18, 0x24, 0x18, 0x00, - 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, - 0x30, 0x48, 0x3A, 0x06, 0x0E, - 0x26, 0x29, 0x79, 0x29, 0x26, - 0x40, 0x7F, 0x05, 0x05, 0x07, - 0x40, 0x7F, 0x05, 0x25, 0x3F, - 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, - 0x7F, 0x3E, 0x1C, 0x1C, 0x08, - 0x08, 0x1C, 0x1C, 0x3E, 0x7F, - 0x14, 0x22, 0x7F, 0x22, 0x14, - 0x5F, 0x5F, 0x00, 0x5F, 0x5F, - 0x06, 0x09, 0x7F, 0x01, 0x7F, - 0x00, 0x66, 0x89, 0x95, 0x6A, - 0x60, 0x60, 0x60, 0x60, 0x60, - 0x94, 0xA2, 0xFF, 0xA2, 0x94, - 0x08, 0x04, 0x7E, 0x04, 0x08, - 0x10, 0x20, 0x7E, 0x20, 0x10, - 0x08, 0x08, 0x2A, 0x1C, 0x08, - 0x08, 0x1C, 0x2A, 0x08, 0x08, - 0x1E, 0x10, 0x10, 0x10, 0x10, - 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, - 0x30, 0x38, 0x3E, 0x38, 0x30, - 0x06, 0x0E, 0x3E, 0x0E, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x5F, 0x00, 0x00, - 0x00, 0x07, 0x00, 0x07, 0x00, - 0x14, 0x7F, 0x14, 0x7F, 0x14, - 0x24, 0x2A, 0x7F, 0x2A, 0x12, - 0x23, 0x13, 0x08, 0x64, 0x62, - 0x36, 0x49, 0x56, 0x20, 0x50, - 0x00, 0x08, 0x07, 0x03, 0x00, - 0x00, 0x1C, 0x22, 0x41, 0x00, - 0x00, 0x41, 0x22, 0x1C, 0x00, - 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, - 0x08, 0x08, 0x3E, 0x08, 0x08, - 0x00, 0x80, 0x70, 0x30, 0x00, - 0x08, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x60, 0x60, 0x00, - 0x20, 0x10, 0x08, 0x04, 0x02, - 0x3E, 0x51, 0x49, 0x45, 0x3E, - 0x00, 0x42, 0x7F, 0x40, 0x00, - 0x72, 0x49, 0x49, 0x49, 0x46, - 0x21, 0x41, 0x49, 0x4D, 0x33, - 0x18, 0x14, 0x12, 0x7F, 0x10, - 0x27, 0x45, 0x45, 0x45, 0x39, - 0x3C, 0x4A, 0x49, 0x49, 0x31, - 0x41, 0x21, 0x11, 0x09, 0x07, - 0x36, 0x49, 0x49, 0x49, 0x36, - 0x46, 0x49, 0x49, 0x29, 0x1E, - 0x00, 0x00, 0x14, 0x00, 0x00, - 0x00, 0x40, 0x34, 0x00, 0x00, - 0x00, 0x08, 0x14, 0x22, 0x41, - 0x14, 0x14, 0x14, 0x14, 0x14, - 0x00, 0x41, 0x22, 0x14, 0x08, - 0x02, 0x01, 0x59, 0x09, 0x06, - 0x3E, 0x41, 0x5D, 0x59, 0x4E, - 0x7C, 0x12, 0x11, 0x12, 0x7C, - 0x7F, 0x49, 0x49, 0x49, 0x36, - 0x3E, 0x41, 0x41, 0x41, 0x22, - 0x7F, 0x41, 0x41, 0x41, 0x3E, - 0x7F, 0x49, 0x49, 0x49, 0x41, - 0x7F, 0x09, 0x09, 0x09, 0x01, - 0x3E, 0x41, 0x41, 0x51, 0x73, - 0x7F, 0x08, 0x08, 0x08, 0x7F, - 0x00, 0x41, 0x7F, 0x41, 0x00, - 0x20, 0x40, 0x41, 0x3F, 0x01, - 0x7F, 0x08, 0x14, 0x22, 0x41, - 0x7F, 0x40, 0x40, 0x40, 0x40, - 0x7F, 0x02, 0x1C, 0x02, 0x7F, - 0x7F, 0x04, 0x08, 0x10, 0x7F, - 0x3E, 0x41, 0x41, 0x41, 0x3E, - 0x7F, 0x09, 0x09, 0x09, 0x06, - 0x3E, 0x41, 0x51, 0x21, 0x5E, - 0x7F, 0x09, 0x19, 0x29, 0x46, - 0x26, 0x49, 0x49, 0x49, 0x32, - 0x03, 0x01, 0x7F, 0x01, 0x03, - 0x3F, 0x40, 0x40, 0x40, 0x3F, - 0x1F, 0x20, 0x40, 0x20, 0x1F, - 0x3F, 0x40, 0x38, 0x40, 0x3F, - 0x63, 0x14, 0x08, 0x14, 0x63, - 0x03, 0x04, 0x78, 0x04, 0x03, - 0x61, 0x59, 0x49, 0x4D, 0x43, - 0x00, 0x7F, 0x41, 0x41, 0x41, - 0x02, 0x04, 0x08, 0x10, 0x20, - 0x00, 0x41, 0x41, 0x41, 0x7F, - 0x04, 0x02, 0x01, 0x02, 0x04, - 0x40, 0x40, 0x40, 0x40, 0x40, - 0x00, 0x03, 0x07, 0x08, 0x00, - 0x20, 0x54, 0x54, 0x78, 0x40, - 0x7F, 0x28, 0x44, 0x44, 0x38, - 0x38, 0x44, 0x44, 0x44, 0x28, - 0x38, 0x44, 0x44, 0x28, 0x7F, - 0x38, 0x54, 0x54, 0x54, 0x18, - 0x00, 0x08, 0x7E, 0x09, 0x02, - 0x18, 0xA4, 0xA4, 0x9C, 0x78, - 0x7F, 0x08, 0x04, 0x04, 0x78, - 0x00, 0x44, 0x7D, 0x40, 0x00, - 0x20, 0x40, 0x40, 0x3D, 0x00, - 0x7F, 0x10, 0x28, 0x44, 0x00, - 0x00, 0x41, 0x7F, 0x40, 0x00, - 0x7C, 0x04, 0x78, 0x04, 0x78, - 0x7C, 0x08, 0x04, 0x04, 0x78, - 0x38, 0x44, 0x44, 0x44, 0x38, - 0xFC, 0x18, 0x24, 0x24, 0x18, - 0x18, 0x24, 0x24, 0x18, 0xFC, - 0x7C, 0x08, 0x04, 0x04, 0x08, - 0x48, 0x54, 0x54, 0x54, 0x24, - 0x04, 0x04, 0x3F, 0x44, 0x24, - 0x3C, 0x40, 0x40, 0x20, 0x7C, - 0x1C, 0x20, 0x40, 0x20, 0x1C, - 0x3C, 0x40, 0x30, 0x40, 0x3C, - 0x44, 0x28, 0x10, 0x28, 0x44, - 0x4C, 0x90, 0x90, 0x90, 0x7C, - 0x44, 0x64, 0x54, 0x4C, 0x44, - 0x00, 0x08, 0x36, 0x41, 0x00, - 0x00, 0x00, 0x77, 0x00, 0x00, - 0x00, 0x41, 0x36, 0x08, 0x00, - 0x02, 0x01, 0x02, 0x04, 0x02, - 0x3C, 0x26, 0x23, 0x26, 0x3C, - 0x1E, 0xA1, 0xA1, 0x61, 0x12, - 0x3A, 0x40, 0x40, 0x20, 0x7A, - 0x38, 0x54, 0x54, 0x55, 0x59, - 0x21, 0x55, 0x55, 0x79, 0x41, - 0x21, 0x54, 0x54, 0x78, 0x41, - 0x21, 0x55, 0x54, 0x78, 0x40, - 0x20, 0x54, 0x55, 0x79, 0x40, - 0x0C, 0x1E, 0x52, 0x72, 0x12, - 0x39, 0x55, 0x55, 0x55, 0x59, - 0x39, 0x54, 0x54, 0x54, 0x59, - 0x39, 0x55, 0x54, 0x54, 0x58, - 0x00, 0x00, 0x45, 0x7C, 0x41, - 0x00, 0x02, 0x45, 0x7D, 0x42, - 0x00, 0x01, 0x45, 0x7C, 0x40, - 0xF0, 0x29, 0x24, 0x29, 0xF0, - 0xF0, 0x28, 0x25, 0x28, 0xF0, - 0x7C, 0x54, 0x55, 0x45, 0x00, - 0x20, 0x54, 0x54, 0x7C, 0x54, - 0x7C, 0x0A, 0x09, 0x7F, 0x49, - 0x32, 0x49, 0x49, 0x49, 0x32, - 0x32, 0x48, 0x48, 0x48, 0x32, - 0x32, 0x4A, 0x48, 0x48, 0x30, - 0x3A, 0x41, 0x41, 0x21, 0x7A, - 0x3A, 0x42, 0x40, 0x20, 0x78, - 0x00, 0x9D, 0xA0, 0xA0, 0x7D, - 0x39, 0x44, 0x44, 0x44, 0x39, - 0x3D, 0x40, 0x40, 0x40, 0x3D, - 0x3C, 0x24, 0xFF, 0x24, 0x24, - 0x48, 0x7E, 0x49, 0x43, 0x66, - 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, - 0xFF, 0x09, 0x29, 0xF6, 0x20, - 0xC0, 0x88, 0x7E, 0x09, 0x03, - 0x20, 0x54, 0x54, 0x79, 0x41, - 0x00, 0x00, 0x44, 0x7D, 0x41, - 0x30, 0x48, 0x48, 0x4A, 0x32, - 0x38, 0x40, 0x40, 0x22, 0x7A, - 0x00, 0x7A, 0x0A, 0x0A, 0x72, - 0x7D, 0x0D, 0x19, 0x31, 0x7D, - 0x26, 0x29, 0x29, 0x2F, 0x28, - 0x26, 0x29, 0x29, 0x29, 0x26, - 0x30, 0x48, 0x4D, 0x40, 0x20, - 0x38, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x38, - 0x2F, 0x10, 0xC8, 0xAC, 0xBA, - 0x2F, 0x10, 0x28, 0x34, 0xFA, - 0x00, 0x00, 0x7B, 0x00, 0x00, - 0x08, 0x14, 0x2A, 0x14, 0x22, - 0x22, 0x14, 0x2A, 0x14, 0x08, - 0xAA, 0x00, 0x55, 0x00, 0xAA, - 0xAA, 0x55, 0xAA, 0x55, 0xAA, - 0x00, 0x00, 0x00, 0xFF, 0x00, - 0x10, 0x10, 0x10, 0xFF, 0x00, - 0x14, 0x14, 0x14, 0xFF, 0x00, - 0x10, 0x10, 0xFF, 0x00, 0xFF, - 0x10, 0x10, 0xF0, 0x10, 0xF0, - 0x14, 0x14, 0x14, 0xFC, 0x00, - 0x14, 0x14, 0xF7, 0x00, 0xFF, - 0x00, 0x00, 0xFF, 0x00, 0xFF, - 0x14, 0x14, 0xF4, 0x04, 0xFC, - 0x14, 0x14, 0x17, 0x10, 0x1F, - 0x10, 0x10, 0x1F, 0x10, 0x1F, - 0x14, 0x14, 0x14, 0x1F, 0x00, - 0x10, 0x10, 0x10, 0xF0, 0x00, - 0x00, 0x00, 0x00, 0x1F, 0x10, - 0x10, 0x10, 0x10, 0x1F, 0x10, - 0x10, 0x10, 0x10, 0xF0, 0x10, - 0x00, 0x00, 0x00, 0xFF, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xFF, 0x10, - 0x00, 0x00, 0x00, 0xFF, 0x14, - 0x00, 0x00, 0xFF, 0x00, 0xFF, - 0x00, 0x00, 0x1F, 0x10, 0x17, - 0x00, 0x00, 0xFC, 0x04, 0xF4, - 0x14, 0x14, 0x17, 0x10, 0x17, - 0x14, 0x14, 0xF4, 0x04, 0xF4, - 0x00, 0x00, 0xFF, 0x00, 0xF7, - 0x14, 0x14, 0x14, 0x14, 0x14, - 0x14, 0x14, 0xF7, 0x00, 0xF7, - 0x14, 0x14, 0x14, 0x17, 0x14, - 0x10, 0x10, 0x1F, 0x10, 0x1F, - 0x14, 0x14, 0x14, 0xF4, 0x14, - 0x10, 0x10, 0xF0, 0x10, 0xF0, - 0x00, 0x00, 0x1F, 0x10, 0x1F, - 0x00, 0x00, 0x00, 0x1F, 0x14, - 0x00, 0x00, 0x00, 0xFC, 0x14, - 0x00, 0x00, 0xF0, 0x10, 0xF0, - 0x10, 0x10, 0xFF, 0x10, 0xFF, - 0x14, 0x14, 0x14, 0xFF, 0x14, - 0x10, 0x10, 0x10, 0x1F, 0x00, - 0x00, 0x00, 0x00, 0xF0, 0x10, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xFF, 0xFF, 0xFF, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFF, 0xFF, - 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, - 0x38, 0x44, 0x44, 0x38, 0x44, - 0x7C, 0x2A, 0x2A, 0x3E, 0x14, - 0x7E, 0x02, 0x02, 0x06, 0x06, - 0x02, 0x7E, 0x02, 0x7E, 0x02, - 0x63, 0x55, 0x49, 0x41, 0x63, - 0x38, 0x44, 0x44, 0x3C, 0x04, - 0x40, 0x7E, 0x20, 0x1E, 0x20, - 0x06, 0x02, 0x7E, 0x02, 0x02, - 0x99, 0xA5, 0xE7, 0xA5, 0x99, - 0x1C, 0x2A, 0x49, 0x2A, 0x1C, - 0x4C, 0x72, 0x01, 0x72, 0x4C, - 0x30, 0x4A, 0x4D, 0x4D, 0x30, - 0x30, 0x48, 0x78, 0x48, 0x30, - 0xBC, 0x62, 0x5A, 0x46, 0x3D, - 0x3E, 0x49, 0x49, 0x49, 0x00, - 0x7E, 0x01, 0x01, 0x01, 0x7E, - 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, - 0x44, 0x44, 0x5F, 0x44, 0x44, - 0x40, 0x51, 0x4A, 0x44, 0x40, - 0x40, 0x44, 0x4A, 0x51, 0x40, - 0x00, 0x00, 0xFF, 0x01, 0x03, - 0xE0, 0x80, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, + 0x00, 0x18, 0x3C, 0x18, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, + 0x00, 0x18, 0x24, 0x18, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, + 0x30, 0x48, 0x3A, 0x06, 0x0E, + 0x26, 0x29, 0x79, 0x29, 0x26, + 0x40, 0x7F, 0x05, 0x05, 0x07, + 0x40, 0x7F, 0x05, 0x25, 0x3F, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, + 0x14, 0x22, 0x7F, 0x22, 0x14, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, + 0x06, 0x09, 0x7F, 0x01, 0x7F, + 0x00, 0x66, 0x89, 0x95, 0x6A, + 0x60, 0x60, 0x60, 0x60, 0x60, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, + 0x08, 0x04, 0x7E, 0x04, 0x08, + 0x10, 0x20, 0x7E, 0x20, 0x10, + 0x08, 0x08, 0x2A, 0x1C, 0x08, + 0x08, 0x1C, 0x2A, 0x08, 0x08, + 0x1E, 0x10, 0x10, 0x10, 0x10, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, + 0x30, 0x38, 0x3E, 0x38, 0x30, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, + 0x23, 0x13, 0x08, 0x64, 0x62, + 0x36, 0x49, 0x56, 0x20, 0x50, + 0x00, 0x08, 0x07, 0x03, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, + 0x08, 0x08, 0x3E, 0x08, 0x08, + 0x00, 0x80, 0x70, 0x30, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x60, 0x60, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, + 0x3E, 0x51, 0x49, 0x45, 0x3E, + 0x00, 0x42, 0x7F, 0x40, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, + 0x21, 0x41, 0x49, 0x4D, 0x33, + 0x18, 0x14, 0x12, 0x7F, 0x10, + 0x27, 0x45, 0x45, 0x45, 0x39, + 0x3C, 0x4A, 0x49, 0x49, 0x31, + 0x41, 0x21, 0x11, 0x09, 0x07, + 0x36, 0x49, 0x49, 0x49, 0x36, + 0x46, 0x49, 0x49, 0x29, 0x1E, + 0x00, 0x00, 0x14, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, + 0x14, 0x14, 0x14, 0x14, 0x14, + 0x00, 0x41, 0x22, 0x14, 0x08, + 0x02, 0x01, 0x59, 0x09, 0x06, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, + 0x7C, 0x12, 0x11, 0x12, 0x7C, + 0x7F, 0x49, 0x49, 0x49, 0x36, + 0x3E, 0x41, 0x41, 0x41, 0x22, + 0x7F, 0x41, 0x41, 0x41, 0x3E, + 0x7F, 0x49, 0x49, 0x49, 0x41, + 0x7F, 0x09, 0x09, 0x09, 0x01, + 0x3E, 0x41, 0x41, 0x51, 0x73, + 0x7F, 0x08, 0x08, 0x08, 0x7F, + 0x00, 0x41, 0x7F, 0x41, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, + 0x7F, 0x08, 0x14, 0x22, 0x41, + 0x7F, 0x40, 0x40, 0x40, 0x40, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, + 0x7F, 0x04, 0x08, 0x10, 0x7F, + 0x3E, 0x41, 0x41, 0x41, 0x3E, + 0x7F, 0x09, 0x09, 0x09, 0x06, + 0x3E, 0x41, 0x51, 0x21, 0x5E, + 0x7F, 0x09, 0x19, 0x29, 0x46, + 0x26, 0x49, 0x49, 0x49, 0x32, + 0x03, 0x01, 0x7F, 0x01, 0x03, + 0x3F, 0x40, 0x40, 0x40, 0x3F, + 0x1F, 0x20, 0x40, 0x20, 0x1F, + 0x3F, 0x40, 0x38, 0x40, 0x3F, + 0x63, 0x14, 0x08, 0x14, 0x63, + 0x03, 0x04, 0x78, 0x04, 0x03, + 0x61, 0x59, 0x49, 0x4D, 0x43, + 0x00, 0x7F, 0x41, 0x41, 0x41, + 0x02, 0x04, 0x08, 0x10, 0x20, + 0x00, 0x41, 0x41, 0x41, 0x7F, + 0x04, 0x02, 0x01, 0x02, 0x04, + 0x40, 0x40, 0x40, 0x40, 0x40, + 0x00, 0x03, 0x07, 0x08, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, + 0x7F, 0x28, 0x44, 0x44, 0x38, + 0x38, 0x44, 0x44, 0x44, 0x28, + 0x38, 0x44, 0x44, 0x28, 0x7F, + 0x38, 0x54, 0x54, 0x54, 0x18, + 0x00, 0x08, 0x7E, 0x09, 0x02, + 0x18, 0xA4, 0xA4, 0x9C, 0x78, + 0x7F, 0x08, 0x04, 0x04, 0x78, + 0x00, 0x44, 0x7D, 0x40, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, + 0x7C, 0x08, 0x04, 0x04, 0x78, + 0x38, 0x44, 0x44, 0x44, 0x38, + 0xFC, 0x18, 0x24, 0x24, 0x18, + 0x18, 0x24, 0x24, 0x18, 0xFC, + 0x7C, 0x08, 0x04, 0x04, 0x08, + 0x48, 0x54, 0x54, 0x54, 0x24, + 0x04, 0x04, 0x3F, 0x44, 0x24, + 0x3C, 0x40, 0x40, 0x20, 0x7C, + 0x1C, 0x20, 0x40, 0x20, 0x1C, + 0x3C, 0x40, 0x30, 0x40, 0x3C, + 0x44, 0x28, 0x10, 0x28, 0x44, + 0x4C, 0x90, 0x90, 0x90, 0x7C, + 0x44, 0x64, 0x54, 0x4C, 0x44, + 0x00, 0x08, 0x36, 0x41, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, + 0x3C, 0x26, 0x23, 0x26, 0x3C, + 0x1E, 0xA1, 0xA1, 0x61, 0x12, + 0x3A, 0x40, 0x40, 0x20, 0x7A, + 0x38, 0x54, 0x54, 0x55, 0x59, + 0x21, 0x55, 0x55, 0x79, 0x41, + 0x21, 0x54, 0x54, 0x78, 0x41, + 0x21, 0x55, 0x54, 0x78, 0x40, + 0x20, 0x54, 0x55, 0x79, 0x40, + 0x0C, 0x1E, 0x52, 0x72, 0x12, + 0x39, 0x55, 0x55, 0x55, 0x59, + 0x39, 0x54, 0x54, 0x54, 0x59, + 0x39, 0x55, 0x54, 0x54, 0x58, + 0x00, 0x00, 0x45, 0x7C, 0x41, + 0x00, 0x02, 0x45, 0x7D, 0x42, + 0x00, 0x01, 0x45, 0x7C, 0x40, + 0xF0, 0x29, 0x24, 0x29, 0xF0, + 0xF0, 0x28, 0x25, 0x28, 0xF0, + 0x7C, 0x54, 0x55, 0x45, 0x00, + 0x20, 0x54, 0x54, 0x7C, 0x54, + 0x7C, 0x0A, 0x09, 0x7F, 0x49, + 0x32, 0x49, 0x49, 0x49, 0x32, + 0x32, 0x48, 0x48, 0x48, 0x32, + 0x32, 0x4A, 0x48, 0x48, 0x30, + 0x3A, 0x41, 0x41, 0x21, 0x7A, + 0x3A, 0x42, 0x40, 0x20, 0x78, + 0x00, 0x9D, 0xA0, 0xA0, 0x7D, + 0x39, 0x44, 0x44, 0x44, 0x39, + 0x3D, 0x40, 0x40, 0x40, 0x3D, + 0x3C, 0x24, 0xFF, 0x24, 0x24, + 0x48, 0x7E, 0x49, 0x43, 0x66, + 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, + 0xFF, 0x09, 0x29, 0xF6, 0x20, + 0xC0, 0x88, 0x7E, 0x09, 0x03, + 0x20, 0x54, 0x54, 0x79, 0x41, + 0x00, 0x00, 0x44, 0x7D, 0x41, + 0x30, 0x48, 0x48, 0x4A, 0x32, + 0x38, 0x40, 0x40, 0x22, 0x7A, + 0x00, 0x7A, 0x0A, 0x0A, 0x72, + 0x7D, 0x0D, 0x19, 0x31, 0x7D, + 0x26, 0x29, 0x29, 0x2F, 0x28, + 0x26, 0x29, 0x29, 0x29, 0x26, + 0x30, 0x48, 0x4D, 0x40, 0x20, + 0x38, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x38, + 0x2F, 0x10, 0xC8, 0xAC, 0xBA, + 0x2F, 0x10, 0x28, 0x34, 0xFA, + 0x00, 0x00, 0x7B, 0x00, 0x00, + 0x08, 0x14, 0x2A, 0x14, 0x22, + 0x22, 0x14, 0x2A, 0x14, 0x08, + 0xAA, 0x00, 0x55, 0x00, 0xAA, + 0xAA, 0x55, 0xAA, 0x55, 0xAA, + 0x00, 0x00, 0x00, 0xFF, 0x00, + 0x10, 0x10, 0x10, 0xFF, 0x00, + 0x14, 0x14, 0x14, 0xFF, 0x00, + 0x10, 0x10, 0xFF, 0x00, 0xFF, + 0x10, 0x10, 0xF0, 0x10, 0xF0, + 0x14, 0x14, 0x14, 0xFC, 0x00, + 0x14, 0x14, 0xF7, 0x00, 0xFF, + 0x00, 0x00, 0xFF, 0x00, 0xFF, + 0x14, 0x14, 0xF4, 0x04, 0xFC, + 0x14, 0x14, 0x17, 0x10, 0x1F, + 0x10, 0x10, 0x1F, 0x10, 0x1F, + 0x14, 0x14, 0x14, 0x1F, 0x00, + 0x10, 0x10, 0x10, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0x1F, 0x10, + 0x10, 0x10, 0x10, 0x1F, 0x10, + 0x10, 0x10, 0x10, 0xF0, 0x10, + 0x00, 0x00, 0x00, 0xFF, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xFF, 0x10, + 0x00, 0x00, 0x00, 0xFF, 0x14, + 0x00, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0x00, 0x1F, 0x10, 0x17, + 0x00, 0x00, 0xFC, 0x04, 0xF4, + 0x14, 0x14, 0x17, 0x10, 0x17, + 0x14, 0x14, 0xF4, 0x04, 0xF4, + 0x00, 0x00, 0xFF, 0x00, 0xF7, + 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0xF7, 0x00, 0xF7, + 0x14, 0x14, 0x14, 0x17, 0x14, + 0x10, 0x10, 0x1F, 0x10, 0x1F, + 0x14, 0x14, 0x14, 0xF4, 0x14, + 0x10, 0x10, 0xF0, 0x10, 0xF0, + 0x00, 0x00, 0x1F, 0x10, 0x1F, + 0x00, 0x00, 0x00, 0x1F, 0x14, + 0x00, 0x00, 0x00, 0xFC, 0x14, + 0x00, 0x00, 0xF0, 0x10, 0xF0, + 0x10, 0x10, 0xFF, 0x10, 0xFF, + 0x14, 0x14, 0x14, 0xFF, 0x14, + 0x10, 0x10, 0x10, 0x1F, 0x00, + 0x00, 0x00, 0x00, 0xF0, 0x10, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xFF, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x38, 0x44, 0x44, 0x38, 0x44, + 0x7C, 0x2A, 0x2A, 0x3E, 0x14, + 0x7E, 0x02, 0x02, 0x06, 0x06, + 0x02, 0x7E, 0x02, 0x7E, 0x02, + 0x63, 0x55, 0x49, 0x41, 0x63, + 0x38, 0x44, 0x44, 0x3C, 0x04, + 0x40, 0x7E, 0x20, 0x1E, 0x20, + 0x06, 0x02, 0x7E, 0x02, 0x02, + 0x99, 0xA5, 0xE7, 0xA5, 0x99, + 0x1C, 0x2A, 0x49, 0x2A, 0x1C, + 0x4C, 0x72, 0x01, 0x72, 0x4C, + 0x30, 0x4A, 0x4D, 0x4D, 0x30, + 0x30, 0x48, 0x78, 0x48, 0x30, + 0xBC, 0x62, 0x5A, 0x46, 0x3D, + 0x3E, 0x49, 0x49, 0x49, 0x00, + 0x7E, 0x01, 0x01, 0x01, 0x7E, + 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, + 0x44, 0x44, 0x5F, 0x44, 0x44, + 0x40, 0x51, 0x4A, 0x44, 0x40, + 0x40, 0x44, 0x4A, 0x51, 0x40, + 0x00, 0x00, 0xFF, 0x01, 0x03, + 0xE0, 0x80, 0xFF, 0x00, 0x00, 0x08, 0x08, 0x6B, 0x6B, 0x08, - 0x36, 0x12, 0x36, 0x24, 0x36, - 0x06, 0x0F, 0x09, 0x0F, 0x06, - 0x00, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x10, 0x10, 0x00, - 0x30, 0x40, 0xFF, 0x01, 0x01, - 0x00, 0x1F, 0x01, 0x01, 0x1E, - 0x00, 0x19, 0x1D, 0x17, 0x12, - 0x00, 0x3C, 0x3C, 0x3C, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x12, 0x36, 0x24, 0x36, + 0x06, 0x0F, 0x09, 0x0F, 0x06, + 0x00, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x00, + 0x30, 0x40, 0xFF, 0x01, 0x01, + 0x00, 0x1F, 0x01, 0x01, 0x1E, + 0x00, 0x19, 0x1D, 0x17, 0x12, + 0x00, 0x3C, 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, }; #endif diff --git a/lib/USBDevice/USBDevice.cpp b/lib/USBDevice/USBDevice.cpp index 76be58a..6f042dc 100644 --- a/lib/USBDevice/USBDevice.cpp +++ b/lib/USBDevice/USBDevice.cpp @@ -193,17 +193,17 @@ bool USBDevice::controlOut(void) /* * We seem to have a pending device-to-host transfer. The host must have * sent a new control request without waiting for us to finish processing - * the previous one. This appears to happen when we're connected to certain + * the previous one. This appears to happen when we're connected to certain * USB 3.0 host chip set. Do a zeor-length send to tell the host we're not * ready for the new request - that'll make it resend - and then just * pretend we were successful here so that the pending transfer can finish. */ uint8_t buf[1] = { 0 }; EP0write(buf, 0); - + /* execute our pending ttransfer */ controlIn(); - + /* indicate success */ return true; #else @@ -740,7 +740,7 @@ void USBDevice::disconnect(void) { /* Disconnect device */ USBHAL::disconnect(); - + /* Set initial device state */ device.state = POWERED; device.configuration = 0; diff --git a/lib/USBDevice/USBHAL_STM32L1.cpp b/lib/USBDevice/USBHAL_STM32L1.cpp index 9edecbb..62e7b1b 100644 --- a/lib/USBDevice/USBHAL_STM32L1.cpp +++ b/lib/USBDevice/USBHAL_STM32L1.cpp @@ -33,7 +33,7 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { __HAL_SYSCFG_USBPULLUP_ENABLE(); } else { __HAL_SYSCFG_USBPULLUP_DISABLE(); - } + } } #elif defined(TARGET_STM32L0)||defined(TARGET_STM32F0) @@ -43,7 +43,7 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { SET_BIT(USB->BCDR, USB_BCDR_DPPU); // DP Pull-up } else { CLEAR_BIT(USB->BCDR, USB_BCDR_DPPU); - } + } } #elif defined(TARGET_STM32F3) @@ -112,9 +112,9 @@ public: PacketBufferAreaManager(int bufsize_):bufsize(bufsize_) { reset(); } - void reset() { - head = 0; - tail = bufsize; + void reset() { + head = 0; + tail = bufsize; } int allocBuf(int maxPacketSize) { head += 4; @@ -317,7 +317,7 @@ void USBHAL::DataInStageCallback(uint8_t epnum) { case 0: // EP0IN EP0in(); break; - case 1: + case 1: epComplete |= (1<PECR, FLASH_PECR_PELOCK)) { WRITE_REG(FLASH->PEKEYR, FLASH_PEKEY1); WRITE_REG(FLASH->PEKEYR, FLASH_PEKEY2); - } + } /* Unlocking the program memory access */ WRITE_REG(FLASH->PRGKEYR, FLASH_PRGKEY1); - WRITE_REG(FLASH->PRGKEYR, FLASH_PRGKEY2); + WRITE_REG(FLASH->PRGKEYR, FLASH_PRGKEY2); } else { // Error handler @@ -54,7 +54,7 @@ void flash_unlock(void) * (1) Perform the data write (32-bit word) at the desired address * (2) Wait until the BSY bit is reset in the FLASH_SR register * (3) Check the EOP flag in the FLASH_SR register - * (4) clear it by software by writing it at 1 + * (4) clear it by software by writing it at 1 */ void flash_program(uint32_t address, uint32_t data) { @@ -81,31 +81,31 @@ void write_status_reg(BootloaderStatus& status) // Make sure the status reg is halfword aligned // Check if this is really required. static_assert(sizeof(status) % 2 == 0); - + // Unlock the FLASH_PECR register access. // Then unlock the program memory access. - flash_unlock(); + flash_unlock(); - /* + /* * Erase a page in the Flash at BOOTLOADER_STATUS_STRUCT_ADDR - For STM32L073RZ - * (1) Set the ERASE and PROG bits in the FLASH_PECR register to enable page erasing - * (2) Write a 32-bit word value in an address of the selected page to start the erase sequence - * (3) Wait until the BSY bit is reset in the FLASH_SR register - * (4) Check the EOP flag in the FLASH_SR register - * (5) Clear EOP flag by software by writing EOP at 1 - * (6) Reset the ERASE and PROG bits in the FLASH_PECR register to disable the page erase - * Program and erase control register (FLASH_PECR) - This register can only be written after a + * (1) Set the ERASE and PROG bits in the FLASH_PECR register to enable page erasing + * (2) Write a 32-bit word value in an address of the selected page to start the erase sequence + * (3) Wait until the BSY bit is reset in the FLASH_SR register + * (4) Check the EOP flag in the FLASH_SR register + * (5) Clear EOP flag by software by writing EOP at 1 + * (6) Reset the ERASE and PROG bits in the FLASH_PECR register to disable the page erase + * Program and erase control register (FLASH_PECR) - This register can only be written after a * good write sequence done in FLASH_PEKEYR, resetting the PELOCK bit. */ FLASH->PECR |= FLASH_PECR_ERASE | FLASH_PECR_PROG; *(__IO uint32_t *)BOOTLOADER_STATUS_STRUCT_ADDR = (uint32_t)0; - + while ((FLASH->SR & FLASH_SR_BSY) != 0) { /* For robust implementation, add here time-out management */ } - if ((FLASH->SR & FLASH_SR_EOP) != 0) { + if ((FLASH->SR & FLASH_SR_EOP) != 0) { FLASH->SR = FLASH_SR_EOP; } else { @@ -123,17 +123,17 @@ void write_status_reg(BootloaderStatus& status) * (6) Reset the PROG and FPRG bits to disable programming */ uint32_t *data = (uint32_t *)&status; - uint32_t address = BOOTLOADER_STATUS_STRUCT_ADDR; + uint32_t address = BOOTLOADER_STATUS_STRUCT_ADDR; for (unsigned int i = 0; i < sizeof(status) / sizeof(uint32_t); i++) { - flash_program(address, *data); + flash_program(address, *data); data++; address += 4; - } + } // Locking FLASH_PECR register again - // Set the PRGLOCK Bit to lock the FLASH Registers access - SET_BIT(FLASH->PECR, FLASH_PECR_PRGLOCK); + // Set the PRGLOCK Bit to lock the FLASH Registers access + SET_BIT(FLASH->PECR, FLASH_PECR_PRGLOCK); } // Called from main diff --git a/src/bl_support.h b/src/bl_support.h index 0abe9fc..90cb377 100644 --- a/src/bl_support.h +++ b/src/bl_support.h @@ -1,10 +1,10 @@ /* * Scene Connect Bootloader - * Copyright (C) 2019 Scene Connect + * Copyright (C) 2019 Scene Connect * https://www.scene.community/ * * This code is developed based on the Okra Bootloader from Okra Solar. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to @@ -41,14 +41,14 @@ const uint8_t BOOTLADER_NAME_LENGTH = 18; * Flash address for the bootloader status structure. * This address must be aligned to a flash page. Each time a new application * is detected by the bootloader (BootloaderState::newApp), - * the full page is erased, and the updated struct is written to the address + * the full page is erased, and the updated struct is written to the address */ const uint32_t BOOTLOADER_STATUS_STRUCT_ADDR = 0x0802FF80; // The last flash page /** * Bootloader state enumeration. This state needs to be set to "newApp" * by the application after an update, and to "stableApp" after the - * first successful boot + * first successful boot */ enum BootloaderState { NO_STATE = 0, ///< State not properly initialized @@ -57,22 +57,22 @@ enum BootloaderState { STABLE_APP, ///< Set by App after sucessful boot of the new app }; -/** +/** * Bootloader status struct. This struct's status field should be updated * in flash by the app after first boot (stableApp) or after an update of the - * other firmware binary (newApp) + * other firmware binary (newApp) */ struct BootloaderStatus { char bootloader_name[BOOTLADER_NAME_LENGTH]; uint32_t bootloader_version; uint32_t status; ///< Update this field and write to flash in your app! - uint32_t live_app_select; + uint32_t live_app_select; uint32_t retry_count; }; /** * Write the bootloader status to the flash address 'BOOTLOADER_STATUS_STRUCT_ADDR'. - * + * * @param status: The struct containing the bootloader status information. */ void write_status_reg(BootloaderStatus &status); @@ -87,8 +87,8 @@ void flash_unlock(void); * (1) Perform the data write (32-bit word) at the desired address * (2) Wait until the BSY bit is reset in the FLASH_SR register * (3) Check the EOP flag in the FLASH_SR register - * (4) clear it by software by writing it at 1 - * + * (4) clear it by software by writing it at 1 + * * @param address The flash address to write to. * @param data The data to write to the flash. */ diff --git a/src/eeprom.cpp b/src/eeprom.cpp index bf3f1ef..b4b3e42 100644 --- a/src/eeprom.cpp +++ b/src/eeprom.cpp @@ -45,7 +45,7 @@ const uint16_t eeprom_data_objects[] = { #ifndef UNIT_TEST -uint32_t _calc_crc(uint8_t *buf, size_t len) +uint32_t _calc_crc(const uint8_t *buf, size_t len) { RCC->AHBENR |= RCC_AHBENR_CRCEN; @@ -134,9 +134,9 @@ int eeprom_read (unsigned int addr, uint8_t* ret, int len) int err = 0; if (EEPROM_ADDRESS_SIZE == 1) { - // write the address we want to read + // write the address we want to read buf[0] = addr & 0xFF; - // send memory address without stop (repeated = true) + // send memory address without stop (repeated = true) err = i2c_eeprom.write(device, (char*)buf, 1, true); } else { @@ -156,7 +156,7 @@ int eeprom_read (unsigned int addr, uint8_t* ret, int len) #elif defined(STM32L0) // internal EEPROM -int eeprom_write (unsigned int addr, uint8_t* data, int len) +int eeprom_write (unsigned int addr, const uint8_t* data, int len) { int timeout = 0; @@ -171,8 +171,9 @@ int eeprom_write (unsigned int addr, uint8_t* data, int len) FLASH->PEKEYR = FLASH_PEKEY2; } - if (addr + len > DATA_EEPROM_BANK1_END - DATA_EEPROM_BASE) + if (addr + len > DATA_EEPROM_BANK1_END - DATA_EEPROM_BASE) { return -1; + } // write data byte-wise to EEPROM for (int i = 0; i < len; i++) { @@ -191,8 +192,9 @@ int eeprom_write (unsigned int addr, uint8_t* data, int len) int eeprom_read (unsigned int addr, uint8_t* ret, int len) { - if (addr + len > DATA_EEPROM_BANK1_END - DATA_EEPROM_BASE) + if (addr + len > DATA_EEPROM_BANK1_END - DATA_EEPROM_BASE) { return -1; + } memcpy(ret, ((uint8_t*)addr) + DATA_EEPROM_BASE, len); return 0; diff --git a/src/eeprom.h b/src/eeprom.h index 3434499..f89ebfb 100644 --- a/src/eeprom.h +++ b/src/eeprom.h @@ -26,13 +26,13 @@ * * @returns 0 for success */ -int eeprom_write(unsigned int addr, uint8_t* data, int len); +int eeprom_write(unsigned int addr, const uint8_t* data, int len); /** Read data from EEPROM address * * @returns 0 for success */ -int eeprom_read(unsigned int addr, uint8_t* ret, int len); +int eeprom_read(unsigned int addr, const uint8_t* ret, int len); /** Store current charge controller data to EEPROM */ diff --git a/src/half_bridge_tim.cpp b/src/half_bridge.cpp similarity index 97% rename from src/half_bridge_tim.cpp rename to src/half_bridge.cpp index 20e628c..b4b3bc1 100644 --- a/src/half_bridge_tim.cpp +++ b/src/half_bridge.cpp @@ -135,7 +135,7 @@ class PWM_TIM1 GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER8)) | GPIO_MODER_MODER8_1; GPIOB->MODER = (GPIOB->MODER & ~(GPIO_MODER_MODER13)) | GPIO_MODER_MODER13_1; - + // Select AF2 on PA8 (TIM1_CH1) and PB13 (TIM1_CH1N) GPIOA->AFR[1] |= 0x2 << GPIO_AFRH_AFSEL8_Pos; GPIOB->AFR[1] |= 0x2 << GPIO_AFRH_AFSEL13_Pos; @@ -263,12 +263,12 @@ void half_bridge_init(int freq_kHz, int deadtime_ns, float min_duty, float max_d { // timers are counting at system clock // we are using a mode which counts up and down in each period - // so we need half the impluses as resolution for the given frequency. - _pwm_resolution = SystemCoreClock / (freq_kHz * 1000) / 2; - + // so we need half the impluses as resolution for the given frequency. + _pwm_resolution = SystemCoreClock / (freq_kHz * 1000) / 2; + // (clocks per ms * deadtime in ns) / 1000 == (clocks per ms * deadtime in ms) - // although the C operator precedence does the "right thing" to allow deadtime_ns < 1000 to - // be handled nicely, parentheses make this more explicit + // although the C operator precedence does the "right thing" to allow deadtime_ns < 1000 to + // be handled nicely, parentheses make this more explicit _deadtime_clocks = ((SystemCoreClock / (1000000)) * deadtime_ns) / 1000; PWM_TIM_HW::_init_registers(_pwm_resolution); @@ -329,4 +329,3 @@ bool half_bridge_enabled() { return _enabled; } - diff --git a/src/thingset_serial.cpp b/src/thingset_serial.cpp index 3f44b03..a6193e4 100644 --- a/src/thingset_serial.cpp +++ b/src/thingset_serial.cpp @@ -78,7 +78,7 @@ void ThingSetStream::process_input() // backspace // can be done always unless there is nothing in the buffer - else if (req_pos > 0 && c == '\b') { + else if (req_pos > 0 && c == '\b') { req_pos--; } // we fill the buffer up to all but 1 character diff --git a/src/uext.cpp b/src/uext.cpp index f650dd1..8022a7f 100644 --- a/src/uext.cpp +++ b/src/uext.cpp @@ -65,4 +65,3 @@ UExtInterface::UExtInterface() { } UExtInterfaceManager uext; - diff --git a/src/uext.h b/src/uext.h index e46523e..8a804a1 100644 --- a/src/uext.h +++ b/src/uext.h @@ -60,7 +60,7 @@ class UExtInterfaceManager /** * Adds an UExtInterface object to the list of managed extensions, - * automatically called by UExtInterface objects during construction + * automatically called by UExtInterface objects during construction */ static void add_ext(UExtInterface*); @@ -72,8 +72,8 @@ class UExtInterfaceManager */ static std::vector* interfaces; - /** - * Makes sure there is an internal interfacts vector created, does nothing if it exists + /** + * Makes sure there is an internal interfacts vector created, does nothing if it exists */ static void check_list(); }; diff --git a/test/adc_dma_stub.h b/test/adc_dma_stub.h index 4ab9106..c34e2c9 100644 --- a/test/adc_dma_stub.h +++ b/test/adc_dma_stub.h @@ -36,4 +36,4 @@ void clear_adc_filtered(); uint32_t get_adc_filtered(uint32_t channel); uint16_t adc_get_alert_limit(float scale, float limit); -#endif \ No newline at end of file +#endif diff --git a/test/main.cpp b/test/main.cpp index f754c7b..1bf8a3a 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -64,4 +64,4 @@ int main() dcdc_tests(); device_status_tests(); load_tests(); -} \ No newline at end of file +} diff --git a/test/tests_bat_charger.cpp b/test/tests_bat_charger.cpp index cc0b092..e3eb605 100644 --- a/test/tests_bat_charger.cpp +++ b/test/tests_bat_charger.cpp @@ -321,4 +321,4 @@ void bat_charger_tests() //RUN_TEST(no_soc_below_0); UNITY_END(); -} \ No newline at end of file +} diff --git a/test/tests_dcdc.cpp b/test/tests_dcdc.cpp index dc7e1a1..7d2dc63 100644 --- a/test/tests_dcdc.cpp +++ b/test/tests_dcdc.cpp @@ -438,4 +438,4 @@ void dcdc_tests() RUN_TEST(boost_correct_mppt_operation); UNITY_END(); -} \ No newline at end of file +} diff --git a/test/tests_half_bridge.cpp b/test/tests_half_bridge.cpp index 7e4541e..3cc74f7 100644 --- a/test/tests_half_bridge.cpp +++ b/test/tests_half_bridge.cpp @@ -12,7 +12,7 @@ #define PWM_F_KHZ 70 #define PWM_DEADTIME_NS 300 -const float duty_epsilon = 0.006; +const float duty_epsilon = 0.006; // calculated duty cycle float may deviate +/- duty_epsilon from test target value static void init_structs() @@ -21,7 +21,6 @@ static void init_structs() half_bridge_stop(); } - void half_brigde_set_duty_cycle_works() { half_bridge_set_duty_cycle(MID_PWM_DUTY); @@ -48,14 +47,12 @@ void half_brigde_not_exceeds_max() TEST_ASSERT_FLOAT_WITHIN(duty_epsilon,MAX_PWM_DUTY,half_bridge_get_duty_cycle()); } - void half_brigde_not_exceeds_min() { half_bridge_set_duty_cycle(-1.0); TEST_ASSERT_FLOAT_WITHIN(duty_epsilon,MIN_PWM_DUTY,half_bridge_get_duty_cycle()); } - void half_brigde_tests() { init_structs(); @@ -69,4 +66,4 @@ void half_brigde_tests() RUN_TEST(half_brigde_not_steps_under_min); UNITY_END(); -} \ No newline at end of file +} diff --git a/test/tests_power_port.cpp b/test/tests_power_port.cpp index d3949f2..ffd8b97 100644 --- a/test/tests_power_port.cpp +++ b/test/tests_power_port.cpp @@ -130,4 +130,4 @@ void power_port_tests() RUN_TEST(pass_voltage_targets_to_adjacent_bus); UNITY_END(); -} \ No newline at end of file +}