Library Update - Features and Fixes


edit: updated to newer syntax

I said in the last library update that we were spending a lot of time (John in particular!) working on getting the foundations right. Well, it wasn't an excuse, and it is starting to pay off :) Here comes v6...

And yes, we now have RPC! This is an idea i've had floating around a long time, and in many prototypes, but is finally here in it's first official form...

 

#include "mbed.h" 
DigitalOut led(p1, "led"); 
int main() { 
        char result[64]; 
        rpc("/led/write,p1", result); 
        printf("%s\n", result); 
        rpc("/led/read", result); 
        printf("%s\n", result); 
} 

Remote-procedure call of mbed Interfaces! Of course, the fun part is that what generates the rpc strings is totally flexible. Hopefully there is much fun to be had here! In particular, the plan is to use the RPC to be able to control the mbed over any transport mechanism (serial, http, bluetooth, ...) form any language (python, javascript, teraterm, ...).

It is built so you can create objects remotely too (new/delete), and even make your own classes that plug in to the RPC :) I'll put more on http://mbed.co.uk/projects/cookbook/wiki/RPC.

But there is other stuff too! Here are the other things that made it in this release:

The Real-Time Clock is now functioning, and will run as long as there is power connected, either through one of the main power supplies, or through the 3.3v VB (Battery Backup) input, designed for a coin-cell battery. The standard C functions time() and friends work, and there are a couple of helper functions to simplify things; set_time() allows you to set it, and time_str() returns a string with a human readable time. Look in the api under RTC, and we'll also aim to put up some examples in the Cookbook.

AnalogIn and AnalogOut now support read_u16() and write_u16() methods. This should give a natural way to access analog interfaces when dealing with samples, and be faster. We haven't done any optimisation yet, so they will likely get even faster in time too...

The multiplier that Ticker and Timeout intervals were seeing of ~105% has now been fixed. I have a photo of a frequency generator to prove it! (but google doesn't let you attach them easily). They should now actually be able to time :)

A new function, mbedinfo(), can be called at any point and will dump out memory stats and other such stuff to stdout (USB serial port). This is useful just to check the state of memory etc, and is meant to be a similar dumping ground to how PHP uses phpinfo().

For debugging and error reporting, we'll be moving to using error(), and plain old printf(). For the techies, error() goes to stderr and then dies, and printf() goes to stdout, which in the default case means it appears on the USB serial. We'll be depricating the ugly DEBUG() and ERROR() functions.

And for completeness, here are the other notable features and fixes:

  • DigitalIn rise and fall interrupts can now attach object methods as well as static functions
  • Serial and SPI interfaces support specifying "Not Connected" (NC) on selected pins
  • p1-p4 now map to LED1-LED4, so you can just do "DigitalOut led(p1);" now
  • The Timer object was not reseting when reset() was called while running - FIXED
  • SPI format now uses a single mode parameter rather than seperate pol and pha
  • A prototype SPI3 class has crept in, which supports devices with a single bi-directional data pin

When you start a new project, you will automatically pull in the new mbed Library. For existing projects, clicking on the mbed library in your file tree should provide you with an "update" button. As ever, please bring to our attention any problems, questions or suggestions you have.

Have Fun! 
Simon

You need to log in to post a comment