Two code example files are presented below for operations on relatively common board hardware, including LEDs, preemptive multi-tasking, ADCs and PWM. These example files contain code for most MCUs on which this snapshot runs. They are updated versions of prior examples that use the integrated "system 0" functionality of snapshot 00.0250:
LCD libraries for the IDM-L35 and LPC2478-STK have been updated for this snapshot and a library for the STM32-LCD was developed:
ap> (load "lcdIDM35.scm" SDFT) ; for IDM-L35 (16-bit color) OR: ap> (load "lcdSTM32.scm" SDFT) ; for STM32-LCD (16-bit color) OR: ap> (load "lcd2478b.scm" SDFT) ; for LPC2478-STK (24-bit color) AND: ap> (libs) ; check for presence of (lcd output)After installation, the libraries can be imported, initialized and tested. The libraries offer similar functionality, except for the different number of color bits. As with other libraries, configuration should be performed only once, but initialization may be performed multiple times. The following example illustrates (adapted from prior snapshots, for library operation):
ap> (import (lcd output)) ; import the library ap> (lcd-config) ; configure LCD pins and lcop ap> (lcd-init) ; initialize the LCD ap> (display "HELLO!" lcop) ap> (fill 50 50 150 150 #xff) ap> (define ocop (current-output-port)) ; save the current output-port ap> (define (current-output-port) lcop) ; set default output to LCD ap> 100 ap> "WOWEE!"On the LPC-2478-STK there is still some interference between the DMA channel used by the SD card and the LCD display such that reading or writing from/to an SD card temporarily makes the display flicker (but does not appear to affect SD function). Bus scheduling was updated in the above LPC2478-STK example to reduce this effect.
Example code for touchscreen and accelerometer (if present) usage are presented in the files below: