-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBSPDrv_led.ads
64 lines (53 loc) · 3.1 KB
/
BSPDrv_led.ads
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This file provides declarations for the user LEDs on the STM32F4 Discovery
-- board from ST Microelectronics.
with STM32F4; use STM32F4;
package BSPDRV_LED is
pragma Elaborate_Body;
type User_LED is (Green, Orange, Red, Blue);
for User_LED use
(Green => 16#1000#,
Orange => 16#2000#,
Red => 16#4000#,
Blue => 16#8000#);
-- As a result of the representation clause, avoid iterating directly over
-- the type since that will require an implicit lookup in the generated
-- code of the loop. Such usage seems unlikely so this direct
-- representation is reasonable, and efficient.
for User_LED'Size use Word'Size;
-- we convert the LED values to Word values in order to write them to
-- the register, so the size must be the same
LED3 : User_LED renames Orange;
LED4 : User_LED renames Green;
LED5 : User_LED renames Red;
LED6 : User_LED renames Blue;
procedure On (This : User_LED) with Inline;
procedure Off (This : User_LED) with Inline;
procedure All_Off with Inline;
procedure All_On with Inline;
end BSPDRV_LED;