The Embedded C Library:

  • is Implemented in C-Language
  • has Small footprint
  • is Easy to interface


The Open Source Library can be used in your Embedded Projects,

The Library will help you to setup your system as an Azande Target.

The Library also includes Embedded Macros that will help you with creation of your Features.




Downloads

Click here to access download of the Embedded C Library


Click here to access download of Example Projects using C Library


Library Files

Azande


config_examples


AzandeSystemConfig_AtMega328.h

Holds a number of #define that defines the interface between Azande and your System.

  • Copy the file you want to a location within your project.
  • Rename the file to AzandeSystemConfig.h
  • Edit properties if necessary.

More details here...

..


src


Azande.c

Core implementation of Azande.

Azande.h

Header file to be #include in your application code.

AzandeCrc.c

Internal CRC calculation.

AzandeCrc.h

Header file.

AzandeUserMacros.h

Holds all macros that will help you build your Feature. More details in Embedded Macros



How to Interface?






AzandeSystemConfig.h

The AzandeSystemConfig.h Holds a number of #define that defines the interface between Azande and your System.



#define MCU_IS_LITTLE_ENDIAN

You need to define how your target MCU is storing data (Endianness)  little-endian or big-endian.

Endianness refers to the sequential order in which bytes are arranged into larger numerical values when stored in memory or when transmitted over digital links.

#define MCU_IS_BIG_ENDIAN



#define READ_BUFFER_SIZE

This property defines how many bytes of RAM should be used as buffer when receiving messages.



#define AZANDE_MAX_COMMANDS

This define how many Features of the type Command you will need in your system. This is a Maximum-Allowed number.

#define AZANDE_MAX_EVENTS

This define how many Features of the type Event you will need in your system. This is a Maximum-Allowed number.



#define __FLASH_DIRECTIVE

Here you specifies the compiler/linker directive that will put constant data in flash/program memory. If you leave it empty, constant data will also occupy RAM.

Interfacing the Serial Channel


Read

In the function Azande__ReadStream() Serial Channel is polled. All available bytes are fetched and evaluated.

#define SerialAnyBytesToRead()

Should return 1 if the Serial Channel have data available for Read.

#define SerialReadNextByte(destination)

Reads next available byte from Serial Channel.



Write with a output queue


#define WriteOneByteQueued(BYTE)

Writes one byte to the Serial Channel. Argument type is uint8_t. Called when sending Feature Data Messages



Block Write: without an output queue


#define WriteOneByteBlocked(BYTE)

Writes one byte to the Serial Channel. Argument type is uint8_t. Called when sending Feature XML Definition

#define StartBlockWriting()

Called before sending all available XML Definitions in Discovery Process

#define StopBlockWriting()

Called after sending all available XML Definitions in Discovery Process



Write Configuration

Two types of messages are written to the Serial Channel

Because of the differences of the two message types two different write-macros are defined.

Scenario 1: Block write all

Your system don't have any timing requirements and allows blocked writing.

In this scenario the Serial Channel don't need to implement any queue.


Configuration:

#define WriteOneByteQueued(BYTE)        Write_Blocked(BYTE)

#define WriteOneByteBlocked(BYTE)        Write_Blocked(BYTE)

#define StartBlockWriting()                // Not required

#define StopBlockWriting()                // Not required


Scenario 2: Serial Channel have a large queue

The Serial Channel queue is large enough to fit all XML definition.


Configuration:

#define WriteOneByteQueued(BYTE)        Write_Queued(BYTE)

#define WriteOneByteBlocked(BYTE)        Write_Queued(BYTE)

#define StartBlockWriting()                // Not required

#define StopBlockWriting()                // Not required


Scenario 3: Serial Channel with a smaller queue

The Serial Channel queue is not large enough to fit all XML definition, but large enough for Data Messages.

The XML definitions are sent with a blocked WRITE.


Configuration:

#define WriteOneByteQueued(BYTE)        Write_Queued(BYTE)

#define WriteOneByteBlocked(BYTE)        Write_Blocked(BYTE)

#define StartBlockWriting()                // optional

#define StopBlockWriting()                // optional


Interfacing with your application code

This is a list

  1. Add #include "Azande.h"
  2. Define your targetInfo object with the Embedded Macros
  3. Define your COMMAND and EVENT objects with the Embedded Macros
  4. @init call Azande__Init(targetInfo);
  5. @init (or later) call Azande__AddCommand(cmdXXX) for each Command you want to use
  6. @init (or later) call Azande__AddEvent(eventXXX) for each Event you want to use
  7. In main process (or on interrupt) call Azande__ReadStream(); approximately once every 10ms.


When you want to send an event call one of the following functions:

  • Azande__SendEventBool(...)
  • Azande__SendEventInt32(...)
  • Azande__SendEventDouble(...)
  • Azande__SendEventText(...)


At run time change collection of available Features

If your application changes and want to have another set of Features available for the user, do following:

  1. call  Azande__Clear(); This will clear the collection of Commands and Events
  2. call Azande__AddCommand(cmdXXX); for each Command you want to use
  3. call Azande__AddEvent(eventXXX); for each Event you want to use
  4. call Azande__Notify(); This will notify Azande Studio that the Feature Collection has changed. Azande Studio will now start a new Discovery Process.