/* include header files for the framework and this service
//include needed service header files
//include shared definitions
/*----------------------------- Global and module-level variable declarations
-----------------------------*/ //stores which lights are currently on (1) or off (0). Initialize assuming all lights are off.
//init:// initializes the service (the priority, I/O port, etc.)
//Initialize the port clock //enable the port clock for the LEDport //wait until the LEDport clock is initialized to proceed // Initialize the Data, Shift, and Register pins as digital outputs // enable Data, Shift, and Register pins on port F as digital I/Os // specify that the Data, Shift, and Register pins are an output (high = output)
//turns on all lights indicated with a 1 in the passed in byte
// turn on the LEDS//shift the new LED byte into the shift registers
//turns off all lights indicated with a 1 in the passed in byte
// Shift register function
//loop variable, represents number of passed in bits at end of current loop //amount to shift to get MSB to LSB position // save a local copy //turn register (store) low before shifting in data //create a mask to isolate the MSB in our 8-bit input NewValue //will store the MSB, which will be shifted out // shift out the data while pulsing the serial clock // pass in a bit to the SR for each value of i // Isolate the MSB of localRegisterImage, put it into the LSB position and output //get the current MSB //printf("MSB: %d", MSB); //if the current MSB was LO //turn Data LO //if the current MSB was HI //turn Data HI //put SCLK HI //put SCLK LO //shift the bits left so we have a new MSB