From 72e36aad8a8404d6c5a4deecd52a55dcade6cf0e Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Sun, 23 Jun 2024 13:37:19 +0300 Subject: [PATCH] Fix ILI9341 display driver with SPI connector and provide a demo for it. --- .../src/screen/ili9341/ili9341-device.adb | 10 +- .../screen/ili9341/ili9341-spi_connector.adb | 161 +++++++++++++++++- .../screen/ili9341/ili9341-spi_connector.ads | 20 ++- examples/stm32_f4ve/lcd_spi/README.md | 18 ++ examples/stm32_f4ve/lcd_spi/lcd_spi.gpr | 20 +++ examples/stm32_f4ve/lcd_spi/main.adb | 71 ++++++++ .../lcd_spi/spi/display_ili9341.adb | 148 ++++++++++++++++ .../lcd_spi/spi/display_ili9341.ads | 77 +++++++++ .../lcd_spi/stm32_f4ve_full_spi.gpr | 8 + scripts/build_all_examples.py | 1 + 10 files changed, 528 insertions(+), 6 deletions(-) create mode 100644 examples/stm32_f4ve/lcd_spi/README.md create mode 100644 examples/stm32_f4ve/lcd_spi/lcd_spi.gpr create mode 100644 examples/stm32_f4ve/lcd_spi/main.adb create mode 100644 examples/stm32_f4ve/lcd_spi/spi/display_ili9341.adb create mode 100644 examples/stm32_f4ve/lcd_spi/spi/display_ili9341.ads create mode 100644 examples/stm32_f4ve/lcd_spi/stm32_f4ve_full_spi.gpr diff --git a/components/src/screen/ili9341/ili9341-device.adb b/components/src/screen/ili9341/ili9341-device.adb index 63bbcaf2c..ca3607918 100644 --- a/components/src/screen/ili9341/ili9341-device.adb +++ b/components/src/screen/ili9341/ili9341-device.adb @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------ -- -- --- Copyright (C) 2015-2023, AdaCore -- +-- Copyright (C) 2015-2024, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- @@ -117,7 +117,13 @@ package body ILI9341.Device is Time.Delay_Milliseconds (150); Send_Command (Data, ILI9341_DISPLAY_ON, []); - Send_Command (Data, ILI9341_GRAM, []); + + case Connection is + when RGB => + Send_Command (Data, ILI9341_GRAM, []); + when Serial | Parallel => + null; + end case; end Initialize; --------------------- diff --git a/components/src/screen/ili9341/ili9341-spi_connector.adb b/components/src/screen/ili9341/ili9341-spi_connector.adb index e95ecf6a2..426fd4486 100644 --- a/components/src/screen/ili9341/ili9341-spi_connector.adb +++ b/components/src/screen/ili9341/ili9341-spi_connector.adb @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------ -- -- --- Copyright (C) 2015-2023, AdaCore -- +-- Copyright (C) 2015-2024, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- @@ -29,8 +29,45 @@ -- -- ------------------------------------------------------------------------------ +with Bitmap_Color_Conversion; + +with ILI9341.Regs; + package body ILI9341.SPI_Connector is + ----------------- + -- Read_Pixels -- + ----------------- + + procedure Read_Pixels + (This : ILI9341_Connector; + Cmd : HAL.UInt8; + Address : System.Address; + Count : Positive) + is + use all type HAL.SPI.SPI_Status; + + subtype Raw_Buffer is HAL.SPI.SPI_Data_8b (1 .. 3 * Count); + + Raw_Pixels : Raw_Buffer + with Import, Address => Address; + + Status : HAL.SPI.SPI_Status; + begin + This.WRX.Clear; + This.Chip_Select.Clear; + This.Port.Transmit (HAL.SPI.SPI_Data_8b'(1 => Cmd), Status); + + if Status /= Ok then + raise Program_Error; + end if; + + This.WRX.Set; + This.Port.Receive (Raw_Pixels, Status); + + This.Chip_Select.Set; + end Read_Pixels; + ------------------ -- Send_Command -- ------------------ @@ -41,6 +78,7 @@ package body ILI9341.SPI_Connector is Data : HAL.UInt8_Array) is use HAL.SPI; + Status : SPI_Status; begin This.WRX.Clear; @@ -60,7 +98,126 @@ package body ILI9341.SPI_Connector is end if; end if; - This.Chip_Select.Set; + if Cmd not in ILI9341.Regs.ILI9341_GRAM then + This.Chip_Select.Set; + end if; end Send_Command; + ------------------ + -- Write_Pixels -- + ------------------ + + procedure Write_Pixels + (This : ILI9341_Connector; + Mode : HAL.Bitmap.Bitmap_Color_Mode; + Address : System.Address; + Count : Positive; + Repeat : Positive) + is + + procedure Transmit (Color : HAL.Bitmap.Bitmap_Color); + -- Transmit RGB on a single pixel + + -------------- + -- Transmit -- + -------------- + + procedure Transmit (Color : HAL.Bitmap.Bitmap_Color) is + Status : HAL.SPI.SPI_Status; + + Pixel : HAL.SPI.SPI_Data_8b (1 .. 4) + with Import, Address => Color'Address; + begin + This.Port.Transmit (Pixel (1 .. 3), Status); + end Transmit; + + begin + This.WRX.Set; + + case Mode is + when HAL.Bitmap.RGB_888 => + -- Native format for SPI interface + declare + subtype Raw_Buffer is HAL.SPI.SPI_Data_8b (1 .. 3 * Count); + + Raw_Pixels : Raw_Buffer + with Import, Address => Address; + + Status : HAL.SPI.SPI_Status; + begin + for Step in 1 .. Repeat loop + This.Port.Transmit (Raw_Pixels, Status); + end loop; + end; + + when HAL.Bitmap.ARGB_8888 => + declare + subtype Raw_Buffer is HAL.UInt32_Array (1 .. Count); + + Raw_Pixels : Raw_Buffer + with Import, Address => Address; + begin + for Step in 1 .. Repeat loop + for Raw of Raw_Pixels loop + declare + Color : constant HAL.Bitmap.Bitmap_Color := + Bitmap_Color_Conversion.Word_To_Bitmap_Color + (Mode, Raw); + begin + Transmit (Color); + end; + end loop; + end loop; + end; + + when HAL.Bitmap.RGB_565 | + HAL.Bitmap.ARGB_1555 | + HAL.Bitmap.ARGB_4444 | + HAL.Bitmap.AL_88 => + declare + subtype Raw_Buffer is HAL.UInt16_Array (1 .. Count); + + Raw_Pixels : Raw_Buffer + with Import, Address => Address; + begin + for Step in 1 .. Repeat loop + for Raw of Raw_Pixels loop + declare + Color : constant HAL.Bitmap.Bitmap_Color := + Bitmap_Color_Conversion.Word_To_Bitmap_Color + (Mode, HAL.UInt32 (Raw)); + begin + Transmit (Color); + end; + end loop; + end loop; + end; + + when HAL.Bitmap.L_8 | HAL.Bitmap.AL_44 => + declare + subtype Raw_Buffer is HAL.UInt8_Array (1 .. Count); + + Raw_Pixels : Raw_Buffer + with Import, Address => Address; + begin + for Step in 1 .. Repeat loop + for Raw of Raw_Pixels loop + declare + Color : constant HAL.Bitmap.Bitmap_Color := + Bitmap_Color_Conversion.Word_To_Bitmap_Color + (Mode, HAL.UInt32 (Raw)); + begin + Transmit (Color); + end; + end loop; + end loop; + end; + + when others => + raise Program_Error; + end case; + + This.Chip_Select.Set; + end Write_Pixels; + end ILI9341.SPI_Connector; diff --git a/components/src/screen/ili9341/ili9341-spi_connector.ads b/components/src/screen/ili9341/ili9341-spi_connector.ads index 3cdcecdc5..b0454a745 100644 --- a/components/src/screen/ili9341/ili9341-spi_connector.ads +++ b/components/src/screen/ili9341/ili9341-spi_connector.ads @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------ -- -- --- Copyright (C) 2015-2023, AdaCore -- +-- Copyright (C) 2015-2024, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- @@ -29,8 +29,11 @@ -- -- ------------------------------------------------------------------------------ -with HAL.SPI; +with System; + +with HAL.Bitmap; with HAL.GPIO; +with HAL.SPI; package ILI9341.SPI_Connector is @@ -47,4 +50,17 @@ package ILI9341.SPI_Connector is Data : HAL.UInt8_Array); -- Send ILI9341 command over SPI + procedure Write_Pixels + (This : ILI9341_Connector; + Mode : HAL.Bitmap.Bitmap_Color_Mode; + Address : System.Address; + Count : Positive; + Repeat : Positive); + + procedure Read_Pixels + (This : ILI9341_Connector; + Cmd : HAL.UInt8; + Address : System.Address; + Count : Positive); + end ILI9341.SPI_Connector; diff --git a/examples/stm32_f4ve/lcd_spi/README.md b/examples/stm32_f4ve/lcd_spi/README.md new file mode 100644 index 000000000..4b236f7bf --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/README.md @@ -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 + diff --git a/examples/stm32_f4ve/lcd_spi/lcd_spi.gpr b/examples/stm32_f4ve/lcd_spi/lcd_spi.gpr new file mode 100644 index 000000000..b2a8ed444 --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/lcd_spi.gpr @@ -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; diff --git a/examples/stm32_f4ve/lcd_spi/main.adb b/examples/stm32_f4ve/lcd_spi/main.adb new file mode 100644 index 000000000..b88579284 --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/main.adb @@ -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; diff --git a/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.adb b/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.adb new file mode 100644 index 000000000..ed305ba8c --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.adb @@ -0,0 +1,148 @@ +------------------------------------------------------------------------------ +-- -- +-- Copyright (C) 2015-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 STMicroelectronics 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 HAL.SPI; + +with STM32.GPIO; +with STM32.SPI; + +with Ravenscar_Time; + +package body Display_ILI9341 is + + use type STM32.GPIO.GPIO_Points; + + procedure Initialize_SPI; + + -------------------- + -- Initialize_SPI -- + -------------------- + + procedure Initialize_SPI is + + SPI : STM32.SPI.SPI_Port renames STM32.Device.SPI_1; + + SPI_CS : STM32.GPIO.GPIO_Point renames STM32.Device.PA4; + SPI_SCK : STM32.GPIO.GPIO_Point renames STM32.Device.PA5; + SPI_MISO : STM32.GPIO.GPIO_Point renames STM32.Device.PA6; + SPI_MOSI : STM32.GPIO.GPIO_Point renames STM32.Device.PA7; + + SPI_Pins : constant STM32.GPIO.GPIO_Points := + (SPI_SCK, SPI_MISO, SPI_MOSI); + begin + STM32.Device.Enable_Clock (SPI_Pins & SPI_CS); + + STM32.GPIO.Configure_IO + (SPI_CS, + (Mode => STM32.GPIO.Mode_Out, + Resistors => STM32.GPIO.Floating, + Output_Type => STM32.GPIO.Push_Pull, + Speed => STM32.GPIO.Speed_100MHz)); + + SPI_CS.Set; + + STM32.GPIO.Configure_IO + (SPI_Pins, + (Mode => STM32.GPIO.Mode_AF, + Resistors => STM32.GPIO.Pull_Up, + AF_Output_Type => STM32.GPIO.Push_Pull, + AF_Speed => STM32.GPIO.Speed_100MHz, + AF => STM32.Device.GPIO_AF_SPI1_5)); + + STM32.Device.Enable_Clock (SPI); + + STM32.SPI.Configure + (SPI, + (Direction => STM32.SPI.D2Lines_FullDuplex, + Mode => STM32.SPI.Master, + Data_Size => HAL.SPI.Data_Size_8b, + Clock_Polarity => STM32.SPI.Low, -- Mode 0 + Clock_Phase => STM32.SPI.P1Edge, + Slave_Management => STM32.SPI.Software_Managed, + Baud_Rate_Prescaler => STM32.SPI.BRP_16, + First_Bit => STM32.SPI.MSB, + CRC_Poly => 0)); + -- SPI1 sits on APB2, which is 84MHz, so SPI rate in 84/16=5.25MHz + end Initialize_SPI; + + ---------------- + -- Initialize -- + ---------------- + + procedure Initialize (This : in out Display) is + TFT_Reset : STM32.GPIO.GPIO_Point := STM32.Device.PA1; + -- Reset pin + TFT_WRX : STM32.GPIO.GPIO_Point := STM32.Device.PA2; + -- D/C pin + TFT_BLK : STM32.GPIO.GPIO_Point := STM32.Device.PA3; + -- STM32.Board.TFT_BLK + TFT_Pins : constant STM32.GPIO.GPIO_Points := + (TFT_Reset, TFT_WRX, TFT_BLK); + begin + STM32.Device.Enable_Clock (TFT_Pins); + + STM32.GPIO.Configure_IO + (TFT_Pins, + ((STM32.GPIO.Mode_Out, + Resistors => STM32.GPIO.Floating, + Output_Type => STM32.GPIO.Push_Pull, + Speed => STM32.GPIO.Speed_100MHz))); + + TFT_Reset.Clear; -- Reset + Ravenscar_Time.Delays.Delay_Microseconds (11); + TFT_Reset.Set; + Ravenscar_Time.Delays.Delay_Milliseconds (121); + + TFT_BLK.Set; -- Turn LCD backlight on + TFT_WRX.Clear; + + Initialize_SPI; + + This.Device.Initialize (Ravenscar_Time.Delays); + This.Set_Orientation (HAL.Framebuffer.Default); + end Initialize; + + --------------------- + -- Set_Orientation -- + --------------------- + + procedure Set_Orientation + (This : in out Display; + Orientation : HAL.Framebuffer.Display_Orientation) is + begin + This.Device.Set_Orientation + (case Orientation is + when HAL.Framebuffer.Landscape => + ILI9341_Device.Landscape_1, + when others => ILI9341_Device.Portrait_2); + end Set_Orientation; + +end Display_ILI9341; diff --git a/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.ads b/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.ads new file mode 100644 index 000000000..7eaeb3e68 --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/spi/display_ili9341.ads @@ -0,0 +1,77 @@ +------------------------------------------------------------------------------ +-- -- +-- Copyright (C) 2015-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 HAL.Framebuffer; + +with STM32.Device; + +with ILI9341.Device.Bitmap; +with ILI9341.Device; +with ILI9341.SPI_Connector; + +package Display_ILI9341 is + + type Display is tagged limited private; + + procedure Initialize (This : in out Display); + -- Configure FSMC, turn backlight on and initialize the display + + procedure Set_Orientation + (This : in out Display; + Orientation : HAL.Framebuffer.Display_Orientation); + + package ILI9341_Device is new ILI9341.Device + (ILI9341_Connector => ILI9341.SPI_Connector.ILI9341_Connector, + Send_Command => ILI9341.SPI_Connector.Send_Command, + Connection => ILI9341.Parallel, + Connector => + (Port => STM32.Device.SPI_1'Access, + Chip_Select => STM32.Device.PA4'Access, + WRX => STM32.Device.PA2'Access)); + + package ILI9341_Bitmap is new ILI9341_Device.Bitmap + (ILI9341.SPI_Connector.Write_Pixels, + ILI9341.SPI_Connector.Read_Pixels); + + subtype Bitmap_Buffer is ILI9341_Bitmap.Bitmap_Buffer; + + function Buffer (This : in out Display) return Bitmap_Buffer; + +private + + type Display is tagged limited record + Device : aliased ILI9341_Device.ILI9341_Device; + end record; + + function Buffer (This : in out Display) return Bitmap_Buffer is + (ILI9341_Bitmap.Get_Bitmap (This.Device'Access)); + +end Display_ILI9341; diff --git a/examples/stm32_f4ve/lcd_spi/stm32_f4ve_full_spi.gpr b/examples/stm32_f4ve/lcd_spi/stm32_f4ve_full_spi.gpr new file mode 100644 index 000000000..2ee8567fd --- /dev/null +++ b/examples/stm32_f4ve/lcd_spi/stm32_f4ve_full_spi.gpr @@ -0,0 +1,8 @@ +library project STM32_F4VE_Full_SPI + extends "../../../boards/stm32_f4ve/stm32_f4ve_full.gpr" +is + for Source_Dirs use ("spi"); + for Library_Dir use "obj/spi_lib"; + for Object_Dir use "obj/spi_obj"; + +end STM32_F4VE_Full_SPI; diff --git a/scripts/build_all_examples.py b/scripts/build_all_examples.py index b566158b2..dcbf1b6d1 100755 --- a/scripts/build_all_examples.py +++ b/scripts/build_all_examples.py @@ -73,6 +73,7 @@ def gprbuild(project_file, debug=False): "/examples/stm32_f4ve/blinky_stm32_f4ve.gpr", "/examples/stm32_f4ve/draw/draw.gpr", "/examples/stm32_f4ve/lcd/lcd.gpr", + "/examples/stm32_f4ve/lcd_spi/lcd_spi.gpr", # STM32F4XX M "/boards/stm32f4xx_m/stm32f4xx_m_full.gpr",