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:
48:bc531288c220
Parent:
44:0862bc49ffa7
Child:
53:7b15fe4c9edf

File content as of revision 48:bc531288c220:

#pragma once
#define VALEURFLEX 0

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

enum GameMode_e { GUNNER, RPS, AirGuitar, WAITING, TEST};

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;

typedef struct {
    bool index;
    bool majeur;
    bool annulaire;
#if VALEURFLEX
    unsigned short indexU32;
    unsigned short majeurU32;
    unsigned short annulaireU32;
#endif
} flex_t;

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;
};

typedef struct flex_range_t
{
    unsigned short min_index;
    unsigned short max_index; 
    unsigned short min_majeur;
    unsigned short max_majeur;
    unsigned short min_annulaire;
    unsigned short max_annulaire;
    unsigned short limit_index;
    unsigned short limit_majeur;
    unsigned short limit_annulaire;
    
    flex_range_t() : 
        min_index(0xFFFF),
        max_index(0x0000),
        min_majeur(0xFFFF),
        max_majeur(0x0000),
        min_annulaire(0xFFFF),
        max_annulaire(0x0000),
        limit_index(0x0000),
        limit_majeur(0x000),
        limit_annulaire(0x0000)
    {
    }
} flex_range_t;