You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
#ifndef _IDIBUS_SLAVE_H_
|
|
#define _IDIBUS_SLAVE_H_
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#include <inttypes.h>
|
|
#include <avr/io.h>
|
|
#include "config.h"
|
|
#include "idibus_hw.h"
|
|
//=============================================================================
|
|
// DEVICE DEFINITIONS
|
|
// Add your devices here: ADC, Counter, 1wire, etc. Naming doesn't matter
|
|
// Share enums and defines with MASTER CODE
|
|
//=============================================================================
|
|
#define IDIBUS_XXX_NAME_CH_NUM 4
|
|
|
|
//Add commands to the slave
|
|
enum
|
|
{
|
|
XXX_NAME_DUMMY_CMD,
|
|
XXX_NAME_GET_CMD,
|
|
XXX_NAME_SET_CMD,
|
|
XXX_NAME_STATUS_CMD,
|
|
};
|
|
//Enumerate all devices attached
|
|
enum
|
|
{
|
|
XXX_NAME_DEV,
|
|
XXX_NAME_DEVICES_NUMBER
|
|
};
|
|
|
|
//Place custom ERR codes here
|
|
enum
|
|
{
|
|
XXX_NAME_OK = 0,
|
|
XXX_NAME_NO_DATA, //No data from XXX
|
|
XXX_NAME_OUT_OF_BOUNDS, //Data is out of MIN/MAX
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t status;
|
|
//Place your custom struct for data here
|
|
uint8_t ch_data;
|
|
}XXX_NAME_channel_data_t;
|
|
|
|
extern XXX_NAME_channel_data_t XXX_NAME_channels_data[];
|
|
void SlaveInit();
|
|
void SlaveLoop();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif |