FRDM-KL25Z board with USBDevice-USBKEYBOARD Freezes when using ticker

30 Mar 2013

Does anyone have an idea why any time the ticker triggers it freezes when I am using the USBKeyboard.h?


#include "mbed.h"
#include "MMA8451Q.h"
#include "USBKeyboard.h"

#define D_SDA                  PTE0
#define D_SCL                  PTE1
#define D_BAUDRATE             9600
#define MMA8451_I2C_ADDRESS (0x1d<<1)

USBKeyboard keyboard;
I2C i2c(D_SDA, D_SCL);
MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
Serial pc(USBTX, USBRX); // tx, rx

Ticker sleepTimer;

DigitalOut redLed(LED_RED);
DigitalOut grnLed(LED_GREEN);
DigitalOut bluLed(LED_BLUE);

void goToSleep() 
    //>do some stuff<

int main()
    redLed = 1;
    grnLed = 1;
    bluLed = 1;
    MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
    sleepTimer.attach(&goToSleep, 20);
    while(1) {
//        >insert rest of code here<

Meant to post this here first....