Core Driver

The core driver includes basic functions to perform within the platform.

Data Structures

ATMO_3dFloatVector_t

Member Name Type
x float
y float
z float

ATMO_3dDoubleVector_t

Member Name Type
x double
y double
z double

ATMO_UUID_t

Member Name Type
data uint8_t
type ATMO_UUID_Type_t
endianness ATMO_ENDIAN_Type_t

ATMO_CORE_DeviceHandle_t

Member Name Type
type ATMO_DriverType_t

ATMO_Value_t

Member Name Type
type ATMO_DATATYPE
size unsigned int
data void *

ATMO_ListEntry_t

Member Name Type
data ATMO_Value_t *
next ATMO_ListEntry_t *

ATMO_List_t

Member Name Type
size uint8_t
head ATMO_ListEntry_t *

ATMO_Ability_Execute_Entry_t

Structure to be filled and pushed onto Ability Handler list. Generally, every loop, the main thread will check this list, empty it, and execute any abilities.

Member Name Type Description
abilityHandle ATMO_AbilityHandle_t The integer handle of the ability.
value ATMO_Value_t Any value that is to be passed along to the ability.

ATMO_Callback_Execute_Entry_t

Structure to be filled and pushed onto Callback Handler list. Generally, every loop, the main thread will check this list, empty it, and execute any abilities.

Member Name Type Description
callback ATMO_Callback_t The callback function to be executed
value ATMO_Value_t Any value that is to be passed along to the callback

ATMO_DriverInstanceData_t

Member Name Type
name const char *
initialized bool
instanceNumber ATMO_DriverInstanceHandle_t
argument void *

Type Definitions

Name Definition Description
ATMO_DriverInstanceHandle_t typedef uint8_t ATMO_DriverInstanceHandle_t  
ATMO_Callback_t typedef void(* ATMO_Callback_t) (void *value) Generic Atmosphere callback function. The argument is typically an
ATMO_ListEntry_t typedef struct ATMO_ListEntry_t ATMO_ListEntry_t  
ATMO_AbilityHandle_t typedef uint16_t ATMO_AbilityHandle_t  

Enumerations

enum ATMO_DATATYPE

Datatype stored in

Name Value
ATMO_DATATYPE_VOID 0x01u
ATMO_DATATYPE_CHAR 0x02u
ATMO_DATATYPE_BOOL 0x03u
ATMO_DATATYPE_INT 0x04u
ATMO_DATATYPE_UNSIGNED_INT 0x05u
ATMO_DATATYPE_FLOAT 0x06u
ATMO_DATATYPE_DOUBLE 0x07u
ATMO_DATATYPE_STRING 0x08u
ATMO_DATATYPE_BINARY 0x09u
ATMO_DATATYPE_3D_VECTOR_FLOAT 0x0Au
ATMO_DATATYPE_3D_VECTOR_DOUBLE 0x0Bu
ATMO_DATATYPE_LIST 0x0Cu
ATMO_DATATYPE_MAX  

enum ATMO_Status_t

Name Value
ATMO_Status_Success 0x00u
ATMO_Status_Fail 0x01u
ATMO_Status_NoInput 0x02u
ATMO_Status_InvalidInput 0x03u
ATMO_Status_OutOfMemory 0x04u
ATMO_Status_MissingSupport 0x05u

enum ATMO_CompareCondition_t

Name Value
ATMO_LESS_THAN  
ATMO_LESS_THAN_EQUAL  
ATMO_GREATER_THAN  
ATMO_GREATER_THAN_EQUAL  
ATMO_EQUAL  

enum ATMO_Operator_t

Name Value
ATMO_OPERATOR_ADD  
ATMO_OPERATOR_SUBTRACT  
ATMO_OPERATOR_MULTIPLY  
ATMO_OPERATOR_DIVIDE  

enum ATMO_DriverType_t

Name Value
ATMO_DRIVERTYPE_ADC 0x0
ATMO_DRIVERTYPE_BLE 0x1
ATMO_DRIVERTYPE_BLOCK 0x2
ATMO_DRIVERTYPE_CLOUD 0x3
ATMO_DRIVERTYPE_DATETIME 0x4
ATMO_DRIVERTYPE_FILESYSTEM 0x5
ATMO_DRIVERTYPE_GPIO 0x6
ATMO_DRIVERTYPE_HTTP 0x7
ATMO_DRIVERTYPE_I2C 0x8
ATMO_DRIVERTYPE_INTERVAL 0x9
ATMO_DRIVERTYPE_NFC 0xA
ATMO_DRIVERTYPE_PWM 0xB
ATMO_DRIVERTYPE_SPI 0xC
ATMO_DRIVERTYPE_UART 0xD
ATMO_DRIVERTYPE_WIFI 0xE
ATMO_DRIVERTYPE_CELLULAR 0xF

enum ATMO_ENDIAN_Type_t

Name Value
ATMO_ENDIAN_Type_Big  
ATMO_ENDIAN_Type_Little  

enum ATMO_UUID_Type_t

Name Value
ATMO_UUID_Type_Invalid 0
ATMO_UUID_Type_16_Bit 2
ATMO_UUID_Type_32_Bit 4
ATMO_UUID_Type_128_Bit 16

Functions

ATMO_Status_t ATMO_Init()

Initialize atmosphere core. Should not be called by users.

Return Type
ATMO_Status_t

ATMO_Status_t ATMO_Tick()

Process single tick in atmosphere core. Should not be called by users.

Return Type
ATMO_Status_t

ATMO_Status_t ATMO_AddCallbackExecute(ATMO_Callback_t callback, ATMO_Value_t *value)

Add a callback to the execution list

Parameter Direction Type
value in ATMO_Value_t *
callback in ATMO_Callback_t
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_AddAbilityExecute(ATMO_AbilityHandle_t abilityHandle, ATMO_Value_t *value)

Add ability to the execution list

Parameter Direction Type
value in ATMO_Value_t *
abilityHandle in ATMO_AbilityHandle_t
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_AddTickCallback(ATMO_Callback_t callback)

Add a callback to be executed every tick

Parameter Direction Type
callback in ATMO_Callback_t
Return Type
ATMO_Status_t

size_t ATMO_GetMaxValueSize(uint8_t numberOfTypes, size_t bufferSize, ATMO_DATATYPE *types)

This routine gets the max size in bytes of an ATMO_DATATYPE list

Parameter Direction Type
types in ATMO_DATATYPE *
bufferSize in size_t
numberOfTypes in uint8_t
Return Type
size_t

ATMO_Status_t ATMO_InitValue(ATMO_Value_t *value)

Parameter Direction Type
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueVoid(ATMO_Value_t *value)

Initialize an ATMO_Value_t to void

Parameter Direction Type
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueChar(ATMO_Value_t *value, char data)

Initialize an ATMO_Value_t to Char

Parameter Direction Type
data N/A char
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueBool(ATMO_Value_t *value, bool data)

Initialize an ATMO_Value_t to Boolean

Parameter Direction Type
data N/A bool
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueInt(ATMO_Value_t *value, int data)

Initialize an ATMO_Value_t to Integer

Parameter Direction Type
data N/A int
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueUnsignedInt(ATMO_Value_t *value, unsigned int data)

Initialize an ATMO_Value_t to Unsigned Integer

Parameter Direction Type
data N/A unsigned int
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueFloat(ATMO_Value_t *value, float data)

Initialize an ATMO_Value_t to Float

Parameter Direction Type
data N/A float
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueDouble(ATMO_Value_t *value, double data)

Initialize an ATMO_Value_t to Double

Parameter Direction Type
data N/A double
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueString(ATMO_Value_t *value, const char *str)

Initialize an ATMO_Value_t to String

Parameter Direction Type
str N/A const char *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueBinary(ATMO_Value_t *value, const void *data, unsigned int size)

Initialize an ATMO_Value_t to Binary Array

Parameter Direction Type
size N/A unsigned int
data N/A const void *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValue3dVectorFloat(ATMO_Value_t *value, ATMO_3dFloatVector_t *vector)

Initialize an ATMO_Value_t to 3D Float Vector.

Parameter Direction Type
vector N/A ATMO_3dFloatVector_t *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValue3dVectorDouble(ATMO_Value_t *value, ATMO_3dDoubleVector_t *vector)

Initialize an ATMO_Value_t to 3D Double Vector.

Parameter Direction Type
vector N/A ATMO_3dDoubleVector_t *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueList(ATMO_Value_t *value)

Initialize an empty list.

Parameter Direction Type
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListPushBack(ATMO_Value_t *list, ATMO_Value_t *value)

Push a value onto the list.

Parameter Direction Type
value N/A ATMO_Value_t *
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListPushFront(ATMO_Value_t *list, ATMO_Value_t *value)

Push a value onto the front of a list.

Parameter Direction Type
value N/A ATMO_Value_t *
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListPopBack(ATMO_Value_t *list, ATMO_Value_t **value)

You are responsible for freeing the value.

Parameter Direction Type
value N/A ATMO_Value_t **
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListPopFront(ATMO_Value_t *list, ATMO_Value_t **value)

You are responsible for freeing the value.

Parameter Direction Type
value N/A ATMO_Value_t **
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListGetSize(ATMO_Value_t *list, unsigned int *size)

Get the size of a list.

Parameter Direction Type
size N/A unsigned int *
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_ListGetIndex(ATMO_Value_t *list, unsigned int index, ATMO_Value_t **value)

This does not pop the value from the list.

Parameter Direction Type
value N/A ATMO_Value_t **
index N/A unsigned int
list N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueConverted(ATMO_Value_t *newValue, ATMO_DATATYPE type, ATMO_Value_t *convertValue)

Convert ATMO_Value_t from one datatype to another

Parameter Direction Type
convertValue N/A ATMO_Value_t *
type N/A ATMO_DATATYPE
newValue N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CreateValueCopy(ATMO_Value_t *newValue, ATMO_Value_t *oldValue)

Create a copy of ATMO_Value_t

Parameter Direction Type
oldValue N/A ATMO_Value_t *
newValue N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_PerformOperation(ATMO_Value_t *newValue, ATMO_Operator_t operation, float operand, ATMO_Value_t *oldValue)

Perform a mathematical operation on a value

Parameter Direction Type
oldValue N/A ATMO_Value_t *
operand N/A float
operation N/A ATMO_Operator_t
newValue N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_CompareValues(ATMO_Value_t *valueA, ATMO_Value_t *valueB, ATMO_CompareCondition_t condition, bool *result)

Compare value A to value B

Parameter Direction Type
result N/A bool *
condition N/A ATMO_CompareCondition_t
valueB N/A ATMO_Value_t *
valueA N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_FreeValue(ATMO_Value_t *value)

This routine free’s the data object from a value and then set’s it to a ATMO_VOID object

Parameter Direction Type
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetChar(ATMO_Value_t *value, char *output)

This routine retrieves a raw Character from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out char *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetBool(ATMO_Value_t *value, bool *output)

This routine retrieves a raw Bool from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out bool *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetInt(ATMO_Value_t *value, int *output)

This routine retrieves a raw Integer from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out int *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetUnsignedInt(ATMO_Value_t *value, unsigned int *output)

This routine retrieves a raw Unsigned Integer from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out unsigned int *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetFloat(ATMO_Value_t *value, float *output)

This routine retrieves a raw Float from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out float *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetDouble(ATMO_Value_t *value, double *output)

This routine retrieves a raw Double from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
output out double *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetString(ATMO_Value_t *value, char *buffer, unsigned int size)

This routine retrieves a raw String from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
size in unsigned int
buffer out char *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_GetBinary(ATMO_Value_t *value, void *buffer, unsigned int size)

This routine retrieves a raw Binary Array from an ATMO_Value_t It does any necessary data conversions

Parameter Direction Type
size in unsigned int
buffer out void *
value in ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_Get3dVectorFloat(ATMO_Value_t *value, ATMO_3dFloatVector_t *vector)

Initialize an ATMO_Value_t to 3D Float Vector.

Parameter Direction Type
vector N/A ATMO_3dFloatVector_t *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_Get3dVectorDouble(ATMO_Value_t *value, ATMO_3dDoubleVector_t *vector)

Initialize an ATMO_Value_t to 3D Double Vector.

Parameter Direction Type
vector N/A ATMO_3dDoubleVector_t *
value N/A ATMO_Value_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_StringToUuid(const char *str, ATMO_UUID_t *uuid, ATMO_ENDIAN_Type_t endianness)

Convert a string UUID (Eg. “ae23626b-f51b-4995-b735-90e4ee9ae1f1”) to binary data

Parameter Direction Type
endianness N/A ATMO_ENDIAN_Type_t
uuid out ATMO_UUID_t *
str in const char *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_UuidToString(const ATMO_UUID_t *uuid, char *str, unsigned int strBufLen)

Convert a UUID from binary data to a formatted string

Parameter Direction Type
strBufLen in unsigned int
str out char *
uuid in const ATMO_UUID_t *
Return Type
ATMO_Status_t

ATMO_Status_t ATMO_DelayMillisecondsNonBlock(unsigned int milliseconds)

Delay for N milliseconds, calling ATMO_Tick every once in awhile to simulate non-blocking behavior Should not be used for any sort of exact timing.

Parameter Direction Type
milliseconds N/A unsigned int
Return Type
ATMO_Status_t

void ATMO_PrintBytes(uint8_t *bytes, uint32_t len)

Print byte array to debug output.

Parameter Direction Type
len N/A uint32_t
bytes N/A uint8_t *
Return Type
void