Johan Kritzinger / Mbed 2 deprecated FRDMKL25Z-ShiftBrite

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

movie Class Reference

movie Class Reference

movie class Used to send multiple frames of data to the Shiftbrite display. More...

#include <movie.h>

Public Member Functions

 movie (unsigned short int *movie_p, shiftBriteDisplay &display, unsigned int movieSize)
 constructor.
void play ()
 Used to play through a data 'movie' array, one frame each time this member function is called.

Detailed Description

movie class Used to send multiple frames of data to the Shiftbrite display.

It does not inherit anything but does use a reference to a shiftBriteDisplay object. Example:

        #include "mbed.h"
        #include "sbDriver.h"
        #include "movie.h"

        //6 leds example. Format it suitably for easy reading
        unsigned short int aMovie[] = {

        // LED1      LED2      LED3      LED4      LED5      LED6 
        1023,0,0,    0,0,0,    0,0,0,    0,0,0,    0,0,0,    0,0,0,     //Frame 0
            0,0,0, 1023,0,0,    0,0,0,    0,0,0,    0,0,0,    0,0,0,     //Frame 1
            0,0,0,    0,0,0,    1023,0,0, 0,0,0,    0,0,0,    0,0,0,     //Frame 2
            0,0,0,    0,0,0,    0,0,0,    1023,0,0, 0,0,0,    0,0,0,     //Frame 3
            0,0,0,    0,0,0,    0,0,0,    0,0,0,    1023,0,0, 0,0,0,     //Frame 4
            0,0,0,    0,0,0,    0,0,0,    0,0,0,    0,0,0,    1023,0,0,  //Frame 5
            0,0,0,    0,0,0,    0,0,0,    0,0,0,    1023,0,0, 0,0,0,     //Frame 6
            0,0,0,    0,0,0,    0,0,0,    1023,0,0, 0,0,0,    0,0,0,     //Frame 7
            0,0,0,    0,0,0,    1023,0,0, 0,0,0,    0,0,0,    0,0,0,     //Frame 8
            0,0,0, 1023,0,0,    0,0,0,    0,0,0,    0,0,0,    0,0,0      //Frame 9
        //A simple 'cylon' scanner 'movie'    
        };
    
        Serial PC(PTA2, PTA1);//

        //Instanced of DigitalOut for control SB signals
        DigitalOut latch(PTC16);//010=latch
        DigitalOut enable(PTA13);//0= enabled
        DigitalOut reset(PTC12);
        //Instance of the SPI contoller for SB data
        SPI spi(PTD2,NC,PTD1);//PDT2 = MOSI=DATA. PDT1=CLK


        int main() {
    
            //Instanciate a ticker object to handle framerate updates for the SB display    
            Ticker t;

            //Instanciate a string of 6 sb modules and tell the driver object where the control/data pins are
            shiftBriteDisplay sbDisplay(&PC,latch, enable, reset, spi,6);

            movie myMovie(aMovie,sbDisplay,sizeof(aMovie));
            myMovie.setRepeat(1);
            t.attach(&myMovie,&movie::play,0.05);//Call movie() every 0.05 seconds.Beware, if you go too fast here the FRDM will crash

            while(1){
            }
        }

Definition at line 60 of file movie.h.


Constructor & Destructor Documentation

movie ( unsigned short int *  movie_p,
shiftBriteDisplay display,
unsigned int  movieSize 
)

constructor.

Definition at line 5 of file movie.cpp.


Member Function Documentation

void play (  )

Used to play through a data 'movie' array, one frame each time this member function is called.

Definition at line 19 of file movie.cpp.