Skip to content

Commit 0a800db

Browse files
committed
Add To_PWM (GPIO_Pin)
1 parent 3c106b6 commit 0a800db

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/devices/RP2040/rp-pwm.adb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ package body RP.PWM is
2020
Initialized := True;
2121
end Initialize;
2222

23+
function To_PWM
24+
(Pin : RP.GPIO.GPIO_Pin)
25+
return PWM_Point
26+
is ((Slice => PWM_Slice (Shift_Right (UInt32 (Pin), 1) and 2#111#),
27+
Channel => PWM_Channel'Val (UInt32 (Pin) and 1)));
28+
2329
function To_PWM
2430
(GPIO : RP.GPIO.GPIO_Point)
2531
return PWM_Point
26-
is ((Slice => PWM_Slice (Shift_Right (UInt32 (GPIO.Pin), 1) and 2#111#),
27-
Channel => PWM_Channel'Val (UInt32 (GPIO.Pin) and 1)));
32+
is (To_PWM (GPIO.Pin));
2833

2934
procedure Enable
3035
(Slice : PWM_Slice)

src/devices/RP2040/rp-pwm.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ is
5050
(GPIO : RP.GPIO.GPIO_Point)
5151
return PWM_Point;
5252

53+
function To_PWM
54+
(Pin : RP.GPIO.GPIO_Pin)
55+
return PWM_Point;
56+
5357
procedure Set_Mode
5458
(Slice : PWM_Slice;
5559
Mode : PWM_Divider_Mode)

tests_rp2350/src/i2cm_tests.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ with HAL; use HAL;
1212

1313
package body I2CM_Tests is
1414

15-
I2CM0_SDA : aliased RP.GPIO.GPIO_Point := (Pin => 0);
16-
I2CM0_SCL : aliased RP.GPIO.GPIO_Point := (Pin => 1);
15+
I2CM0_SDA : constant RP.GPIO.GPIO_Point := (Pin => 0);
16+
I2CM0_SCL : constant RP.GPIO.GPIO_Point := (Pin => 1);
1717
I2CM0 : RP.I2C_Master.I2C_Master_Port renames RP.Device.I2CM_0;
1818

1919
Target_Addr : constant I2C_Address := 2#1010_0000#; -- 24FC64F with A0,A1,A2=GND

0 commit comments

Comments
 (0)