Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DualShock.h
- Committer:
- kenboh
- Date:
- 2019-09-11
- Revision:
- 0:39a70e079270
File content as of revision 0:39a70e079270:
#ifndef DUALSHOCK_H_
#define DUALSHOCK_H_
#include "mbed.h"
#define BACKLASH 28
typedef struct st_ds {
union {
uint16_t ButtonData;
struct {
union {
uint8_t ButtonLowData :8;
struct {
uint8_t L2 :1;
uint8_t R2 :1;
uint8_t L1 :1;
uint8_t R1 :1;
uint8_t TRIANGLE :1;
uint8_t CIRCLE :1;
uint8_t CROSS :1;
uint8_t SQUARE :1;
};
};
union {
uint8_t ButtonHighData :8;
struct {
uint8_t SELECT :1;
uint8_t L3 :1;
uint8_t R3 :1;
uint8_t START :1;
uint8_t UP :1;
uint8_t RIGHT :1;
uint8_t DOWN :1;
uint8_t LEFT :1;
};
};
};
}BUTTON;
struct {
float LY;
float LX;
float RY;
float RX;
}ANALOG;
} tDSParm;
extern tDSParm hDS;
/*
if(hDS.BUTTON.L1)
if(-1<=hDS.ANALOG.LY<=1)*/
/**
* @brief Function to initialize the encoder
* @param mode see definition above
*/
extern uint8_t InitDS(Serial* f_serial);
extern void ReStartDS(void);
/**
* @brief Function to initialize the encoder
* @retval *pParm see definition above
*/
extern void getDSdata(void);
#endif /* DUALSHOCK_H_ */