Date   

Re: Morse Code Tutor

Ken KM4NFQ <km4nfq@...>
 

Greetings,

Bruce Hall, W8BH created his own version of a Morse Code Tutor.
His source code is fully documented in a series of PDF tutorials.
http://w8bh.net/MorseTutor1.pdf
http://w8bh.net/MorseTutor2.pdf
http://w8bh.net/MorseTutor3.pdf
http://w8bh.net/MorseTutor4.pdf
http://w8bh.net/MorseTutor5.pdf
http://w8bh.net/MorseTutor6.pdf
http://w8bh.net/MorseTutor7.pdf
http://w8bh.net/MorseTutor8.pdf
This is an excellent series of tutorials! Highly recommended!
The source code for a Morse Tutor is fully explained in the tutorial.
All of the source code explained in the tutorial is available at:
https://github.com/bhall66

However, the tutorial PDFs are not an assembly manual for the circuit.
But all the pin assignments in the source code are for the Blue Pill
development board.

When I studied W8BH's Morse Tutor Tutorial,
I changed the pin assignments to a Mega2560 Pro Mini.
The Mega2560 Pro Mini has enough space, and is plenty fast enough.

Furthermore, the Mega2560 is native to the Arduino IDE.
All I had to do was choose (from the Tools drop-down menu in the Arduino IDE):
Board: "Arduino/Genuino Mega or Mega2560"
Processor: "ATmega2560 (Mega 2560)"
Port: whatever serial port your system uses
There is no need to install any external tool chain, or odd board
description to get it to work.

The ONLY logic difference between the boards is that the LED pin on
the Blue Pill is inverse.
So a "0" is HIGH, and a "1" is LOW. So I made these changes for the Mega2560:
digitalWrite(LED,1); // CHG turn on LED
digitalWrite(LED,0); // CHG turn off LED

Besides that, these are the pin assignments I changed:
#define TFT_DC 48 // CHG LCD "DC" pin
#define TFT_CS 47 // CHG LCD "CS" pin
#define TFT_RST 44 // CHG LCD "RST pin
#define SD_CS 53 // CHG SD card "CS" pin
#define ENCODER_A 2 // CHG Rotary Encoder output A
#define ENCODER_B 3 // CHG Rotary Encoder output B
#define ENCODER_BUTTON 18 // CHG Rotary Encoder switch
#define LED 13 // CHG onboard LED pin
#define PADDLE_A 33 // CHG Morse Paddle "dit"
#define PADDLE_B 35 // CHG Morse Paddle "dah"
#define PIEZO 26 // CHG pin attached to piezo element

I added the letters "CHG" to each line in the code that I modified.
"CHG" was the pattern I used to 'grep' the changes that I made.
[For Unix Geeks: $ cat part8.ino | grep CHG > chg.txt ]

Part 8 of Bruce's tutorial deals with adding an SD Card to the back of the TFT.
I do not have an SD card at this time, so I have not put one in.
However, I did compile and upload the Part 8 source code to the
Mega2560 Pro Mini.
The code compiled cleanly with no error messages (using the above pin
assignments):

Sketch uses 31016 bytes (12%) of program storage space. Maximum is 253952 bytes.
Global variables use 2786 bytes (34%) of dynamic memory. leaving 5406 bytes
for local variables. Maximum is 8192 bytes.

When I get an SD card, I will be able to test that feature.

Overall, the W8BH Morse Tutor Tutorial is excellent! Highly recommended!
If you want to learn more about programming, and about how a Morse
tutor works, study it!
The tutorial is in plain English, and very easy to read and
understand. Kudos to W8BH !!!

Regards,
Ken, KM4NFQ "Not Fully Qualified"

P.S. I have also put together a Morse Code Tutor using a Blue Pill
development board.
I am planning to upload the W8BH Morse Tutor Tutorial code to that circuit.
So I will be reading and studying the W8BH Morse Tutor Tutorial at
least one more time.
I am looking forward to it. ~Ken


Re: Blue Pill - STM32F103 - Programmers and Boot Loaders #bluepill #stm32 #arm #morsecodetutor

Tom, wb6b
 

On Tue, Jul 9, 2019 at 07:24 AM, David Leckie wrote:
I was not sure which one to use so I entered both that have been suggested.
Interesting: There seems to be yet another STM32 toolchain to choose from.

I'm not sure, but from a spot check of a couple of libraries, it looks like the dan.drown.org version may be a older frozen-in-time snapshot of the state of the Roger Clark toolchain and other libraries like the Adafruit libraries from 2016. While, technically, it would be best to use the latest Roger Clark toolchain and the latest libraries from Adafruit and others, if this has been a popular toolchain for many developers, I may install it just to teleport back to 2016 when some other applications I'm trying out were probably last updated themselves. I'll want to be sure that the libraries that dan.drown.org package installs do not overwrite the newer versions of the libraries I've installed from the "Library Manager" and that if using the dan.drown.org toolchain, it selects its older libraries in preference to the newer ones. I'd prefer to use the up-to-date Roger Brown toolchain on projects that are OK with the newer libraries, and hopefully the dan.drown.org toolchain will not disrupt the newer toolchain and libraries. 

I'll investigate this further.

Tom, wb6b


Re: Morse Code Tutor

Tom, wb6b
 

On Tue, Jul 9, 2019 at 07:09 PM, jjpurdum wrote:
I also covered the use of a sentinel
I like the preceding sentinel, pack to the right, idea. Great way to store variable length data in fixed length storage, without resorting to bit/byte count headers for the data or a special value that can't be allowed to exist in the main data. Many places beside Morse Code where that can be used where there are not vast differences in the lengths of the variable length data. 

Tom, wb6b


Re: Morse Code Tutor

Tom, wb6b
 

On Tue, Jul 9, 2019 at 07:09 PM, jjpurdum wrote:
Once you understand this code, the rest of the code is pretty simple
That is one of the beauties of the Arduino platform. They have abstracted most of the I/O, like the wiring library (example: "pinMode(pin, mode)", "digitalWrite(pin, value)"), so functionally looks the same to your program even with very different processors. Also library producers like Adafruit put a lot of effort into making their libraries selectively compile different pieces of internal code for different processors and present the library functions to you in a way that it all looks the same. (Good reason to buy an Adafruit board, at least once in a while.)

Sometimes there are annoying differences that can cause some pain in the porting, but nowhere near other, often times considered more professional, development platforms. 

I have run across a few cases where the "equivalent" library for one processor is not completely the same for another processor. Such as different constructor parameters or un-implemented functions. Or one library relying on another library that has been revised in a non-compatible way. The SPI libraries have some annoying differences, also. These libraries are more hardware dependent than most others, so this in not entirely surprising. 

In a current example the Adafruit GFX library enhanced a block size setting from an implied square, to expanding it to having both x and y dimensions (and dropping the singular size setting (Implemented as a define so a choice had to be made in going forward)), while the application I'm porting was not updated to handle that. Of course that gives me a chance to do the patch and submit it to the original application/library owner.

Sometimes with the popular AVR/ARM/ESP32 triad the libraries will work with two but not all three processor families. But with the Arduino platform, bringing harmony to multiple processor families is doable. And the closer you stick to Arduino official libraries or libraries by well established authors, the less of these little annoyances you have to deal with. But not always :) 

It's great that PC boards will be available for your projects. That will be a great time saver, especially on more complicated projects. Looking forward to trying out more of your projects when the book comes out. 

Tom, wb6b


Re: Morse Code Tutor

jjpurdum
 

Tom:

At this juncture, all of the projects except one, will have a PCB available at reasonable cost from QRP Guys so the projects should be pretty easy to build. The project that doesn't have a PCB is the small dummy load:
Inline image
The project is so simple a PCB is not warranted. It small enough to backpack, but can handle up to 50W for short periods of time.

Porting the MCT code to another processor should be pretty simple. In my FDIM talk, I did cover the trickiest part of the code, and that was the binary search routine the code uses to translate from Morse to ASCII. This is the graphical representation of the binary search routine:

Inline image

I also covered the use of a sentinel to convert from ASCII to Morse. The coded array looks like this:

char letterTable[] = {// Morse coding: dit = 0, dah = 1
  0b101,              // A     first 1 is the sentinel marker
  0b11000,            // B
  0b11010,            // C
  0b1100,             // D

The first binary 1 is the sentinel and the Morse is derived after it:

    0b101            // A   (the sentinel bit)
    0b01              // After removing the sentinel bit
    dit-dah           // after decoding

The function to do this is here:

/*****
  Purpose: to send a Morse code character

  Paramter list:
  char code       the code for the letter to send

  Return value:
  void
*****/
void SendCode(char code)
{
  int i;

  for (i = 7; i >= 0; i--)        // Start with MSB and find sentinel
    if (code & (1 << i))          // Found it!
      break;

  for (i--; i >= 0; i--) {        // Throw the sentinel away (hence th i--)
    if (code & (1 << i))          // If it's a binary 1, do a dah
      dah();
    else                          // binary 0, do a dit
      dit();
  }
  LetterSpace();
}


Once you understand this code, the rest of the code is pretty simple. Moving to another processor probably won't require any changes to the code, only the pin assignments.

Jack, W8TEE

On Tuesday, July 9, 2019, 9:36:05 PM EDT, Tom, wb6b <wb6b@...> wrote:


On Tue, Jul 9, 2019 at 11:31 AM, Ken KM4NFQ wrote:
'ported' the code to a Mega2560 Pro Mini.
Congratulations on successfully porting the Morse Code Tutor to another processor. It is a great learning experience. And great for people who may have a Mega2560 board around, but not have delved into the Blue Pill yet.

I'm sure when Jack releases the project in his book everything will be fully explained in the instructions, any code kinks straightened out and easier to build. But, I'm glad he released what he did early, so we experimenter types could play with the Code Tutor now. 

Tom, wb6b


Re: Morse Code Tutor

Tom, wb6b
 

On Tue, Jul 9, 2019 at 11:31 AM, Ken KM4NFQ wrote:
'ported' the code to a Mega2560 Pro Mini.
Congratulations on successfully porting the Morse Code Tutor to another processor. It is a great learning experience. And great for people who may have a Mega2560 board around, but not have delved into the Blue Pill yet.

I'm sure when Jack releases the project in his book everything will be fully explained in the instructions, any code kinks straightened out and easier to build. But, I'm glad he released what he did early, so we experimenter types could play with the Code Tutor now. 

Tom, wb6b


Re: suggestion if you are struggling with the STM32 board #morsecodetutor #mct

Tom, wb6b
 

Hi,

I should set up another sandbox Linux VM on my Mac so I can look into this issues first hand. But, just a couple of thoughts in case they help. 

I have both the "official" STM32 Arduino toolchain and the Roger Clark toolchain installed. If you also have both tool chains installed, double check that you are selecting the Blue Pill from the "STM32F1 Boards (STM32duino.com)" menu and select Generic STM32F103C. 

It looks like the Roger Clark toolchain uses the Maple boards as the core and will look in the Maple libraries for what it it did not find specific to the the selected board. 

I added this to my alternate libraries in the Arduino preferences to install the "official" toolchain from the board manager.
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

I installed the Roger Clark toolchain from the instructions on his GitHub site. 
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki

Yes, if you are using the board selected from the Roger Clark toolchain and you have tried changing the case of the Tone.h/tone.h, them maybe you have an extra tone library that you may want to temporally remove or rename it to a bogus name to see if the Arduino toolchain is finding the wrong library.

Often the Arduino IDE will find multiple libraries of the same name and magically make a correct choice of which one to use. But, may not always be so lucky.

I have not tried the "dan.drown.org" toolchain. Looks like it is a prepackaged zip file of another toolchain. Don't know if it is kept up to date or not with the primary toolchain it is based on. May look at that toolchain at a later time.

Tom, wb6b


Re: Morse Code Tutor

Ken KM4NFQ <km4nfq@...>
 

On Sun, Jun 30, 2019 at 10:42 PM Bruce Hall <bhall66@...> wrote:

I created my own version of Jack's excellent Morse Code Tutor.
There is a full description and tutorial at: http://w8bh.net/MorseTutor1.pdf
Bruce
Greetings,
I just finished Part 7 of Bruce Hall, W8BH's Morse Tutor Tutorial.
Instead of using a Blue Pill, I 'ported' the code to a Mega2560 Pro Mini.
There is a short clip of the Mega2560 Pro Mini Morse Tutor at the YouTube:
https://www.youtube.com/watch?v=Q6um4Y20sZs

I can highly recommend Bruce Hall W8BH's Morse Tutor Tutorial !!!
Ken, KM4NFQ "Not Fully Qualified"


Re: suggestion if you are struggling with the STM32 board #morsecodetutor #mct

David Leckie
 

Hi

 

Bit confused with tone libraries.

I can get it to compile OK but I want to understand what I am doing.

 

I am aware that Tone.h and tone.h are regarded as different files under Linux but the same under Windows.  (I am using Linux)

 

Normally on AVR boards you would use.

#include <Tone.h> this is for the ToneLibrary 1.7.1 by Brett Hagman.

 

This is for AVR architecture and not applicable and will not compile on STM32 architecture.

 

tone.h will be a different library and there is not one for AVR

 

Now if I look in

https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/STM32F1/libraries

 

There is no tone library.

 

However there is

 

https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/cores/maple/tone.h

 

 

So when I have a line #include <tone.h> where is the Arduino IDE finding the library?

 

If I look in

 

https://github.com/stm32duino/Arduino_Core_STM32/tree/master/cores/arduino

 

There is a Tone.h

 

Currently in preference→Additional Board managers I have 2 URLS

 

http://dan.drown.org/stm32duino/package_STM32duino_index.json

 

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json



When I compile it first looks in the local Arduino libraries and finds Tone.h which is for AVR and gives an error message.

 

However if I use tone.h there is no such library on the local machine so it gets the one from the Additional Boards manager URL.

 

Would I be better removing the AVR Tone library (Tone.h) and installing a STM32 Tone library or a STM32 tone  library?

Any advice would be most welcome. 
73
Dave
GM4NFI


Re: Blue Pill - STM32F103 - Programmers and Boot Loaders #BluePill #STM32 #ARM #MorseCodeTutor OPPS #bluepill #stm32 #arm #morsecodetutor

jjpurdum
 

Disregard!

I was working on the ESP32 this morning and had that chip in my mind...

Jack, W8TEE

On Tuesday, July 9, 2019, 10:33:21 AM EDT, jjpurdum via Groups.Io <jjpurdum@...> wrote:


Try this:

place a 10µF electrolytic cap between the EN pin and GND.

Jack, W8TEE

On Tuesday, July 9, 2019, 10:24:35 AM EDT, David Leckie <djcleckie@...> wrote:


OK all now fine regarding uploading.
I have a dual boot system running Win 10 and Ubuntu Linux 19.04. 
Blink now uploading and running on the STM32F103C8T6 board under both OS's same code base.
My earlier mistakes were:-
Not pressing the button before each upload. I thought I had only to press it once.
Upload method is Serial which is not the default.
File->Preferences->Additional Board Managers.
I was not sure which one to use so I entered both that have been suggested.
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

http://dan.drown.org/stm32duino/package_STM32duino_index.json

Anyway tnx for all the help.  Its a great group

73
Dave
GM4NFI


Re: Blue Pill - STM32F103 - Programmers and Boot Loaders #bluepill #stm32 #arm #morsecodetutor

jjpurdum
 

Try this:

place a 10µF electrolytic cap between the EN pin and GND.

Jack, W8TEE

On Tuesday, July 9, 2019, 10:24:35 AM EDT, David Leckie <djcleckie@...> wrote:


OK all now fine regarding uploading.
I have a dual boot system running Win 10 and Ubuntu Linux 19.04. 
Blink now uploading and running on the STM32F103C8T6 board under both OS's same code base.
My earlier mistakes were:-
Not pressing the button before each upload. I thought I had only to press it once.
Upload method is Serial which is not the default.
File->Preferences->Additional Board Managers.
I was not sure which one to use so I entered both that have been suggested.
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

http://dan.drown.org/stm32duino/package_STM32duino_index.json

Anyway tnx for all the help.  Its a great group

73
Dave
GM4NFI


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

bobolink <rwhinric@...>
 

Esp32 Ultra Low Power (ULP) core made easy (Arduino IDE)
YouTube


Re: Blue Pill - STM32F103 - Programmers and Boot Loaders #bluepill #stm32 #arm #morsecodetutor

David Leckie
 

OK all now fine regarding uploading.
I have a dual boot system running Win 10 and Ubuntu Linux 19.04. 
Blink now uploading and running on the STM32F103C8T6 board under both OS's same code base.
My earlier mistakes were:-
Not pressing the button before each upload. I thought I had only to press it once.
Upload method is Serial which is not the default.
File->Preferences->Additional Board Managers.
I was not sure which one to use so I entered both that have been suggested.
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

http://dan.drown.org/stm32duino/package_STM32duino_index.json

Anyway tnx for all the help.  Its a great group

73
Dave
GM4NFI


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

Daniel Lavin <dan_ll@...>
 

I have found the ESP32 ADC to be so nonlinear and noisy as to be essentially useless.  Even the spec sheet notes a +/-6% unit to unit variation in ADC results before calibration.  If your project depends on an ADC, consider another chip or an external ADC.

On 7/9/2019 9:17 AM, jjpurdum via Groups.Io wrote:

Bob:

Actually, I started the Morse Code Tutor several years ago, but went back to it and modified it for the STM32 for the FDIM talk. I made that swtich not so much for the performance aspects of the STM32 (Blue Pill), but for its additional SRAM space compared to the Nano (i.e., 10x) Since then, I've been playing with the ESP32 myself and really like it. In fact, Al (AC8GY) and I liked it enough that we went back in the chapters of the new Projects book and added it and we're using it in several projects. For those who are not familiar with the various microcontroller, this table from the book shows the important differences:

Resource

Arduino Nano

Teensy 3.6

Blue Pill

ESP32 WROOM 32

Processor bits

8

32

32

32

Flash1

32K

1Mb

64K - 128K

1.3Mb5

SRAM

2K

256K

20K

380Kb5

EEPROM

1K

4K2,3

?3

?3

Processor Clock speed

16MHz

180MHz4

72MHz

240MHz

I/O pins

14

58

26

25

Interrupts

All 14 mappable, 2 external

All 58 mappable

All 26 mappable

All 25 mappable

Timers

3 (2 8-bit, 1 16-bit)

19

7

4

SPI

1

1

1

2

I2C

1

4

1

2

DAC resolution (bits)

10

12

12

12

Analog pins

8

25

5

15

Price

$3

$30

$3

$10


The ESP32 also has WiFi and Bluetooth build into it and is based on a dual core architecture. True, it costs a little more, but this thing can really boot-scoot along at 15x that of a Nano. It is overkill for projects that are not processor-intensive or involve a lot of human I/O, but it's programmable in the Arduino IDE so you can leverage everything you already know without messing with another tool chain. I just wish we had "discovered" it earlier...

Jack, W8TEE

On Tuesday, July 9, 2019, 7:24:17 AM EDT, bobolink <rwhinric@...> wrote:


Tom,
Don't know if you are still in the STM32 family or porting to another processor altogether.
Another processor altogether. ESP32. Which is kind of a waste as I’m not using the onboard radios at all. All I really expect to salvage is Jack’s “game logic” and expertise in Morse code teaching methods.

Bob

Virus-free. www.avg.com


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

jjpurdum
 

I did not know that. I've only read articles on creating two threads, so assumed that was it.

Jack, W8TEE

On Tuesday, July 9, 2019, 9:54:39 AM EDT, bobolink <rwhinric@...> wrote:


Thanks Jack. I’m printing out that chart now.

The floating point performance of the esp32 is, according to this guy, not too great. Even though they have FP in hardware.
But it is my goto processor these days.
Did you know it has a third processor core just for extreme low power?
It’s the Swiss Army knife.

bob
wm6h 


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

bobolink <rwhinric@...>
 

Thanks Jack. I’m printing out that chart now.

The floating point performance of the esp32 is, according to this guy, not too great. Even though they have FP in hardware.
But it is my goto processor these days.
Did you know it has a third processor core just for extreme low power?
It’s the Swiss Army knife.

bob
wm6h 


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

jjpurdum
 

Bob:

Actually, I started the Morse Code Tutor several years ago, but went back to it and modified it for the STM32 for the FDIM talk. I made that swtich not so much for the performance aspects of the STM32 (Blue Pill), but for its additional SRAM space compared to the Nano (i.e., 10x) Since then, I've been playing with the ESP32 myself and really like it. In fact, Al (AC8GY) and I liked it enough that we went back in the chapters of the new Projects book and added it and we're using it in several projects. For those who are not familiar with the various microcontroller, this table from the book shows the important differences:

Resource

Arduino Nano

Teensy 3.6

Blue Pill

ESP32 WROOM 32

Processor bits

8

32

32

32

Flash1

32K

1Mb

64K - 128K

1.3Mb5

SRAM

2K

256K

20K

380Kb5

EEPROM

1K

4K2,3

?3

?3

Processor Clock speed

16MHz

180MHz4

72MHz

240MHz

I/O pins

14

58

26

25

Interrupts

All 14 mappable, 2 external

All 58 mappable

All 26 mappable

All 25 mappable

Timers

3 (2 8-bit, 1 16-bit)

19

7

4

SPI

1

1

1

2

I2C

1

4

1

2

DAC resolution (bits)

10

12

12

12

Analog pins

8

25

5

15

Price

$3

$30

$3

$10


The ESP32 also has WiFi and Bluetooth build into it and is based on a dual core architecture. True, it costs a little more, but this thing can really boot-scoot along at 15x that of a Nano. It is overkill for projects that are not processor-intensive or involve a lot of human I/O, but it's programmable in the Arduino IDE so you can leverage everything you already know without messing with another tool chain. I just wish we had "discovered" it earlier...

Jack, W8TEE

On Tuesday, July 9, 2019, 7:24:17 AM EDT, bobolink <rwhinric@...> wrote:


Tom,
Don't know if you are still in the STM32 family or porting to another processor altogether.
Another processor altogether. ESP32. Which is kind of a waste as I’m not using the onboard radios at all. All I really expect to salvage is Jack’s “game logic” and expertise in Morse code teaching methods.

Bob


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

bobolink <rwhinric@...>
 

Tom,
Don't know if you are still in the STM32 family or porting to another processor altogether.
Another processor altogether. ESP32. Which is kind of a waste as I’m not using the onboard radios at all. All I really expect to salvage is Jack’s “game logic” and expertise in Morse code teaching methods.

Bob


Re: AA not working

John P
 

On Mon, Jul 8, 2019 at 11:59 PM, Rudolph Neuhaus wrote:
The only files I could find are the .ino files
Rudolph,

There are no .h files associated with the Erase_Eprom and Read_Eprom.ino files. .h files are not a necessity for simple programs. Just make sure you put the .ino files into directories named Erase_Eprom and Read_Eprom, not in the directory with the AA program.

That said, I don't think that is your problem.

My first suggestion would be to look for the color definitions in the My_Analyzer_V3.8.ino file:

int BLUE       = 0x001F;
int GREEN    = 0x07E0;
int RED         = 0xF800;
int YELLOW  = 0xFFE0;

etc.

And put "~" characters in front of the definitions like:

int BLUE       = ~0x001F;
int GREEN    =  ~0x07E0;
int RED         = ~0xF800;
int YELLOW  = ~0xFFE0;

That flips all the bits in the color codes, which is the most common cause of display issues such as you describe. If that doesn't work, perhaps the display is defective as a lot of the ones from China seem to be.


 
--
John P.
WA2FZW


Re: W8TEE Morse Code Tutor '"Simplified" (James Bond '007' Version)

Tom, wb6b
 

On Mon, Jul 8, 2019 at 07:59 AM, bobolink wrote:
uint16 --> uint16_t
I had the same issue when I used the https://github.com/stm32duino toolchain.

Did not have issues with the https://github.com/rogerclarkmelbourne/Arduino_STM32 toolchain.

I simply added a #define uint16 uint16_t to the top of the file to fix that. There were enough additional issues that I switched to the Roger Clark toolchain, as I had no hardcore reason to use the stm32duino (supposedly official) Arduino toolchain. I also have STM developer boards for client projects, but I tend to use STM32Cube, rather than Arduino, with those. 

Don't know if you are still in the STM32 family or porting to another processor altogether.

Tom, wb6b

13981 - 14000 of 20131