/***************************************************************************************************** * PIN LAYOUT * This file is used by other classes to define the pins used for the hardware. *****************************************************************************************************/ #ifndef CONFIGURATION_H #define CONFIGURATION_H #include <Arduino.h> /* Runtime Configuration */ #define DELAY 10 /* Debug Options */ #define DEBUG 0 /* Serial Options */ #define BAUDRATE 115200 #define PING '1' #define MOTORPING_ON '2' #define MOTORPING_OFF '3' /* =================================== */ /* Pin layout */ /* =================================== */ /* Motor Pins */ #define VIBRATION_PIN 28 #define NSLEEP_PIN 30 /* Potentiometer Pins */ #define POT0_PIN A3 #define POT1_PIN A4 /* LED Pins */ #define LED_BUILTIN 13 /* SWITCH Pins */ #define SWITCH_PIN1 51 #define SWITCH_PIN2 52 #define SWITCH_PIN3 53 /* ACCELEROMETER Pins */ #define XACC_PIN A0 #define YACC_PIN A1 #define ZACC_PIN A2 /* =================================== */ /* Resolution */ /* =================================== */ #define ADC_RES 1024 /* Buffer len */ #define DEFAULT_BUFFER_LEN 1280 #define COMBINATION_LEN 3 /* typedef union */ typedef struct { union { uint16_t pin_vals[3]; struct { uint16_t pin1_val; uint16_t pin2_val; uint16_t pin3_val; }; }; } uint16_vec; /* typedef union */ typedef struct { union { int vals[3]; struct { int val1; int val2; int val3; }; }; } int_vec; // Packed attribute specifies each member of the structure or union is placed // to minimize the memory required. // 1 byte is 16 bits // Size: 8 bytes + header bytes(2) + chksum byte + end bytes(2) typedef struct { uint16_vec dip_val; // dip switch val uint16_vec acc_val; // accelerometer val uint16_t pot_val; // potentiometer0 val uint16_t shaftpot_val; // potentiometer1 val uint16_t vm_val; // vibration motor out } __attribute__((__packed__)) int_packet; #endif