-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ILI9341 display driver with SPI connector
and provide a demo for it.
- Loading branch information
Showing
10 changed files
with
528 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# LCD demo | ||
|
||
This example demonstrates working with the LCD using the | ||
HAL.Bitmap.Bitmap_Buffer interface. | ||
Colorful rectangles are displayed on the screen, and their | ||
colors change based on the X and Y coordinates. | ||
|
||
For this demo, you need an LCD, (which is usually sold as | ||
part of the STM32 F4VE board kit) connected as SPI: | ||
|
||
* PA1 LCD RESET | ||
* PA2 LCD D/C | ||
* PA3 LCD BKL | ||
* PA4 SPI1 NSS | ||
* PA5 SPI1 SCK | ||
* PA6 SPI1 MISO | ||
* PA7 SPI1 MOSI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
with "stm32_f4ve_full_spi.gpr"; | ||
|
||
project LCD_SPI is | ||
|
||
for Runtime ("Ada") use STM32_f4VE_Full'Runtime ("Ada"); | ||
for Target use "arm-eabi"; | ||
for Main use ("main.adb"); | ||
for Languages use ("Ada"); | ||
for Source_Dirs use ("."); | ||
for Object_Dir use "obj/"; | ||
for Create_Missing_Dirs use "True"; | ||
|
||
package Compiler renames STM32_F4VE_Full.Compiler; | ||
|
||
package Ide is | ||
for Program_Host use "localhost:4242"; | ||
for Communication_Protocol use "remote"; | ||
for Connection_Tool use "st-util"; | ||
end Ide; | ||
end LCD_SPI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
------------------------------------------------------------------------------ | ||
-- -- | ||
-- Copyright (C) 2024, AdaCore -- | ||
-- -- | ||
-- Redistribution and use in source and binary forms, with or without -- | ||
-- modification, are permitted provided that the following conditions are -- | ||
-- met: -- | ||
-- 1. Redistributions of source code must retain the above copyright -- | ||
-- notice, this list of conditions and the following disclaimer. -- | ||
-- 2. Redistributions in binary form must reproduce the above copyright -- | ||
-- notice, this list of conditions and the following disclaimer in -- | ||
-- the documentation and/or other materials provided with the -- | ||
-- distribution. -- | ||
-- 3. Neither the name of the copyright holder nor the names of its -- | ||
-- contributors may be used to endorse or promote products derived -- | ||
-- from this software without specific prior written permission. -- | ||
-- -- | ||
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- | ||
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- | ||
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- | ||
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- | ||
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- | ||
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- | ||
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- | ||
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- | ||
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- | ||
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- | ||
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- | ||
-- -- | ||
------------------------------------------------------------------------------ | ||
|
||
with Ada.Real_Time; | ||
|
||
with HAL.Bitmap; | ||
|
||
with STM32.Board; | ||
with Display_ILI9341; | ||
|
||
procedure Main is | ||
use type Ada.Real_Time.Time; | ||
|
||
Next : Ada.Real_Time.Time := Ada.Real_Time.Clock; | ||
|
||
Bitmap : Display_ILI9341.Bitmap_Buffer renames STM32.Board.TFT_Bitmap; | ||
|
||
begin | ||
-- STM32.Board.Initialize_LEDs; | ||
STM32.Board.Display.Initialize; | ||
|
||
Bitmap.Set_Source (HAL.Bitmap.Black); | ||
Bitmap.Fill; | ||
|
||
for X in 0 .. 31 loop | ||
for Y in 0 .. 31 loop | ||
Bitmap.Set_Source | ||
((Alpha => 255, | ||
Green => 128, | ||
Red => HAL.UInt8 (X * 8), | ||
Blue => HAL.UInt8 (Y * 8))); | ||
|
||
Bitmap.Fill_Rect (((X * 7, Y * 10), 6, 9)); | ||
end loop; | ||
end loop; | ||
|
||
loop | ||
-- STM32.Board.Toggle (STM32.Board.D1_LED); | ||
|
||
Next := Next + Ada.Real_Time.Milliseconds (500); | ||
delay until Next; | ||
end loop; | ||
end Main; |
Oops, something went wrong.