Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
#include "hardware.h"// Initialise the hardwarevoid appInitHardware(void) { initHardware();}// Initialise the softwareTICK_COUNT appInitSoftware(TICK_COUNT loopStart){ return 0;}// This is the main loopTICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) { // -------- Start Switch/Button------- // Switch/Button - see switch.h // To test if it is pressed then if(SWITCH_pressed(&button)){ // pressed } // To test if it is released then if(SWITCH_released(&button)){ // released } // -------- End Switch/Button------- // -------- Start Marquee------- // Marquee - see 'segled.h' // Before using the Marquee you need to redirect rprintf to write to it // This can be done using Writer old = rprintfInit(marqueeGetWriter(&marquee)); // All rprintf output will then be sent to the marquee but will not // display until an end-of-line eg "\n" has been sent. Example:- // rprintf("Hello World\n"); // If the endDelay is non-zero then the marquee will scroll // forever or until you call: marqueeStop(&marquee); // If the endDelay is zero then the marquee will stop once // the entire line has been shown ('one-shot' mode) // In 'one-shot' mode then you may want to make sure that // a previous line has finished before you display a second line. // This can be done as follows:- marqueeSetEndDelay(&marquee,0); // Make sure we are in one-shot mode if(marqueeIsActive(&marquee)==FALSE){ if(loopCount==1){ rprintf("HELLO WORLD\n"); }else{ rprintf("Loop=%u\n",(unsigned)loopCount); // Put the loop count } } // Restore rprintf back to its previous location rprintfInit(old); // -------- End Marquee------- rprintf("Hello World\n"); return 0;}