Brought over the files from the Freescale site and modified for mbed.

This code is only partially working for me. Not every download seems to be successful on Mac OS X. I just took the example files and hacked them around to get it working with mbed. If you want working code I think Erik Olieman's SLCD project is probably a better source.

main.cpp

//KL46Z try out
#include "mbed.h"
#include "TSISensor.h"
#include "MMA8451Q.h"
#include "MAG3110.h"
#include "vfnLCD.h"
#include <cstdlib>
#include <iostream>

Serial pc(USBTX, USBRX);

TSISensor tsi;
MMA8451Q acc51(PTE25, PTE24, 0x1D<<1);
MAG3110 mag(PTE25, PTE24, 0x0E<<1);
vfnLCD lcd;

PwmOut rled(PTE29);
PwmOut gled(PTD5);
AnalogIn lightSensor(PTE22);
//DigitalIn SW1(PTC3);
//DigitalIn SW3(PTC12);
//AnalogOut lcd03(PTB23);
//PwmOut lcd07(PTB7);

char chBufDisp[10];

int main()
{
    using namespace std;

    float onTime = 1.0;
    float offTime = 0.0;
    float holdTime = 1.0;
    bool on = true;
    bool off = false;
    int magX = 0, magY = 0, magZ = 0;
    int count=100;
 
    uint8_t message[]="1234";
    lcd.vfnLCD_All_Segments_ON();     

    while(true) {  
        cout << "I'm alive and running\n\r";              
        rled = onTime - abs(acc51.getAccX());
        gled = onTime - abs(acc51.getAccY());
        mag.getValues(&magX, &magY, &magZ);
        
        cout << "MMA8451: " << acc51.getAccX() << "\t" << acc51.getAccY() << "\t" << acc51.getAccZ() << "\n\r" << endl;
        cout << "MAG3110: " << magX << "\t" << magY << "\t" << magZ << "\n\r" << endl;
        cout << "MAG3110: " << mag.getHeading() << "\n\r" << endl;
        wait(holdTime);
        
        rled = tsi.readPercentage();
        gled = tsi.readPercentage();
        
        cout << "Touch: " << tsi.readPercentage() << "\n\r" << endl;
        cout << "SW1: " << SW1 << "\n\r" << endl;
        cout << "SW3: " << SW3 << "\n\r" << endl;
        cout << "Light Sensor: " << lightSensor << "\n\r" << endl;
        sprintf(chBufDisp,"%04i",count);
        lcd.vfnLCD_Write_Msg((uint8_t *)chBufDisp);
        count++;
        if (count>9999) count=0;
        wait(holdTime);
    }
    return 0;
}

Committer:
highroads
Date:
Mon Jan 13 22:32:43 2014 +0000
Revision:
0:c5fea5b6b339
Partially working version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
highroads 0:c5fea5b6b339 1 /*
highroads 0:c5fea5b6b339 2 Following table indicate how LCD_WF are logically organized to Chars(columns in the LCD)
highroads 0:c5fea5b6b339 3 Char1 (LCD physical position) to LCD_WF (offset)
highroads 0:c5fea5b6b339 4 This table is used by WriteChar function to write the character/column to appropriate place
highroads 0:c5fea5b6b339 5 Char1 is Defined in LCDHDW.h
highroads 0:c5fea5b6b339 6
highroads 0:c5fea5b6b339 7 Following Table is used
highroads 0:c5fea5b6b339 8 1) indicate how WF are organized with
highroads 0:c5fea5b6b339 9 2) LCD_Px in this table will be enabled
highroads 0:c5fea5b6b339 10 3) LCD_Px after _LCDFRONTPLANES will be configured as backplanes and initialized as 0x01, 0x02, etc.
highroads 0:c5fea5b6b339 11 */
highroads 0:c5fea5b6b339 12
highroads 0:c5fea5b6b339 13 #include "LCDConfig.h"
highroads 0:c5fea5b6b339 14
highroads 0:c5fea5b6b339 15 const uint8_t WF_ORDERING_TABLE[ ] =
highroads 0:c5fea5b6b339 16 {
highroads 0:c5fea5b6b339 17 CHAR1a, // LCD81 --- Pin:5 LCDnAddress=51
highroads 0:c5fea5b6b339 18 CHAR1b, // LCD82 --- Pin:6 LCDnAddress=52
highroads 0:c5fea5b6b339 19 CHAR2a, // LCD83 --- Pin:7 LCDnAddress=53
highroads 0:c5fea5b6b339 20 CHAR2b, // LCD84 --- Pin:8 LCDnAddress=54
highroads 0:c5fea5b6b339 21 CHAR3a, // LCD85 --- Pin:9 LCDnAddress=55
highroads 0:c5fea5b6b339 22 CHAR3b, // LCD86 --- Pin:10 LCDnAddress=56
highroads 0:c5fea5b6b339 23 CHAR4a, // LCD87 --- Pin:11 LCDnAddress=57
highroads 0:c5fea5b6b339 24 CHAR4b, // LCD88 --- Pin:12 LCDnAddress=58
highroads 0:c5fea5b6b339 25 CHARCOM0, // LCD77 --- Pin:1 LCDnAddress=4D
highroads 0:c5fea5b6b339 26 CHARCOM1, // LCD78 --- Pin:2 LCDnAddress=4E
highroads 0:c5fea5b6b339 27 CHARCOM2, // LCD79 --- Pin:3 LCDnAddress=4F
highroads 0:c5fea5b6b339 28 CHARCOM3, // LCD80 --- Pin:4 LCDnAddress=50
highroads 0:c5fea5b6b339 29 };
highroads 0:c5fea5b6b339 30
highroads 0:c5fea5b6b339 31 /*
highroads 0:c5fea5b6b339 32 Ascii to 8x6 dot matrix decodification table
highroads 0:c5fea5b6b339 33 */
highroads 0:c5fea5b6b339 34 const char ASCII_TO_WF_CODIFICATION_TABLE [ ] =
highroads 0:c5fea5b6b339 35 {
highroads 0:c5fea5b6b339 36 ( SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 0, offset=0
highroads 0:c5fea5b6b339 37 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = 1, offset=4
highroads 0:c5fea5b6b339 38 ( SEGD+ SEGE+!SEGF+ SEGG) , (!SEGC+ SEGB+ SEGA) ,//Char = 2, offset=8
highroads 0:c5fea5b6b339 39 ( SEGD+!SEGE+!SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 3, offset=12
highroads 0:c5fea5b6b339 40 (!SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = 4, offset=16
highroads 0:c5fea5b6b339 41 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = 5, offset=20
highroads 0:c5fea5b6b339 42 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = 6, offset=24
highroads 0:c5fea5b6b339 43 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 7, offset=28
highroads 0:c5fea5b6b339 44 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 8, offset=32
highroads 0:c5fea5b6b339 45 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = 9, offset=36
highroads 0:c5fea5b6b339 46 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = :, offset=40
highroads 0:c5fea5b6b339 47 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = ;, offset=44
highroads 0:c5fea5b6b339 48 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = <, offset=48
highroads 0:c5fea5b6b339 49 ( SEGD+!SEGE+!SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = =, offset=52
highroads 0:c5fea5b6b339 50 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = >, offset=56
highroads 0:c5fea5b6b339 51 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ?, offset=60
highroads 0:c5fea5b6b339 52 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = @, offset=64
highroads 0:c5fea5b6b339 53 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = A, offset=68
highroads 0:c5fea5b6b339 54 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = B, offset=72
highroads 0:c5fea5b6b339 55 ( SEGD+ SEGE+ SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = C, offset=76
highroads 0:c5fea5b6b339 56 ( SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = D, offset=80
highroads 0:c5fea5b6b339 57 ( SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = E, offset=84
highroads 0:c5fea5b6b339 58 (!SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = F, offset=88
highroads 0:c5fea5b6b339 59 ( SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = G, offset=92
highroads 0:c5fea5b6b339 60 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = H, offset=96
highroads 0:c5fea5b6b339 61 (!SEGD+!SEGE+!SEGF+!SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = I, offset=100
highroads 0:c5fea5b6b339 62 ( SEGD+ SEGE+!SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = J, offset=104
highroads 0:c5fea5b6b339 63 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = K, offset=108
highroads 0:c5fea5b6b339 64 ( SEGD+ SEGE+ SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = L, offset=112
highroads 0:c5fea5b6b339 65 (!SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = M, offset=116
highroads 0:c5fea5b6b339 66 (!SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = N, offset=120
highroads 0:c5fea5b6b339 67 ( SEGD+ SEGE+!SEGF+ SEGG) , ( SEGC+!SEGB+!SEGA) ,//Char = O, offset=124
highroads 0:c5fea5b6b339 68 (!SEGD+ SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = P, offset=128
highroads 0:c5fea5b6b339 69 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+ SEGB+ SEGA) ,//Char = Q, offset=132
highroads 0:c5fea5b6b339 70 (!SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+ SEGB+ SEGA) ,//Char = R, offset=136
highroads 0:c5fea5b6b339 71 ( SEGD+!SEGE+ SEGF+ SEGG) , ( SEGC+!SEGB+ SEGA) ,//Char = S, offset=140
highroads 0:c5fea5b6b339 72 ( SEGD+ SEGE+ SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = T, offset=144
highroads 0:c5fea5b6b339 73 ( SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = U, offset=148
highroads 0:c5fea5b6b339 74 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = V, offset=152
highroads 0:c5fea5b6b339 75 (!SEGD+ SEGE+ SEGF+!SEGG) , ( SEGC+ SEGB+!SEGA) ,//Char = W, offset=156
highroads 0:c5fea5b6b339 76 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = X, offset=160
highroads 0:c5fea5b6b339 77 (!SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = Y, offset=164
highroads 0:c5fea5b6b339 78 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = Z, offset=168
highroads 0:c5fea5b6b339 79 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = [, offset=172
highroads 0:c5fea5b6b339 80 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = \, offset=176
highroads 0:c5fea5b6b339 81 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ], offset=180
highroads 0:c5fea5b6b339 82 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ^, offset=184
highroads 0:c5fea5b6b339 83 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = _, offset=188
highroads 0:c5fea5b6b339 84 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = `, offset=192
highroads 0:c5fea5b6b339 85 };