Skip to content

Commit 85a4242

Browse files
Update Ada Drivers Library
1 parent 9617f6d commit 85a4242

File tree

6 files changed

+56
-36
lines changed

6 files changed

+56
-36
lines changed

stm32f4-disco_controller/drivers

Submodule drivers updated from 2c993e6 to 997b5e3

stm32f4-disco_controller/src/coms.adb

+11-15
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,22 @@ package body Coms is
4747
-------------------------------
4848

4949
procedure Initialize_GPIO_Port_Pins is
50-
Configuration : GPIO_Port_Configuration;
5150
Points : constant GPIO_Points := Rx_Pin & Tx_Pin & CTS_Pin;
5251
begin
5352
Enable_Clock (Points);
5453

55-
Configuration.Mode := Mode_AF;
56-
Configuration.Speed := Speed_50MHz;
57-
Configuration.Output_Type := Push_Pull;
58-
Configuration.Resistors := Pull_Up;
59-
6054
Configure_IO
61-
(Points, Configuration);
62-
63-
Configure_Alternate_Function
64-
(Points, Transceiver_AF);
65-
66-
-- Manual RTS controll
67-
Configuration.Mode := Mode_Out;
68-
Configuration.Speed := Speed_50MHz;
69-
RTS_Pin.Configure_IO (Configuration);
55+
(Points, (Mode => Mode_AF,
56+
Resistors => Pull_Up,
57+
AF_Output_Type => Push_Pull,
58+
AF_Speed => Speed_50MHz,
59+
AF => Transceiver_AF));
60+
61+
-- Manual RTS control
62+
RTS_Pin.Configure_IO ((Mode => Mode_Out,
63+
Resistors => Pull_Up,
64+
Output_Type => Push_Pull,
65+
Speed => Speed_50MHz));
7066
Ready_To_Receive (False);
7167
end Initialize_GPIO_Port_Pins;
7268

stm32f4-disco_controller/src/gcode_controller.adb

+11-6
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ package body Gcode_Controller is
4545
Configuration : GPIO_Port_Configuration;
4646
begin
4747
Enable_Clock (Demo_Mode_Button);
48-
Configuration.Mode := Mode_In;
49-
Configuration.Output_Type := Push_Pull;
50-
Configuration.Speed := Speed_25MHz;
51-
Configuration.Resistors := Pull_Up;
48+
Configuration := (Mode => Mode_In,
49+
Resistors => Pull_Up);
5250
Demo_Mode_Button.Configure_IO (Configuration);
5351

5452
Enable_Clock (Demo_Mode_LED);
55-
Configuration.Mode := Mode_Out;
56-
Configuration.Output_Type := Open_Drain;
53+
Configuration := (Mode => Mode_Out,
54+
Resistors => Pull_Up,
55+
Output_Type => Open_Drain,
56+
Speed => Speed_50MHz);
57+
5758
Demo_Mode_LED.Configure_IO (Configuration);
5859
Demo_Mode_LED.Clear;
5960

@@ -119,6 +120,10 @@ package body Gcode_Controller is
119120

120121
Ada.Synchronous_Task_Control.Suspend_Until_True (Task_Sync);
121122

123+
for Str_Ptr of Make_With_Ada_Gcode.Gcode loop
124+
Gcode_Controller.Execute (Str_Ptr.all);
125+
end loop;
126+
122127
if not Demo_Mode_Button.Set then
123128
loop
124129
Demo_Mode_LED.Set;

stm32f4-disco_controller/src/make_with_ada_gcode.ads

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package Make_With_Ada_Gcode is
66
new String'("#<pen_up> = -12"),
77
new String'("#<pen_down> = -15"),
88
new String'("M17 ; Enable motors"),
9-
new String'("G28 ; Go home"),
9+
-- new String'("G28 ; Go home"),
1010
new String'("(Start cutting path: Right Curly Bracket)"),
1111
new String'("G00 Z#<pen_up>"),
1212
new String'("G00 X34.492847 Y33.263329"),

stm32f4-disco_controller/src/settings.ads

+20-2
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@
2121
-------------------------------------------------------------------------------
2222

2323
with Ada.Real_Time;
24-
with Gcode;
24+
with Gcode; use Gcode;
2525

2626
package Settings is
2727

28+
Use_CoreXY_Motion : constant Boolean := True;
29+
2830
Idle_Stepper_Frequency : constant Gcode.Frequency_Value := 100.0;
2931
-- Frequency of the stepper when the machine is idle (Hz)
3032
Dwell_Stepper_Frequency : constant Gcode.Frequency_Value := 100.0;
3133
-- Frequency of the stepper when executing a dwell command (Hz)
3234

33-
Step_Per_Millimeter : constant Gcode.Float_Position := (27.0, 27.0, 46.11);
35+
Step_Per_Millimeter : constant Gcode.Float_Position := (80.0, 80.0, 46.11);
3436
-- Property of the stepper motor and leadscrew
3537

3638
Max_Step_Per_Segment : constant Gcode.Steps := 25;
@@ -57,6 +59,22 @@ package Settings is
5759
Ada.Real_Time.Milliseconds (0);
5860
-- Minimum duration of step pulse
5961

62+
-----------------
63+
-- Soft limits --
64+
-----------------
65+
66+
Tool_Max_Limit_Cartesian : constant Gcode.Step_Position :=
67+
(X_Axis => Integer (Step_Per_Millimeter (X_Axis)) * 40,
68+
Y_Axis => Integer (Step_Per_Millimeter (Y_Axis)) * 40,
69+
Z_Axis => Integer (Step_Per_Millimeter (Z_Axis)) * 40);
70+
-- Tool max position in carstesian coordinate
71+
72+
Tool_Min_Limit_Cartesian : constant Gcode.Step_Position :=
73+
(X_Axis => 0,
74+
Y_Axis => 0,
75+
Z_Axis => 0);
76+
-- Tool min position in carstesian coordinate
77+
6078
------------
6179
-- Homing --
6280
------------

stm32f4-disco_controller/src/step_control.adb

+12-11
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ package body Step_Control is
4949
procedure Initalize is
5050
Configuration : GPIO_Port_Configuration;
5151
begin
52-
Configuration.Mode := Mode_Out;
53-
Configuration.Output_Type := Push_Pull;
54-
Configuration.Speed := Speed_100MHz;
55-
Configuration.Resistors := Pull_Down;
52+
Configuration := (Mode => Mode_Out,
53+
Resistors => Pull_Up,
54+
Output_Type => Push_Pull,
55+
Speed => Speed_50MHz);
5656

5757
for Axis in Axis_Name loop
5858
Enable_Clock (Step_GPIO (Axis));
@@ -76,19 +76,20 @@ package body Step_Control is
7676
end loop;
7777

7878
-- Home switches
79-
Configuration.Mode := Mode_In;
80-
Configuration.Output_Type := Push_Pull;
81-
Configuration.Speed := Speed_100MHz;
82-
Configuration.Resistors := Pull_Up;
79+
Configuration := (Mode => Mode_In,
80+
Resistors => Pull_Up);
8381

8482
for Axis in Axis_Name loop
8583
Enable_Clock (Home_GPIO (Axis));
8684
Configure_IO (Home_GPIO (Axis), Configuration);
8785
end loop;
8886

8987
Enable_Clock (Analysis_Point);
90-
Configuration.Mode := Mode_Out;
91-
Configuration.Speed := Speed_100MHz;
88+
Configuration := (Mode => Mode_Out,
89+
Resistors => Pull_Up,
90+
Output_Type => Push_Pull,
91+
Speed => Speed_100MHz);
92+
9293
Configure_IO (Analysis_Point, Config => Configuration);
9394
Analysis_Point.Clear;
9495

@@ -138,7 +139,7 @@ package body Step_Control is
138139

139140
procedure Set_Stepper_Frequency (Freq_Hz : Frequency_Value) is
140141
begin
141-
Task_Period := To_Time_Span (1.0 / Freq_Hz);
142+
Task_Period := To_Time_Span (Duration (1.0 / Freq_Hz));
142143
end Set_Stepper_Frequency;
143144

144145
---------------

0 commit comments

Comments
 (0)