In this tutorial we will go through basic concepts of firmware for BigClown ecosystem. We are going to learn how to install and to work with tools which allow us to work with the firmware. With the help of practical examples we will take a look at how to make various peripherals to work together with API from the BigClown SDK - further refrerred as SDK only.

Example Code

Toggling an LED on button press with the SDK is as easy as this code snippet:

#include <application.h>

// LED instance
bc_led_t led;

// Button instance
bc_button_t button;

void button_event_handler(bc_button_t *self, bc_button_event_t event, void *event_param)
{
    if (event == BC_BUTTON_EVENT_PRESS)
    {
        bc_led_set_mode(&led, BC_LED_MODE_TOGGLE);
    }
}

void application_init(void)
{
    // Initialize LED
    bc_led_init(&led, BC_GPIO_LED, false, false);
    bc_led_set_mode(&led, BC_LED_MODE_ON);

    // Initialize button
    bc_button_init(&button, BC_GPIO_BUTTON, BC_GPIO_PULL_DOWN, false);
    bc_button_set_event_handler(&button, button_event_handler, NULL);
}

Programming Language

Firmware is implemented in pure C language, which is industrially accepted language for embedded and low-power devices. There are the main reasons for choosing this technology:

  • Effecient use of hardware resources
  • Stability and long time available development environment
  • Simple and understandable syntax

You can choose from wide variety of systems and tools. Windows, macOS a Ubuntu (and other Debian derivatives) are supported. For information how to install required tools, please see Toolchain setup. You can find more information on how to use them in Toolchain guide.

Diving Deep to SDK

Basic pillar of every BigClown (software) project is an ecosystem of libraries, drivers and header files, the so-called BigClown SDK (which stands for Software Development Kit.

It can be found in this repository:

https://github.com/bigclownlabs/bc-core-module-sdk

The header files include documentation, that can be generated by Doxygen. You can find the most recent version of the generated documentation here:

https://sdk.bigclown.com/

We try to stick to these principles while working the SDK development:

  • Consistent and clear API design

  • Modular and object oriented approach

  • We prefer asynchronous, event-driven programming

  • Well-named functions, data types, variables, etc.

  • Simple way of access to low level hardware

SDK Integration

To your project, SDK is integrated as a Git Submodule. This has one advantage - your firmware can be "linked and locked" to a specific version of the SDK. This makes sure that it will be possible to compile your firmware at any time in the future. But if you need to, the SDK can be updated to most recent version by simple make update command.

Chapters in this document:
Edit this page