Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
actuatordemo.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cascoda-bm/cascoda_evbme.h"
#include "cascoda-bm/cascoda_interface.h"
#include "cascoda-bm/cascoda_serial.h"
#include "cascoda-bm/cascoda_types.h"
#include "cascoda-util/cascoda_time.h"
#include "M2351.h"
#include "ca821x_api.h"
#include "cascoda_chili.h"
#include "cascoda_chili_gpio.h"
#include "cascoda_secure.h"
#include "gpio.h"
#include "openthread/cli.h"
#include "openthread/coap.h"
#include "openthread/instance.h"
#include "openthread/link.h"
#include "openthread/platform/settings.h"
#include "openthread/tasklet.h"
#include "openthread/thread.h"
#include "platform.h"
#include "cbor.h"
Include dependency graph for actuatordemo.c:

Classes

struct  actuator_details
 

Macros

#define ACTUATOR_BY_DEFAULT
 
#define MAX_ACTUATORS   6
 
#define ACTUATOR_UART_BAUDRATE   115200
 

Enumerations

enum  actuatordemo_state { ACTUATORDEMO_STOPPED = 0 , ACTUATORDEMO_ACTUATOR = 1 , ACTUATORDEMO_CONTROLLER = 2 }
 
enum  value_to_send { ACTUATOR_INFO = 0 , ACTUATOR_BRIGHTNESS = 1 , ACTUATOR_COLOUR_MIX = 2 , ACTUATOR_BOTH = 3 }
 

Functions

void handle_cli_actuatordemo (void *aContext, uint8_t aArgsLength, char *aArgs[])
 Process a CLI command to change the state of the actuator demo. More...
 
ca_error init_actuatordemo (otInstance *aInstance, struct ca821x_dev *pDeviceRef)
 Initialise the actuator demo. More...
 
ca_error handle_actuatordemo (struct ca821x_dev *pDeviceRef)
 Handle all actuatordemo functionality. More...
 

Variables

const char * uriCascodaDiscover = "ca/di"
 
const char * uriCascodaActuatorDiscoverQuery = "t=act"
 
const char * uriCascodaActuator = "ca/ac"
 
const char * uriCascodaKeepAlive = "ca/ka"
 
enum actuatordemo_state actuatordemo_state = ACTUATORDEMO_STOPPED
 
struct actuator_details actuators [MAX_ACTUATORS]
 
int64_t brightness = 0
 
int64_t colour_mix = 0
 

Macro Definition Documentation

◆ ACTUATOR_BY_DEFAULT

#define ACTUATOR_BY_DEFAULT

◆ ACTUATOR_UART_BAUDRATE

#define ACTUATOR_UART_BAUDRATE   115200

◆ MAX_ACTUATORS

#define MAX_ACTUATORS   6

Enumeration Type Documentation

◆ actuatordemo_state

Enumerator
ACTUATORDEMO_STOPPED 
ACTUATORDEMO_ACTUATOR 
ACTUATORDEMO_CONTROLLER 

◆ value_to_send

Enumerator
ACTUATOR_INFO 
ACTUATOR_BRIGHTNESS 
ACTUATOR_COLOUR_MIX 
ACTUATOR_BOTH 

Function Documentation

◆ handle_actuatordemo()

ca_error handle_actuatordemo ( struct ca821x_dev pDeviceRef)

Handle all actuatordemo functionality.

Should be called regularly by the program main loop.

Parameters
pDeviceRef- Pointer to initialised ca821x_device_ref struct.
Returns
CA_ERROR_SUCCESS for success.

◆ handle_cli_actuatordemo()

void handle_cli_actuatordemo ( void *  aContext,
uint8_t  aArgsLength,
char *  aArgs[] 
)

Process a CLI command to change the state of the actuator demo.

Should be linked to the openthread CLI using otCliSetUserCommands.

◆ init_actuatordemo()

ca_error init_actuatordemo ( otInstance *  aInstance,
struct ca821x_dev pDeviceRef 
)

Initialise the actuator demo.

Should be called once at program startup.

Parameters
aInstance- Pointer to an OpenThread instance.
pDeviceRef- Pointer to initialised ca821x_device_ref struct.
Returns
CA_ERROR_SUCCESS for success.

Variable Documentation

◆ actuatordemo_state

◆ actuators

struct actuator_details actuators[MAX_ACTUATORS]

◆ brightness

int64_t brightness = 0

◆ colour_mix

int64_t colour_mix = 0

◆ uriCascodaActuator

const char* uriCascodaActuator = "ca/ac"

◆ uriCascodaActuatorDiscoverQuery

const char* uriCascodaActuatorDiscoverQuery = "t=act"

◆ uriCascodaDiscover

const char* uriCascodaDiscover = "ca/di"

◆ uriCascodaKeepAlive

const char* uriCascodaKeepAlive = "ca/ka"