Report
2 years, 9 months ago.

Where is there a copy of the DAL calls that I can use in C?

Having now got small programs working, I am looking for a copy of the reference guide to the microbit DAL, i.e. the C calls that access the hardware. I can find lots of references to its existence, but no link to the actual material. I need to know the calls to read and set digital i/o, read the timer, read the accelerometer, etc. I get as far as a Lancaster page that then says Access Denied. I would expect a simple reference list with the call parameters specified.

I have a need to help a sixth-former produce a simple program to measure a time interval between events, and we need C for speed. But the obvious documentation seems hard to find. I might be missing it so if it is obvious to you then I apologise but I'm just going round in circles.

Help!

Stuart

Comment on this question

2 Answers

2 years, 9 months ago.

You mean the HAL ones. Also the C++ overhead is generally pretty minor. Okay there are some exceptions, but generally the issue is more in the C files, for example for the NRF it needs to do calculations to get the 32-bit timestamps mbed expects, and this is with an M0 not very fast. However these are done in the C layer.

Anyway here you got the HAL header files: https://github.com/ARMmbed/mbed-os/tree/master/hal

And here the implementation for your device: https://github.com/ARMmbed/mbed-os/tree/master/targets/TARGET_NORDIC/TARGET_MCU_NRF51822

Edit: Guess I was unaware there was also something like the DAL :).

2 years, 9 months ago.

Hi Stuart,

It sounds like you're looking for this: https://lancaster-university.github.io/microbit-docs/ - I usually find it via the DAL code at https://github.com/lancaster-university/microbit-dal. Does that fit the bill?

There are some examples for using it here: https://developer.mbed.org/teams/microbit/

This is the official micro:bit DAL documentation. The DAL is C++ and you mention "C for speed" but I guess you're meaning "something lower level than the high level languages like C or C++ for speed" - if you really need C, let us know!

I'd like to make sure we signpost this well enough - so do you mind letting us know where you looked but didn't find it - perhaps we can put some better links in.

Thanks Jonny

Thanks guys. I'm still struggling, as I find there are many alternative ways of doing things, which overlap and aren't easy to distinguish (yotta/mbed/js/DAL/HAL/ubit etc.etc.) when all I want is a simple way of extending a basic C prog like Hello World, to access other peripherals using the mbed compiler. I want something fast (so I can measure short time intervals). C with a high level library, compiled, seems perfect.

I think for the benefit of those wanting to transition to microbit from other platforms, who want to use a fast compiled system rather than an interpreted one, and who just want it to work rather than go on a learning odyssey, you could make a simple tutorial. At the moment there seems to be a lot of almost trivial intro stuff, and then links straight into github or elsewhere with no explanation and no middle ground.

I would like to have (and therefore I guess others would too), something that started with say Hello World but then rather than basically saying "get on with it" and sending you somewhere else, just expanded that example with reference info to the other calls. Then we could expand our programs progressively and soon get into the swing of these tools. Instead, we have ..

Starting from https://developer.mbed.org/platforms/Microbit/, the mbed microbit page says: "Lancaster University have prepared *full documentation* and a *getting started guide* ". Both links get you to the same place: https://lancaster-university.github.io/microbit-docs/online-toolchains/ (the former via an online development tools link). Then you get another Hello World example, and for more info, a link to " Lancaster-University team wiki on mbed" . Then you get "Access Denied"!

The github links don't seem to include a library reference guide.

So where is the ubit reference that explains ubit.display.scroll(" ") and all the other calls in the ubit library in one document? With that I think I can produce stuff quickly.

Having written in most programming languages over many years, but most recently developing simple automation using Picaxe, I do appreciate how hard it can be to document complex things in a simple form, but also how good it can be when it is done well. If every Year 7 in the UK has a microbit, you can be sure some of them are soon going to push the boundaries beyond what they have already done at primary school. At my Code Club they learn Scratch, html, and python and some Picaxe code, so compiled C/C++ isn't much of a stretch for the most able.

cheers

Stuart

posted by Stuart Gillies 06 Oct 2016

Thanks, this is useful feedback and we'll look at trying to make the flows clear. I've just been through and done a few things:

I think we should probably use that as the main page when linking back to mbed from the Lancaster docs, rather than the Lancaster University team wiki page - I'll talk to the Lancaster team about what they'd prefer.

Finally - I think the library reference you were looking for can be found by the top navigation bars on the github docs site. Is that all rendering right for you? For example click on the 'uBit' menu to see the other components? like https://lancaster-university.github.io/microbit-docs/ubit/serial/ or https://lancaster-university.github.io/microbit-docs/ubit/io/

I hope those changes help!

posted by Jonathan Austin 08 Oct 2016

To post an answer, please log in.