glcd_ks0108mw.jal -- revised low level
graphics_mw.jal -- all the fancy graphics stuff
math_mw.jal -- start of a math library with existing sqrt copied
Eventually I'll get around to the svn thingy
Example usage
-- drop shadow 3D box with text in it at ANY pixel location on GLCD
-- can be bold or double size text
-- clips strings that don't fit
DrawButton (64, 11+39, 27, 11, MENU5_3, True)
-- do once
DrawClockFace(18,34,16, on)
-- you can only have ONE clock... as it has one set of global
variables
forever loop
if CheckTime > 0 then --semaphore incremented by RTC
interrupt.
if seconds > 59 then
calendar()
if clock_on then
If rigModeNow == RIGMODE_OFF then -- optionally
move the date
LCD_setcursor (9,1)
else
LCD_setcursor (0,7)
end if
print_byte_dec(lcd,date)
lcd ="/"
print_byte_dec(lcd,month)
lcd ="/"
print_word_dec(lcd,year)
lcd = " "
end if
end if
if clock_on then
DrawHands (off)
UpdateHands(hours, minutes, seconds)
DrawHands (on)
end if
CheckTime = CheckTime -1 -- use up the semaphore
if CheckTime == 0 then
-- suspend
end if
else
-- suspend
end if
end loop
-- doing VU or other signal meters?
DrawMeterFace(42, 18, 32, on)
-- you can have any number of meters at same time!
-- no side effects of globals
-- just make x, y and h the same for MeterNeedle and MeterFace
forever loop
-- do stuff
-- erase the meter needle
DrawMeterNeedle(42, 18, 33, smeter, off)
-- read new smeter value from someplace
DrawMeterNeedle(42, 18, 33, smeter, on )
-- do more stuff
end loop
clock and meters can be any size up to 128 pixels
only for 48MHz clock....
var volatile byte seconds -- updated by ISR
const POLL_INTERVAL = 1368 -- 350ms
const TICK_INIT = 12
const USER_INIT = 100
var volatile word userCount = USER_INIT -- debounce keys
var volatile byte ticks = TICK_INIT
var volatile word poll_count = POLL_INTERVAL -1
const RTC_LOW = 3096
const RTC_HIGH = 3097
var volatile word rtc_count = RTC_LOW -- should be 3906.25
var byte rtc_error = 0
-- every 21.333 us at 48MHz x 3 = 64us
-- x12 = 256 us = RDS oversample
-- radio poll is 350ms 1368 x 256 us = 350.208 ms
procedure RTC() is
pragma interrupt
INTCON_TMR0IF = off -- clear the timer 0 interrupt flag
ticks = ticks -1 -- 256us counter
if (ticks < 1) then
ticks = TICK_INIT
CheckRDS = CheckRDS +1
poll_count = poll_count -1
if (poll_count<1) then
poll_count = POLL_INTERVAL
CheckRadio = CheckRadio +1
end if
userCount = userCount -1
if userCount < 1 then
userCount = USER_INIT
checkUser = CheckUser +1
end if
rtc_count = rtc_count -1
if rtc_count < 1 then
rtc_error = rtc_error + 1
if rtc_error == 4 then
rtc_error = 0
rtc_count = RTC_HIGH
else
rtc_count = RTC_LOW
end if
seconds = seconds +1
checkTime = CheckTime +1
end if
end if
end procedure -- end of ISR
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.