Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Porting

Arjo Chakravarty edited this page Jan 24, 2014 · 7 revisions

All Arduino compatible boards work out of the box. The core requirements for processors is that there is more than 300 bytes of ram. If you do not have an Arduino compatible board there needs to be a lib-c and you need to replicate the analogRead function somewhere.

Porting to a new board

Ensure you have a port of lib-c to the platform. The lib-c should contain a working math.h implementation. The functions which depend on the Arduino platform are:

void signal::calibrate(){
    #ifdef ARDUINO_ENVIRONMENT > 0
        calib = (analogRead(pin)+analogRead(pin)+analogRead(pin)+analogRead(pin))/4; //acquire background noise
    #endif
}

and

void signal::sample(){
        int i = 0;
        while ( i < 32){
        #if ARDUINO_ENVIRONMENT > 0
                arr[i] = analogRead(pin)-calib;
        #endif
                i++;
        }
        
}

To disable dependency on Arduino library start by removing the following line in uSpeech.h.

#define ARDUINO_ENVIRONMENT 1

There are several ways of porting:

  • Port analogRead() functionality
  • Re-implement aforementioned methods
  • Inherit the signal class, reimplement aforementioned classes.
    The recommended method is #1 or #3.
Clone this wiki locally