Skip to content

Commit 4dbc06f

Browse files
authored
Fix ili9341 and orientation (#120)
1 parent 9031782 commit 4dbc06f

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

ManagedDrivers/Ili9341/Ili9341.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public static GraphicDriver GraphicDriver
123123
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Memory_Write,
124124
(byte)GraphicDriverCommandType.Command, 2, (byte)ILI9341_CMD.Entry_Mode_Set, 0x07,
125125
(byte)GraphicDriverCommandType.Command, 5, (byte)ILI9341_CMD.Display_Function_Control, 0x0A, 0x82, 0x27, 0x00,
126+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Sleep_Out,
127+
// Sleep 20 ms
128+
(byte)GraphicDriverCommandType.Sleep, 2,
126129
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Normal_Display_On,
127130
// Sleep 10 ms
128131
(byte)GraphicDriverCommandType.Sleep, 1,
@@ -136,8 +139,50 @@ public static GraphicDriver GraphicDriver
136139
},
137140
OrientationLandscape = new byte[]
138141
{
142+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.NOP,
143+
// Sleep 20 ms
144+
(byte)GraphicDriverCommandType.Sleep, 2,
145+
(byte)GraphicDriverCommandType.Command, 2, (byte)ILI9341_CMD.Memory_Access_Control, (byte)(ILI9341_Orientation.MADCTL_MV | ILI9341_Orientation.MADCTL_BGR),
146+
// Sleep 20 ms
147+
(byte)GraphicDriverCommandType.Sleep, 2,
148+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Memory_Write,
149+
// Sleep 20 ms
150+
(byte)GraphicDriverCommandType.Sleep, 2,
151+
},
152+
OrientationLandscape180 = new byte[]
153+
{
154+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.NOP,
155+
// Sleep 20 ms
156+
(byte)GraphicDriverCommandType.Sleep, 2,
139157
(byte)GraphicDriverCommandType.Command, 2, (byte)ILI9341_CMD.Memory_Access_Control, (byte)(ILI9341_Orientation.MADCTL_MY | ILI9341_Orientation.MADCTL_MX | ILI9341_Orientation.MADCTL_MV | ILI9341_Orientation.MADCTL_BGR),
140-
},
158+
// Sleep 20 ms
159+
(byte)GraphicDriverCommandType.Sleep, 2,
160+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Memory_Write,
161+
// Sleep 20 ms
162+
(byte)GraphicDriverCommandType.Sleep, 2, },
163+
OrientationPortrait = new byte[]
164+
{
165+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.NOP,
166+
// Sleep 20 ms
167+
(byte)GraphicDriverCommandType.Sleep, 2,
168+
(byte)GraphicDriverCommandType.Command, 2, (byte)ILI9341_CMD.Memory_Access_Control, (byte)(ILI9341_Orientation.MADCTL_MX | ILI9341_Orientation.MADCTL_BGR),
169+
// Sleep 20 ms
170+
(byte)GraphicDriverCommandType.Sleep, 2,
171+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Memory_Write,
172+
// Sleep 20 ms
173+
(byte)GraphicDriverCommandType.Sleep, 2, },
174+
OrientationPortrait180 = new byte[]
175+
{
176+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.NOP,
177+
// Sleep 20 ms
178+
(byte)GraphicDriverCommandType.Sleep, 2,
179+
(byte)GraphicDriverCommandType.Command, 2, (byte)ILI9341_CMD.Memory_Access_Control, (byte)(ILI9341_Orientation.MADCTL_MY | ILI9341_Orientation.MADCTL_BGR),
180+
// Sleep 20 ms
181+
(byte)GraphicDriverCommandType.Sleep, 2,
182+
(byte)GraphicDriverCommandType.Command, 1, (byte)ILI9341_CMD.Memory_Write,
183+
// Sleep 20 ms
184+
(byte)GraphicDriverCommandType.Sleep, 2,
185+
},
141186
PowerModeNormal = new byte[]
142187
{
143188
(byte)GraphicDriverCommandType.Command, 3, (byte)ILI9341_CMD.POWER_STATE, 0x00, 0x00,

0 commit comments

Comments
 (0)