Armmite L4: 5.05.05: Arcs & displays


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11974
Posted: 10:56am 10 Jan 2019      

Please find attached version 5.05.05 for the Armmite L4

2019-01-10_204755_ArmmiteL4.zip

This includes the following changes:
Added triangle command with array support - see H7 manual for syntax
Added ARC command - see H7 manual for syntax
Added Bezier command - see H7 manual for syntax
Added support for ST7789 display as in pictures

OPTION LCDPANEL ST7789, orientation, DCpin, RESETpin, CSpin


Added support for ST7735S display as per recent CFunction. NB: there appear to be two variants of this. I'll add support for the second variant when I have confirmed the initialisation differences

OPTION LCDPANEL ST7735S, orientation, DCpin, RESETpin, CSpin


Final decision to run single precision floating point on the L4. This saves a huge amount of flash memory for additional features and is faster. Applications that need double precision should use an alternative platform.

The triangle command is highly optimised when outputting to colour displays in order to allow flicker free updates to the screen as per the video

As there were reported issues I have bought a couple of HTU21D sensors and can confirm they work perfectly for me on the Armmite L4 using TassyJim's code

Video of demo code


Dim integer x1(1),y1(1),x2(1),y2(1),x3(1),y3(1)
Dim integer c(1)=(0,RGB(yellow)),c2(1)=(0,RGB(yellow))
Dim integer x1s,y1s,x2s,y2s,x3s,y3s
CLS
x1(1)=MM.HRes\2-6 :x1(0)=x1(1) :x1s=x1(0)
y1(1)=MM.VRes\2 :y1(0)=y1(1) :y1s=y1(0)
x2(1)=MM.HRes\2+6 :x2(0)=x2(1) :x2s=x2(0)
y2(1)=MM.VRes\2 :y2(0)=y2(1) :y2s=y2(0)
x3(1)=MM.HRes\2 :x3(0)=x3(1) :x3s=x3(0)
y3(1)=MM.VRes\2-75 :y3(0)=y3(1) :y3s=y3(0)
Arc MM.HRes\2,MM.VRes\2,99,101,210,150
Arc MM.HRes\2,MM.VRes\2,84,86,210,150
Arc MM.HRes\2,MM.VRes\2,86,99,210,90,RGB(green)
Arc MM.HRes\2,MM.VRes\2,86,99,90,150,RGB(red)
Pause 1000
rotatetriangle -150,MM.HRes\2, MM.VRes\2
Do
For i=-150 To 150
If(i>90)Then
c2(1)=RGB(red)
c(1)=RGB(yellow)
Else
c2(1)=RGB(yellow)
c(1)=RGB(red)
EndIf
rotatetriangle i,MM.HRes\2, MM.VRes\2
Triangle x1(),y1(),x2(),y2(),x3(),y3(),c(),c2()
Next i
For i=150 To -150 Step -1
If(i>90)Then
c2(1)=RGB(red)
c(1)=RGB(yellow)
Else
c2(1)=RGB(yellow)
c(1)=RGB(red)
EndIf
rotatetriangle i,MM.HRes\2, MM.VRes\2
Triangle x1(),y1(),x2(),y2(),x3(),y3(),c(),c2()
Next i
Loop

Sub rotatetriangle(angle As float, x As integer, y As integer)
Local float sine=Sin(Rad(angle)),cosine=Cos(Rad(angle))
Local integer x1a=x1s-x, y1a=y1s-y
Local integer x2a=x2s-x, y2a=y2s-y
Local integer x3a=x3s-x, y3a=y3s-y
x1(0)=x1(1):x2(0)=x2(1):x3(0)=x3(1)
y1(0)=y1(1):y2(0)=y2(1):y3(0)=y3(1)
x1(1)= x1a*cosine - y1a * sine + x
y1(1)= y1a*cosine + x1a * sine + y
x2(1)= x2a*cosine - y2a * sine + x
y2(1)= y2a*cosine + x2a * sine + y
x3(1)= x3a*cosine - y3a * sine + x
y3(1)= y3a*cosine + x3a * sine + y
End Sub

Edited by matherp 2019-01-11