Add flappybit project

This commit is contained in:
R. Tyler Croy 2018-11-09 15:44:10 -08:00
parent ba03866a85
commit cb0ad190d1
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
2 changed files with 73 additions and 0 deletions

26
flappybit.gpr Normal file
View File

@ -0,0 +1,26 @@
with "contrib/Ada_Drivers_Library/boards/MicroBit/microbit_zfp.gpr";
project Flappybit is
for Runtime ("ada") use "zfp-microbit";
for Target use "arm-eabi";
for Main use ("main.adb");
for Languages use ("Ada");
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Create_Missing_Dirs use "True";
package Compiler renames MicroBit_ZFP.Compiler;
package Linker is
for Default_Switches ("Ada") use ("-Wl,--print-memory-usage",
"-Wl,--gc-sections");
end Linker;
package Ide is
for Program_Host use ":1234";
for Communication_Protocol use "remote";
for Connection_Tool use "pyocd";
end Ide;
end Flappybit;

47
src/main.adb Normal file
View File

@ -0,0 +1,47 @@
------------------------------------------------------------------------------
-- Copyright (C) 2018, AdaCore --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
-- This simple example shows a scrolling text on the micro:bit LED matrix.
--
-- It is intended as first project to get familiar with Ada and GNAT
-- Programing Studio on the micro:bit.
--
-- For more advanced micro:bit features please have a look at the
-- Ada_Drivers_Library project: https://github.com/AdaCore/Ada_Drivers_Library
--
-- The micro:bit has a 5 x 5 multiplexed LED matrix, this means only one LED
-- can be lit at a time. To overcome this limitation, the LEDs are lit one
-- after the other very quickly. This process, called scanning, happens so fast
-- that the human eyes sees all the LED lit together (persistence of vision).
-- In this example, the scan is done with a periodic Timing_Event. Timing_Event
-- is an Ada standard feature that allows you to have a callback executed at a
-- give point in time and can be used to create periodic timers. The periodic
-- timers are implemented in the Generic_Timer package.
--
-- The LED matrix initialization and text scrolling are implemented in the
-- Display package.
--
-- The hardware maping for the GPIOs has been generated from a SVD description
-- file using SVD2Ada: https://github.com/AdaCore/svd2ada
with Display;
procedure Main is
begin
loop
Display.Scroll_Text ("Make with Ada! ");
end loop;
end Main;