openledrace/lib/Openledrace-lib/olr-controller.h

60 lines
1 KiB
C

#ifndef _OLR_CONTROLLER_LIB_h
#define _OLR_CONTROLLER_LIB_h
#ifdef __cplusplus
extern "C"{
#endif
#include "Arduino.h"
#include <stdint.h>
#include <stdbool.h>
#define DIG_CONTROL_1 A0 // switch player 1 to PIN and GND
#define DIG_CONTROL_2 A2 // switch player 2 to PIN and GND
#define DIG_CONTROL_3 A1 // switch player 3 to PIN and GND
#define DIG_CONTROL_4 A3 // switch player 4 to PIN and GND
#define PIN_VCC_ADC1 6
#define PIN_VCC_ADC2 7
enum ctr_type{
NOT_DEFINED = 0,
DIGITAL_MODE,
ANALOG_MODE,
DEBUG_MODE,
};
typedef struct{
enum ctr_type mode;
int pin;
int adc;
int badc;
int delta_analog;
byte flag_sw;
}controller_t;
void setup_controller( void );
void init_controller( controller_t* ct, enum ctr_type mode, int pin );
byte get_controllerStatus( controller_t* ct );
float get_controller( controller_t* ct );
float get_accel ( void );
bool control_isActive( int pin );
#ifdef __cplusplus
} // extern "C"
#endif
#endif