summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/ada/alire.toml26
-rw-r--r--firmware/ada/pouetpouet.gpr2
-rw-r--r--firmware/ada/src/pouetpouet.adb43
3 files changed, 37 insertions, 34 deletions
diff --git a/firmware/ada/alire.toml b/firmware/ada/alire.toml
index 70b31fd..9f3e5b7 100644
--- a/firmware/ada/alire.toml
+++ b/firmware/ada/alire.toml
@@ -8,27 +8,21 @@ maintainers-logins = ["dkm"]
executables = ["pouetpouet"]
-
-# [[pins]] # Added by alr
-# usb_embedded = { url='https://github.com/Fabien-Chouteau/usb_embedded' }
-
-##/mnt/barryallen/dkm/git/ada-embedded/usb_embedded' }
-[[depends-on]]
-click = "~0.1.0-dev"
-[[pins]]
-click = { url='https://github.com/dkm/click' }
-
[configuration.values]
atomic.backend = "armv6m"
cortex_m.core = "m0"
[[depends-on]]
+click = "~0.1.0-dev"
usb_embedded = "~0.3.0-dev"
-[[pins]]
-usb_embedded = { url='https://github.com/Fabien-Chouteau/usb_embedded' }
-[[depends-on]]
-gnat_arm_elf = "^11.2"
-[[depends-on]]
+gnat_arm_elf = "^12"
stm32f0x2_hal = "~0.0.0"
+
+# [build-profiles]
+# stm32f0x2_hal = "development"
+# click = "development"
+
[[pins]]
-stm32f0x2_hal = { url='https://github.com/dkm/stm32f0x2_hal-ada' }
+click = { url='https://github.com/dkm/click' }
+usb_embedded = { url='https://github.com/dkm/usb_embedded' }
+stm32f0x2_hal = { url='https://github.com/dkm/stm32f0x2_hal-ada.git' } \ No newline at end of file
diff --git a/firmware/ada/pouetpouet.gpr b/firmware/ada/pouetpouet.gpr
index 78bd5ad..42830d6 100644
--- a/firmware/ada/pouetpouet.gpr
+++ b/firmware/ada/pouetpouet.gpr
@@ -13,7 +13,7 @@ project Pouetpouet is
for Main use ("pouetpouet.adb");
package Compiler is
- for Default_Switches ("Ada") use Pouetpouet_Config.Ada_Compiler_Switches & ("-gnatX");
+ for Default_Switches ("Ada") use Pouetpouet_Config.Ada_Compiler_Switches & ("-gnatX", "-gnat2022", "-g3");
end Compiler;
package Binder is
diff --git a/firmware/ada/src/pouetpouet.adb b/firmware/ada/src/pouetpouet.adb
index 78f04ed..babe362 100644
--- a/firmware/ada/src/pouetpouet.adb
+++ b/firmware/ada/src/pouetpouet.adb
@@ -4,9 +4,6 @@ with STM32.GPIO; use STM32.GPIO;
-- Not yet used.
-- with STM32.Timers; use STM32.Timers;
--- with USB.HAL.Device;
--- with USB.Device.Serial;
-
with USB; use USB;
with USB.Device.HID.Keyboard;
with USB.Device; use USB.Device;
@@ -31,7 +28,7 @@ procedure Pouetpouet is
:= [PA0, PA1, PB13, PB12, PB14, PB15, PA15, PB3, PB4, PB5, PB8, PB9];
package TestClick is new Click (5 ,ColR, RowR, GPIO_Point,
- Ct, Rt, Cols, Rows, 2);
+ Ct, Rt, Cols, Rows, 2, Logging.Log);
use TestClick;
Bepo_Layout : constant Layout :=
@@ -60,8 +57,18 @@ procedure Pouetpouet is
use type USB.Device.Init_Result;
USB_Status : USB.Device.Init_Result;
+ procedure Dump_Events (Es : Events) is
+ begin
+ for E of Es loop
+ Log (" - "
+ & (if E.Evt = Press then "P " else "R ")
+ & E.Row'Image & ":" & E.Col'Image);
+ end loop;
+ end Dump_Events;
+
begin
- Init;
+
+ Testclick.Init;
if not USB_Stack.Register_Class (HID_Class'Unchecked_Access) then
raise Fatal_Error with "Failed to register USB Serial device class";
@@ -88,7 +95,7 @@ begin
-- Enable_Interrupt (Timer_1, Timer_Update_Interrupt);
-- Enable (Timer_1);
- Log ("STARTING");
+ Log ("STARTING FW");
for Row of Keys.Rows loop
Enable_Clock (Row);
@@ -112,26 +119,28 @@ begin
USB_Stack.Poll;
declare
- Evts : constant Events := Get_Events (Get_Matrix);
+ Evts : constant Events := Get_Events;
begin
-- FIXME: dot notation possible in GCC12
- Register_Events (Bepo_Layout, Evts);
+ if Evts'Length > 0 then
+ Dump_Events(Evts);
+ Register_Events (Bepo_Layout, Evts);
+ end if;
+
Tick (Bepo_Layout);
- for KC of Key_Codes (Bepo_Layout) loop
- -- Log ("(" & Evt.Evt'Image & ", " & Evt.Col'Image & ", "
- -- & Evt.Row'Image & ") = "
- -- & Key_Code_T'Enum_Rep (Bepo_Layout (Evt.Row, Evt.Col).C)'Image);
+ for KC of Get_Key_Codes loop
+ Log ("Got 1 keycode to push : " & Key_Code_T'Enum_Rep (KC)'Image);
if HID_Class.Ready then
- -- if Evt.Evt = Press then
- -- HID_Class.Push_Key_Code
- -- (Key_Code_T'Enum_Rep (Bepo_Layout (Evt.Row, Evt.Col).C));
HID_Class.Push_Key_Code (Key_Code_T'Enum_Rep (KC));
-
- -- end if;
end if;
end loop;
+
+ for M of Get_Modifiers loop
+ HID_Class.Set_Modifier (M, True);
+ end loop;
+
HID_Class.Send_Report (UDC);
end;
-- Delay_Cycles (72);