WARNING : 
STM32F103 is 3.3 Volt chip.
Some pins are 5 Volt tollerant, some NOT!
Check before connect !

INFO :
STM32F103C6 is unusable, use STM32F103C8 or better.

INFO :
If you use Arduino IDE, disable USB in "Tools/USB support" menu.

INFO :
If uncomment #define USE_ALL_PINS in SpindleETH.ino file, you can use PA13 and PA14 as inputs,
but ST-Link can't reset chip when programming.
In this case you must manually press reset button and hold while start programming, then release.
This affect only programmed chips, new or cleaned are programming normally. 


***** STM32F103 Blue Pill pinout: *****

PA0	->	out.3
PA1	->	out.4
PA2	->	out.5
PA3	->	out.6
PA4	->	W5500 CS 
PA5	->	W5500 SCK
PA6	->	W5500 MISO
PA7	->	W5500 MOSI
PA8	->	PWM
PA9	->	in.4
PA10	->	in.5
PA11	->	in.6	(USB !!!)
PA12	->	in.7	(USB !!!)
PA13	->	in.13	(SWDIO, works as input if defined USE_ALL_PINS)
PA14	->	in.14	(SWCLK, works as input if defined USE_ALL_PINS)
PA15	->	in.8

PB0	->	out.7
PB1	->	out.8
PB2	->	<unavailable>
PB3	->	in.9
PB4	->	in.10
PB5	->	in.11
PB6	->	encoder A
PB7	->	encoder B
PB8	->	encoder Z
PB9	->	in.12
PB10	->	out.9
PB11	->	out.10
PB12	->	in.0
PB13	->	in.1
PB14	->	in.2
PB15	->	in.3

PC0	->	<unavailable>
PC1	->	<unavailable>
PC2	->	<unavailable>
PC3	->	<unavailable>
PC4	->	<unavailable>
PC5	->	<unavailable>
PC6	->	<unavailable>
PC7	->	<unavailable>
PC8	->	<unavailable>
PC9	->	<unavailable>
PC10	->	<unavailable>
PC11	->	<unavailable>
PC12	->	<unavailable>
PC13	->	out.0
PC14	->	out.1
PC15	->	out.2



***** HAL pins: *****

pin out float   encoder_raw		"Encoder raw counts";
pin in  float   pos_scale		"Scaling factor for pos";
pin out float   pos			"Position";
pin out float   vel			"Velocity";    
pin in  float   spindle_pwm 		"PWM output";
pin io bit 	index_ena		"Reset pos to 0 at the next full rotation";
pin io bit 	enc_reset		"Reset pos to 0 immediatelly";


pin in  bit     out.##[11]		"11 digital outputs from out.00 to out.10";
pin out bit     in.##[16]		"16 digital inputs from in.00 to in.15";

pin out bit     ready			"Module state";
pin in  bit     enable			"Module enable";
pin out s32     packets			"Lost packets";
