Trailing white spaces removed

This commit is contained in:
Martin Jaeger
2019-11-21 07:44:15 +01:00
parent 7952ac99b0
commit 74b765e801
26 changed files with 391 additions and 396 deletions
+4 -4
View File
@@ -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/)
+29 -29
View File
@@ -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<y)
{
if (f >= 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<y)
{
if (f >= 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<y)
{
if (f >= 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<x+w; i++)
drawFastVLine(i, y, h, color);
drawFastVLine(i, y, h, color);
}
#endif
@@ -249,7 +249,7 @@ void Adafruit_GFX::fillRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int
{
// smarter version
fillRect(x+r, y, w-2*r, h, color);
// draw four corners
fillCircleHelper(x+w-r-1, y+r, r, 1, h-2*r-1, color);
fillCircleHelper(x+r , y+r, r, 2, h-2*r-1, color);
@@ -267,7 +267,7 @@ void Adafruit_GFX::drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
void Adafruit_GFX::fillTriangle ( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
{
int16_t a, b, y, last;
// Sort coordinates by Y order (y2 >= 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)
+10 -10
View File
@@ -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
*/
+9 -9
View File
@@ -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<q; i+=16 )
for(uint16_t i=0, q=buffer.size(); i<q; i+=16 )
{ uint8_t x ;
// TODO - this will segfault if buffer.size() % 16 != 0
for(x=1; x<sizeof(buff); x++)
for(x=1; x<sizeof(buff); x++)
buff[x] = buffer[i+x-1];
mi2c.write(mi2cAddress, buff, sizeof(buff));
}
+259 -259
View File
@@ -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
*********************************************************************/
@@ -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
+4 -4
View File
@@ -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;
+7 -7
View File
@@ -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<<EP1IN);
if (EP1_IN_callback()) {
epComplete &= ~(1<<EP1IN);
@@ -329,7 +329,7 @@ void USBHAL::DataInStageCallback(uint8_t epnum) {
epComplete &= ~(1<<EP2IN);
}
break;
case 3:
case 3:
epComplete |= (1<<EP3IN);
if (EP3_IN_callback()) {
epComplete &= ~(1<<EP3IN);
-1
View File
@@ -146,4 +146,3 @@ USB_OTG_CORE_REGS;
#endif //__USB_OTG_REGS_H__
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+8 -8
View File
@@ -83,7 +83,7 @@ bool USBMIDI::EPBULK_OUT_callback() {
readEP(EPBULK_OUT, buf, &len, 64);
if (midi_evt != NULL) {
for (uint32_t i=0; i<len; i+=4) {
for (uint32_t i=0; i<len; i+=4) {
uint8_t data_read;
data_end=true;
switch(buf[i]) {
@@ -111,25 +111,25 @@ bool USBMIDI::EPBULK_OUT_callback() {
case 0xD:
// Channel pressure
data_read=2;
break;
break;
case 0xF:
// Single byte
data_read=1;
break;
break;
default:
// Others three-bytes messages
data_read=3;
break;
}
break;
}
for(uint8_t j=1;j<data_read+1;j++) {
data[cur_data]=buf[i+j];
cur_data++;
}
if(data_end) {
midi_evt(MIDIMessage(data,cur_data));
cur_data=0;
cur_data=0;
}
}
}
+1 -1
View File
@@ -105,7 +105,7 @@ private:
uint8_t data[MAX_MIDI_MESSAGE_SIZE+1];
uint8_t cur_data;
bool data_end;
void (*midi_evt)(MIDIMessage);
};
-1
View File
@@ -35,4 +35,3 @@ include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/latest/projectconf.html#lib-install
+1 -1
View File
@@ -6,7 +6,7 @@
# We are setting the required linker flags for use of newlib-nano
Import("env")
Import("env")
env.Append(
LINKFLAGS=[
+22 -22
View File
@@ -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
@@ -39,10 +39,10 @@ void flash_unlock(void)
if (HAL_IS_BIT_SET(FLASH->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
+10 -10
View File
@@ -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.
*/
+8 -6
View File
@@ -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;
+2 -2
View File
@@ -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
*/
@@ -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;
}
+1 -1
View File
@@ -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
-1
View File
@@ -65,4 +65,3 @@ UExtInterface::UExtInterface() {
}
UExtInterfaceManager uext;
+3 -3
View File
@@ -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<UExtInterface*>* 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();
};
+1 -1
View File
@@ -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
#endif
+1 -1
View File
@@ -64,4 +64,4 @@ int main()
dcdc_tests();
device_status_tests();
load_tests();
}
}
+1 -1
View File
@@ -321,4 +321,4 @@ void bat_charger_tests()
//RUN_TEST(no_soc_below_0);
UNITY_END();
}
}
+1 -1
View File
@@ -438,4 +438,4 @@ void dcdc_tests()
RUN_TEST(boost_correct_mppt_operation);
UNITY_END();
}
}
+2 -5
View File
@@ -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();
}
}
+1 -1
View File
@@ -130,4 +130,4 @@ void power_port_tests()
RUN_TEST(pass_voltage_targets_to_adjacent_bus);
UNITY_END();
}
}