Projet_S5 / Mbed 2 deprecated Repo_Noeud_Mobile_refactor

Dependencies:   mbed-rtos mbed

Fork of Repo_Noeud_Mobile by Projet_S5

Structures/Structure.h

Committer:
llarose
Date:
2015-04-11
Revision:
53:7b15fe4c9edf
Parent:
48:bc531288c220
Child:
56:6af8f2c9ddbe

File content as of revision 53:7b15fe4c9edf:

#pragma once

typedef char GantsID;
typedef char GameID;
typedef char PlayerID;
typedef char SongID;
typedef char GameMode;

enum GameMode_e { GUNNER, RPS, AirGuitar, WAITING, TEST};
enum AirGuitar_opMode_e {PICK, FRET};
enum AirGuitar_note_e {DO, RE, MI, FA, SOL, LA, SI};

typedef struct {
    GameID  game;
    PlayerID     players[2];
    PlayerID    winner;
    int     score_winner;
    int         score_looser;
} Game_Stats;

typedef struct {
    uint16_t     x;
    uint16_t     y;
    uint16_t     z;
} Accel_t;

typedef struct {
    GameID  game;
    PlayerID    players;
    SongID     track_played;
} Game_Stats_AirGuitar;

struct flex_t{
    bool index;
    bool majeur;
    bool annulaire;
    
    bool operator !=(const flex_t& a)  
    {
        return( index != a.index && 
                majeur != a.majeur &&
                annulaire != a.annulaire
        );
    }
};



typedef struct {
    GameMode_e game;
} Fixe_Vers_Mobile;

typedef struct {
    GantsID     gants;
    Accel_t     accelData;    // donnée accéléromètre.
    flex_t      flexSensor;
} Mobile_Vers_Fixe;

// Mailbox data.
struct message_vers_fixe {
    Mobile_Vers_Fixe donnees;
};

struct message_vers_mobile {
    Fixe_Vers_Mobile donnees;
};