diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c5d2728 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: ci +on: + push: + branches: + - master + - main +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.x + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore index c05dc6d..097916f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ debug Debug/ site/* -out/* \ No newline at end of file +out/* diff --git a/Biblio/UML/class.puml b/Biblio/UML/class.puml index c09f470..31f0ce8 100644 --- a/Biblio/UML/class.puml +++ b/Biblio/UML/class.puml @@ -1,4 +1,4 @@ -@startuml +@startuml class class Joueur { + int32_t x + int32_t y diff --git a/Biblio/UML/threads.puml b/Biblio/UML/threads.puml index 7bcb4c3..cd0ed00 100644 --- a/Biblio/UML/threads.puml +++ b/Biblio/UML/threads.puml @@ -1,24 +1,61 @@ -@startuml Architecture projet +@startuml Architecture_projet +package "HAL" { interface "CAN Joystick" as CAN interface "Ecran" as LCD -interface "Ethernet" as ether +interface "GPIO" as gpio +interface "rng" as rng +} Queue "Queue_J\nchoc joueur" as Queue_J Queue "Queue_E\nchoc ennemie" as Queue_E Queue "Queue_F\nfin du jeu" as Queue_F Queue "Queue_N\nnouveau projectile" as Queue_N + +package "Varriables partagées" { +component "Table_ennemis" as table <> +component "joueur" as J <> +component "Charge" as charge <> +component "LCD" as mut_lcd <> +} + +package "Fonctions globales"{ +component "Probabilité" as proba <> +component "Encapsulation LCD" as emc_lcd <> +component "Remplissage ennemis" as rempli <> +component "Mise à jour des leds" as update_led <> +} component t_gm[ Thread : game_master === -T = 20 ms +Bloqué en attente de messages --- gère l'apparition des porjectiles, gère les autres Thread, fait l'affichage des scores ] + +component t_HUD[ +Thread : HUD +=== +T = 100 ms +--- +Affiche : +- La vie, +- Le numéro de la vague, +- Le nombre de monstre tué. +] + +component t_chargeur[ +Thread : Chargeur +=== +T = 5/8 s +--- +Incremente la charge +] + component t_j1[ Tread : joueur_1 === -T = 20 ms +T = 5 ms --- gère le joystick, la vie du joueur, @@ -28,14 +65,14 @@ et l'affichage du joueur component t_ennemie[ Tread : Ennemies === -T = 20 ms +T = 200 ms --- gère les ennemies ] component t_proj[ Tread : projectile === -T = 20 ms +T = 10 ms --- gère les projectiles gère les colisions @@ -52,15 +89,39 @@ Queue_F --> [t_gm] [t_j1] --> Queue_N : nouveau tire des ennemie Queue_N --> [t_proj] -[t_j1] --( LCD -[t_ennemie] --( LCD -[t_proj] --( LCD -[t_gm] --( LCD +[t_j1] ..> emc_lcd : use +[t_ennemie] ..> emc_lcd : use +[t_proj] ..> emc_lcd : use +[t_gm] ..> emc_lcd : use -[t_gm] --( ether +emc_lcd .> mut_lcd : use +emc_lcd --( LCD [t_gm]..>[t_j1] : suspend [t_gm]..>[t_ennemie] : suspend [t_gm]..>[t_proj] : suspend +[t_j1] ..> J : ecris +[t_ennemie] ..> table : ecris +[t_proj] ..> J : lis +[t_proj] ..> table : lis + +t_gm ..> rempli : use +rempli ..> table : ecris +rempli ..> proba : use + +t_ennemie ..> proba : use + +t_j1 ..> charge : lis/ecrit +t_chargeur ..> charge : lis/ecrit + +t_j1 ..> update_led : use +t_chargeur ..> update_led : use + +t_j1 --( gpio +update_led --( gpio + +t_HUD ..> emc_lcd : use + +proba --( rng @enduml diff --git a/Core/Inc/ennemi_b.h b/Core/Inc/ennemi_b.h new file mode 100644 index 0000000..9768670 --- /dev/null +++ b/Core/Inc/ennemi_b.h @@ -0,0 +1,115 @@ +#ifndef INC_ENNEMI_B_H_ +#define INC_ENNEMI_B_H_ + +#include "stdint.h" +uint8_t ennemi_b[] = { +0x42, 0x4d, 0x52, 0x03, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00, +0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0f, 0x00, +0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, +0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x23, 0x2e, +0x00, 0x00, 0x23, 0x2e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x45, 0x28, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x18, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, +0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, +}; + +#endif /* INC_ENNEMI_B_H_ */ diff --git a/Core/Inc/ennemi_r.h b/Core/Inc/ennemi_r.h new file mode 100644 index 0000000..b467a77 --- /dev/null +++ b/Core/Inc/ennemi_r.h @@ -0,0 +1,115 @@ +#ifndef INC_ENNEMI_R_H_ +#define INC_ENNEMI_R_H_ + +#include "stdint.h" +uint8_t ennemi_r[] = { +0x42, 0x4d, 0x52, 0x03, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00, +0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0f, 0x00, +0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, +0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x23, 0x2e, +0x00, 0x00, 0x23, 0x2e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x40, 0x28, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x18, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, +}; + +#endif /* INC_ENNEMI_R_H_ */ diff --git a/Core/Inc/ennemi_v.h b/Core/Inc/ennemi_v.h new file mode 100644 index 0000000..a3f14ae --- /dev/null +++ b/Core/Inc/ennemi_v.h @@ -0,0 +1,115 @@ +#ifndef INC_ENNEMI_V_H_ +#define INC_ENNEMI_V_H_ + +#include "stdint.h" +uint8_t ennemi_v[] = { +0x42, 0x4d, 0x52, 0x03, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00, +0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0f, 0x00, +0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, +0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x23, 0x2e, +0x00, 0x00, 0x23, 0x2e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x40, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, +0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, +0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, +}; + +#endif /* INC_ENNEMI_V_H_ */ diff --git a/Core/Inc/vaisseau.h b/Core/Inc/vaisseau.h new file mode 100644 index 0000000..1b33b49 --- /dev/null +++ b/Core/Inc/vaisseau.h @@ -0,0 +1,117 @@ +#ifndef INC_VAISSEAU_H_ +#define INC_VAISSEAU_H_ + +#include "stdint.h" +uint8_t bmp_joueur[] = { +0x42, 0x4d, 0x66, 0x03, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, +0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, +0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x23, 0x2e, +0x00, 0x00, 0x23, 0x2e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, +0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, +0xe3, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe3, 0x00, 0x04, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xa6, 0x01, 0x10, 0x04, +0xd7, 0x05, 0x59, 0xae, 0x5c, 0xe7, 0xde, 0xf7, +0xdf, 0xff, 0xdf, 0xff, 0xde, 0xf7, 0x5c, 0xe7, +0xd7, 0xad, 0x38, 0x06, 0x38, 0x06, 0x6d, 0x03, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x4d, 0x03, 0xda, 0x06, 0xdf, 0xaf, +0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xf7, 0xff, 0xaf, 0x5d, 0x07, +0x6d, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xaa, 0x02, 0x3c, 0x07, 0xff, 0xaf, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, +0x7d, 0x07, 0x8e, 0x03, 0x00, 0x00, 0x66, 0x01, +0xb6, 0x05, 0xff, 0xaf, 0xff, 0xff, 0xf5, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xaf, 0x79, 0x06, 0x04, 0x01, 0xcb, 0x02, +0x3c, 0x07, 0xff, 0xf7, 0xff, 0xff, 0xe0, 0xff, +0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xfc, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, +0xff, 0xf7, 0x99, 0x06, 0x04, 0x01, 0x45, 0x01, +0x59, 0xae, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, +0xff, 0xff, 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xf7, 0xad, 0x00, 0x00, 0x00, 0x00, +0x5c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, +0xff, 0xff, 0x5c, 0xe7, 0x00, 0x00, 0x00, 0x00, +0xde, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, +0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xde, 0xf7, 0x00, 0x00, 0x00, 0x00, +0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0x92, 0x94, 0x92, 0x94, 0x9d, 0xef, 0xff, 0xff, +0xf7, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, +0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, +0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, +0x92, 0x94, 0xb2, 0x94, 0xde, 0xf7, 0xff, 0xff, +0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, +0xde, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, +0xff, 0xff, 0xf5, 0xff, 0xdf, 0xff, 0xff, 0xff, +0x92, 0x94, 0x92, 0x94, 0xde, 0xf7, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xfd, 0xff, +0xff, 0xff, 0xde, 0xf7, 0x00, 0x00, 0x00, 0x00, +0x5c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, +0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, +0x92, 0x94, 0x92, 0x94, 0xff, 0xff, 0xff, 0xff, +0xe3, 0xff, 0xfb, 0xff, 0xfe, 0xff, 0xff, 0xff, +0xff, 0xff, 0x5c, 0xe7, 0x00, 0x00, 0x00, 0x00, +0x75, 0xad, 0xff, 0xff, 0xfc, 0xff, 0xe0, 0xff, +0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, +0x92, 0x94, 0x92, 0x94, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, +0xff, 0xff, 0x75, 0xad, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x9e, 0xf7, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xe0, 0xff, 0xfd, 0xff, 0xdf, 0xff, +0x00, 0xf8, 0xe3, 0xf8, 0xdf, 0xff, 0xff, 0xff, +0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0x9e, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x75, 0xad, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xde, 0xff, +0x00, 0xf8, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, +0xf9, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xdf, 0xff, +0x75, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x75, 0xad, 0xdf, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x75, 0xad, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0xad, +0x9e, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0x9e, 0xf7, 0x75, 0xad, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x75, 0xad, 0x5c, 0xe7, 0xde, 0xf7, +0xdf, 0xff, 0xdf, 0xff, 0xde, 0xf7, 0x5c, 0xe7, +0x75, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +#endif /* INC_VAISSEAU_H_ */ diff --git a/Core/Src/main.c b/Core/Src/main.c index eb6adba..c518fee 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -33,6 +33,10 @@ #include "stm32746g_discovery_ts.h" #include "stdio.h" #include "semphr.h" +#include "ennemi_v.h" +#include "ennemi_r.h" +#include "ennemi_b.h" +#include "vaisseau.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -42,7 +46,7 @@ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ -#define FACTEUR_ECRAN 1; + /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ @@ -77,6 +81,7 @@ osThreadId Joueur_1Handle; osThreadId Block_EnemieHandle; osThreadId ProjectileHandle; osThreadId HUDHandle; +osThreadId chargeurHandle; osMessageQId Queue_FHandle; osMessageQId Queue_NHandle; osMessageQId Queue_JHandle; @@ -102,14 +107,16 @@ static void MX_DMA2D_Init(void); static void MX_CRC_Init(void); static void MX_RNG_Init(void); static void MX_ADC1_Init(void); -void f_GameMaster(void const *argument); -void f_Joueur_1(void const *argument); -void f_block_enemie(void const *argument); -void f_projectile(void const *argument); -void f_HUD(void const *argument); +void f_GameMaster(void const * argument); +void f_Joueur_1(void const * argument); +void f_block_enemie(void const * argument); +void f_projectile(void const * argument); +void f_HUD(void const * argument); +void f_chargeur(void const * argument); /* USER CODE BEGIN PFP */ uint8_t proba_bernoulli(uint32_t numerateur, uint32_t denominateur); +uint8_t proba_tirrage(uint8_t nombre_valeur); /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ @@ -166,9 +173,9 @@ struct Monster int32_t x; int32_t y; int16_t health; - // uint8_t pbmp; // TODO c'est quoi ca ? // uint8_t type; // TODO d'autre ennemies ? struct Missile missile; + uint8_t* pbmp; }; struct Collision @@ -178,9 +185,25 @@ struct Collision uint8_t damage; }; +struct Led +{ + GPIO_TypeDef* port; + uint16_t pin; +}; + +struct Led Leds[] = { + {LED18_GPIO_Port, LED18_Pin}, + {LED17_GPIO_Port, LED17_Pin}, + {LED16_GPIO_Port, LED16_Pin}, + {LED15_GPIO_Port, LED15_Pin}, + {LED14_GPIO_Port, LED14_Pin}, + {LED13_GPIO_Port, LED13_Pin}, + {LED12_GPIO_Port, LED12_Pin}, + {LED11_GPIO_Port, LED11_Pin}}; + // Définition des paramètres du joueurs -struct Joueur joueur = {200, 200, 1, 1, 3, {0, 0, 0, -1, MISSILE_AMI, 1, 1}}; +struct Joueur joueur = {200, 200, 1, 1, 5, {0, 0, 0, -1, MISSILE_AMI, 1, 1}}; uint8_t LED = 1; @@ -188,6 +211,8 @@ uint32_t LCD_COLOR_BACKGROUND = LCD_COLOR_BLACK; // Number of waves of enemies before the game is won. uint8_t wave = 0; +uint8_t kill = 0; +uint8_t charge = 0; // Tableau des monstres (8 par ligne, sur 3 ligne) struct Monster Table_ennemis[8][3]; @@ -314,11 +339,15 @@ int main(void) osThreadDef(HUD, f_HUD, osPriorityBelowNormal, 0, 1024); HUDHandle = osThreadCreate(osThread(HUD), NULL); + /* definition and creation of chargeur */ + osThreadDef(chargeur, f_chargeur, osPriorityBelowNormal, 0, 128); + chargeurHandle = osThreadCreate(osThread(chargeur), NULL); + /* USER CODE BEGIN RTOS_THREADS */ vQueueAddToRegistry(Queue_NHandle, "Queue Missile"); - vQueueAddToRegistry(Queue_JHandle, "Queue Missile"); - vQueueAddToRegistry(Queue_EHandle, "Queue Missile"); - vQueueAddToRegistry(Queue_FHandle, "Queue Missile"); + vQueueAddToRegistry(Queue_JHandle, "Queue Joueur"); + vQueueAddToRegistry(Queue_EHandle, "Queue Ennemie"); + vQueueAddToRegistry(Queue_FHandle, "Queue Fin"); /* USER CODE END RTOS_THREADS */ /* Start scheduler */ @@ -404,7 +433,8 @@ void SystemClock_Config(void) } /** Initializes the CPU, AHB and APB buses clocks */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; @@ -414,7 +444,7 @@ void SystemClock_Config(void) { Error_Handler(); } - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC | RCC_PERIPHCLK_CLK48; + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC|RCC_PERIPHCLK_CLK48; PeriphClkInitStruct.PLLSAI.PLLSAIN = 384; PeriphClkInitStruct.PLLSAI.PLLSAIR = 5; PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2; @@ -475,6 +505,7 @@ static void MX_ADC1_Init(void) /* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */ + } /** @@ -524,6 +555,7 @@ static void MX_ADC3_Init(void) /* USER CODE BEGIN ADC3_Init 2 */ /* USER CODE END ADC3_Init 2 */ + } /** @@ -554,6 +586,7 @@ static void MX_CRC_Init(void) /* USER CODE BEGIN CRC_Init 2 */ /* USER CODE END CRC_Init 2 */ + } /** @@ -591,6 +624,7 @@ static void MX_DAC_Init(void) /* USER CODE BEGIN DAC_Init 2 */ /* USER CODE END DAC_Init 2 */ + } /** @@ -627,6 +661,7 @@ static void MX_DMA2D_Init(void) /* USER CODE BEGIN DMA2D_Init 2 */ /* USER CODE END DMA2D_Init 2 */ + } /** @@ -688,6 +723,7 @@ static void MX_LTDC_Init(void) /* USER CODE BEGIN LTDC_Init 2 */ /* USER CODE END LTDC_Init 2 */ + } /** @@ -713,6 +749,7 @@ static void MX_RNG_Init(void) /* USER CODE BEGIN RNG_Init 2 */ /* USER CODE END RNG_Init 2 */ + } /** @@ -759,6 +796,7 @@ static void MX_TIM1_Init(void) /* USER CODE BEGIN TIM1_Init 2 */ /* USER CODE END TIM1_Init 2 */ + } /** @@ -803,6 +841,7 @@ static void MX_TIM2_Init(void) /* USER CODE BEGIN TIM2_Init 2 */ /* USER CODE END TIM2_Init 2 */ + } /** @@ -868,6 +907,7 @@ static void MX_TIM3_Init(void) /* USER CODE END TIM3_Init 2 */ HAL_TIM_MspPostInit(&htim3); + } /** @@ -912,6 +952,7 @@ static void MX_TIM5_Init(void) /* USER CODE BEGIN TIM5_Init 2 */ /* USER CODE END TIM5_Init 2 */ + } /** @@ -990,6 +1031,7 @@ static void MX_TIM8_Init(void) /* USER CODE END TIM8_Init 2 */ HAL_TIM_MspPostInit(&htim8); + } /* FMC initialization function */ @@ -1031,7 +1073,7 @@ static void MX_FMC_Init(void) if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK) { - Error_Handler(); + Error_Handler( ); } /* USER CODE BEGIN FMC_Init 2 */ @@ -1062,7 +1104,7 @@ static void MX_GPIO_Init(void) __HAL_RCC_GPIOH_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOE, LED14_Pin | LED15_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOE, LED14_Pin|LED15_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET); @@ -1080,7 +1122,8 @@ static void MX_GPIO_Init(void) HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOH, LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOH, LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin + |LED2_Pin|LED18_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET); @@ -1092,7 +1135,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); /*Configure GPIO pins : ARDUINO_SCL_D15_Pin ARDUINO_SDA_D14_Pin */ - GPIO_InitStruct.Pin = ARDUINO_SCL_D15_Pin | ARDUINO_SDA_D14_Pin; + GPIO_InitStruct.Pin = ARDUINO_SCL_D15_Pin|ARDUINO_SDA_D14_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; @@ -1101,7 +1144,8 @@ static void MX_GPIO_Init(void) /*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D2_Pin ULPI_D1_Pin ULPI_D4_Pin */ - GPIO_InitStruct.Pin = ULPI_D7_Pin | ULPI_D6_Pin | ULPI_D5_Pin | ULPI_D2_Pin | ULPI_D1_Pin | ULPI_D4_Pin; + GPIO_InitStruct.Pin = ULPI_D7_Pin|ULPI_D6_Pin|ULPI_D5_Pin|ULPI_D2_Pin + |ULPI_D1_Pin|ULPI_D4_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -1109,13 +1153,13 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure GPIO pins : BP2_Pin BP1_Pin */ - GPIO_InitStruct.Pin = BP2_Pin | BP1_Pin; + GPIO_InitStruct.Pin = BP2_Pin|BP1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : LED14_Pin LED15_Pin */ - GPIO_InitStruct.Pin = LED14_Pin | LED15_Pin; + GPIO_InitStruct.Pin = LED14_Pin|LED15_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; @@ -1142,14 +1186,14 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : OTG_FS_PowerSwitchOn_Pin LED16_Pin */ - GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin | LED16_Pin; + GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin|LED16_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); /*Configure GPIO pins : LED3_Pin LCD_DISP_Pin */ - GPIO_InitStruct.Pin = LED3_Pin | LCD_DISP_Pin; + GPIO_InitStruct.Pin = LED3_Pin|LCD_DISP_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; @@ -1175,7 +1219,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : TP3_Pin NC2_Pin */ - GPIO_InitStruct.Pin = TP3_Pin | NC2_Pin; + GPIO_InitStruct.Pin = TP3_Pin|NC2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); @@ -1190,7 +1234,8 @@ static void MX_GPIO_Init(void) /*Configure GPIO pins : LED13_Pin LED17_Pin LED11_Pin LED12_Pin LED2_Pin LED18_Pin */ - GPIO_InitStruct.Pin = LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin; + GPIO_InitStruct.Pin = LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin + |LED2_Pin|LED18_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; @@ -1219,7 +1264,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(LCD_INT_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : PC7 PC6 */ - GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_6; + GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_6; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -1235,7 +1280,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : BP_JOYSTICK_Pin RMII_RXER_Pin */ - GPIO_InitStruct.Pin = BP_JOYSTICK_Pin | RMII_RXER_Pin; + GPIO_InitStruct.Pin = BP_JOYSTICK_Pin|RMII_RXER_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); @@ -1249,7 +1294,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); /*Configure GPIO pins : ULPI_STP_Pin ULPI_DIR_Pin */ - GPIO_InitStruct.Pin = ULPI_STP_Pin | ULPI_DIR_Pin; + GPIO_InitStruct.Pin = ULPI_STP_Pin|ULPI_DIR_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -1264,7 +1309,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : LCD_SCL_Pin LCD_SDA_Pin */ - GPIO_InitStruct.Pin = LCD_SCL_Pin | LCD_SDA_Pin; + GPIO_InitStruct.Pin = LCD_SCL_Pin|LCD_SDA_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -1272,7 +1317,7 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); /*Configure GPIO pins : ULPI_CLK_Pin ULPI_D0_Pin */ - GPIO_InitStruct.Pin = ULPI_CLK_Pin | ULPI_D0_Pin; + GPIO_InitStruct.Pin = ULPI_CLK_Pin|ULPI_D0_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -1280,12 +1325,13 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : PB14 PB15 */ - GPIO_InitStruct.Pin = GPIO_PIN_14 | GPIO_PIN_15; + GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + } /* USER CODE BEGIN 4 */ @@ -1324,10 +1370,19 @@ void repopulate_ennemie_list(uint8_t wave) Table_ennemis[idx1][idx2].missile.valide = 1; if (proba_bernoulli(1, 3)) Table_ennemis[idx1][idx2].health = 0; + uint8_t idx_texture = proba_tirrage(3); + if (idx_texture == 0) Table_ennemis[idx1][idx2].pbmp = ennemi_b; + else if (idx_texture == 1) Table_ennemis[idx1][idx2].pbmp = ennemi_v; + else Table_ennemis[idx1][idx2].pbmp = ennemi_r; } } } +void update_leds(){ + for (int idx = 0; idx<=8; idx++){ + HAL_GPIO_WritePin(Leds[idx].port, Leds[idx].pin, !(charge-1 o_pos_x) & (m_pos_x < o_pos_x + o_taille_x) & (m_pos_y > o_pos_y) & (m_pos_y < o_pos_y + o_taille_y)); @@ -1401,7 +1471,7 @@ uint8_t colision_missile(uint16_t m_pos_x, uint16_t m_pos_y, uint16_t o_pos_x, u * @retval None */ /* USER CODE END Header_f_GameMaster */ -void f_GameMaster(void const *argument) +void f_GameMaster(void const * argument) { /* init code for LWIP */ MX_LWIP_Init(); @@ -1444,7 +1514,7 @@ void f_GameMaster(void const *argument) * @retval None */ /* USER CODE END Header_f_Joueur_1 */ -void f_Joueur_1(void const *argument) +void f_Joueur_1(void const * argument) { /* USER CODE BEGIN f_Joueur_1 */ TickType_t xLastWakeTime; @@ -1455,7 +1525,8 @@ void f_Joueur_1(void const *argument) struct Missile missile; - uint8_t bouton_relache = 1; + uint8_t bp_1_relache = 1; + uint8_t bp_2_relache = 1; ADC_ChannelConfTypeDef sConfig3 = {0}; sConfig3.Rank = ADC_REGULAR_RANK_1; @@ -1508,7 +1579,8 @@ void f_Joueur_1(void const *argument) if ((joueur.x > joueur.dx) && (joystick_v > centre_joystick + seuil_joystick)) joueur.x -= joueur.dx; - lcd_plot_rect(joueur.x, joueur.y, joueur_width, joueur_height, Couleur_joueur); + lcd_plot_bitmap(joueur.x, joueur.y, bmp_joueur); + //BSP_LCD_DrawBitmap(joueur.x, joueur.y, &vaisseau); if (xQueueReceive(Queue_JHandle, &missile, 0) == pdPASS) joueur.health = joueur.health - missile.damage; @@ -1516,18 +1588,36 @@ void f_Joueur_1(void const *argument) if (joueur.health <= 0) xQueueSend(Queue_FHandle, &end, 0); - if ((!HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin)) && bouton_relache) + if ((!HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin)) && bp_1_relache) { - bouton_relache = 0; + bp_1_relache = 0; missile = joueur.missile; missile.x = joueur.x + joueur_width / 2; missile.y = joueur.y; xQueueSend(Queue_NHandle, &missile, 0); - HAL_GPIO_TogglePin(LED11_GPIO_Port, LED11_Pin); } if (HAL_GPIO_ReadPin(BP1_GPIO_Port, BP1_Pin)) - bouton_relache = 1; + bp_1_relache = 1; + + if ((!HAL_GPIO_ReadPin(BP2_GPIO_Port, BP2_Pin)) && bp_2_relache && (charge == 8)) + { + bp_2_relache = 0; + missile = joueur.missile; + missile.x = joueur.x + joueur_width / 2; + missile.y = joueur.y; + for (int idx_tirs = -3; idx_tirs <= 3; idx_tirs++) + { + missile.dy = -3; + missile.dx = idx_tirs; + xQueueSend(Queue_NHandle, &missile, 0); + } + charge = 0; + update_leds(); + } + if (HAL_GPIO_ReadPin(BP2_GPIO_Port, BP2_Pin)) + + bp_2_relache = 1; vTaskDelayUntil(&xLastWakeTime, xPeriodeTache); } @@ -1541,7 +1631,7 @@ void f_Joueur_1(void const *argument) * @retval None */ /* USER CODE END Header_f_block_enemie */ -void f_block_enemie(void const *argument) +void f_block_enemie(void const * argument) { /* USER CODE BEGIN f_block_enemie */ @@ -1563,6 +1653,8 @@ void f_block_enemie(void const *argument) while (xQueueReceive(Queue_EHandle, &collision, 0) == pdPASS) { Table_ennemis[collision.idx1][collision.idx2].health -= collision.damage; + if (Table_ennemis[collision.idx1][collision.idx2].health <= 0) + kill++; } for (int idx1 = 0; idx1 < 8; idx1++) @@ -1611,7 +1703,7 @@ void f_block_enemie(void const *argument) if (Table_ennemis[idx1][idx2].health > 0) { nombre_monstre++; - lcd_plot_rect(Table_ennemis[idx1][idx2].x, Table_ennemis[idx1][idx2].y, monstre_width, monstre_height, Couleur_monstre); + lcd_plot_bitmap(Table_ennemis[idx1][idx2].x, Table_ennemis[idx1][idx2].y, Table_ennemis[idx1][idx2].pbmp); } } } @@ -1627,7 +1719,7 @@ void f_block_enemie(void const *argument) { if (Table_ennemis[idx1][idx2].health > 0) { - if (proba_bernoulli(wave, 32)) + if (proba_bernoulli(wave, 16)) { missile.x = Table_ennemis[idx1][idx2].x + monstre_width / 2; missile.y = Table_ennemis[idx1][idx2].y + monstre_height; @@ -1648,13 +1740,13 @@ void f_block_enemie(void const *argument) * @retval None */ /* USER CODE END Header_f_projectile */ -void f_projectile(void const *argument) +void f_projectile(void const * argument) { /* USER CODE BEGIN f_projectile */ TickType_t xLastWakeTime; xLastWakeTime = xTaskGetTickCount(); const TickType_t xPeriodeTache = 10 / portTICK_PERIOD_MS; // Toutes les 200 ms - const int TAILLE_LISTE_MISSILE = 100; + const int TAILLE_LISTE_MISSILE = 250; /* Infinite loop */ struct Missile liste_missile[TAILLE_LISTE_MISSILE]; struct Missile missile = {70, 70, 0, 3, MISSILE_ENNEMI, 1, 0}; @@ -1735,25 +1827,50 @@ void f_projectile(void const *argument) * @retval None */ /* USER CODE END Header_f_HUD */ -void f_HUD(void const *argument) +void f_HUD(void const * argument) { /* USER CODE BEGIN f_HUD */ TickType_t xLastWakeTime; xLastWakeTime = xTaskGetTickCount(); const TickType_t xPeriodeTache = 100 / portTICK_PERIOD_MS; // Toutes les 200 ms - uint8_t line_hud[50] = ""; - const uint8_t base[50] = "vie : %2u - vague : %2u"; + uint8_t line_hud[100] = ""; + const uint8_t base[100] = "vie : %2u - vague : %2u - kill : %2u"; /* Infinite loop */ for (;;) { - sprintf(line_hud, base, (uint)joueur.health, (uint)wave); + sprintf(line_hud, base, (uint)joueur.health, (uint)wave, (uint)kill); lcd_plot_text_line(0, line_hud, Couleur_missile); vTaskDelayUntil(&xLastWakeTime, xPeriodeTache); } /* USER CODE END f_HUD */ } +/* USER CODE BEGIN Header_f_chargeur */ /** +* @brief Function implementing the chargeur thread. +* @param argument: Not used +* @retval None +*/ +/* USER CODE END Header_f_chargeur */ +void f_chargeur(void const * argument) +{ + /* USER CODE BEGIN f_chargeur */ + TickType_t xLastWakeTime; + xLastWakeTime = xTaskGetTickCount(); + const TickType_t xPeriodeTache = 5000/ 8 / portTICK_PERIOD_MS; // Toutes les 200 ms + /* Infinite loop */ + for(;;) + { + if (charge < 8) + charge++; + update_leds(); + + vTaskDelayUntil(&xLastWakeTime, xPeriodeTache); + } + /* USER CODE END f_chargeur */ +} + + /** * @brief Period elapsed callback in non blocking mode * @note This function is called when TIM6 interrupt took place, inside * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment @@ -1766,8 +1883,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) /* USER CODE BEGIN Callback 0 */ /* USER CODE END Callback 0 */ - if (htim->Instance == TIM6) - { + if (htim->Instance == TIM6) { HAL_IncTick(); } /* USER CODE BEGIN Callback 1 */ @@ -1790,7 +1906,7 @@ void Error_Handler(void) /* USER CODE END Error_Handler_Debug */ } -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. diff --git a/Space_Invader.code-workspace b/Space_Invader.code-workspace index 715dc53..dc445a9 100644 --- a/Space_Invader.code-workspace +++ b/Space_Invader.code-workspace @@ -6,8 +6,8 @@ ], "settings": { "stm32-for-vscode.openOCDPath": "/home/leopold/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-1.1/.content/bin/openocd", - "stm32-for-vscode.makePath": "/usr/bin/make", - "stm32-for-vscode.armToolchainPath": "/home/leopold/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/10.2.1-1.1.2/.content/bin", + "stm32-for-vscode.makePath": false, + "stm32-for-vscode.armToolchainPath": false, "cortex-debug.armToolchainPath": "/home/leopold/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/10.2.1-1.1.2/.content/bin", "cortex-debug.openocdPath": "/home/leopold/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-1.1/.content/bin/openocd" } diff --git a/Space_Invaders.ioc b/Space_Invaders.ioc index 5859f13..8db5b9a 100644 --- a/Space_Invaders.ioc +++ b/Space_Invaders.ioc @@ -17,7 +17,7 @@ FREERTOS.INCLUDE_vTaskDelayUntil=1 FREERTOS.IPParameters=Tasks01,configUSE_APPLICATION_TASK_TAG,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configUSE_IDLE_HOOK,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configTOTAL_HEAP_SIZE,FootprintOK,Mutexes01,INCLUDE_vTaskDelayUntil,configENABLE_FPU,Queues01,configRECORD_STACK_HIGH_ADDRESS,configGENERATE_RUN_TIME_STATS FREERTOS.Mutexes01=MutexLCD,Dynamic,NULL FREERTOS.Queues01=Queue_F,8,enum End_type,0,Dynamic,NULL,NULL;Queue_N,8,struct Missile,0,Dynamic,NULL,NULL;Queue_J,8,uint8_t,0,Dynamic,NULL,NULL;Queue_E,8,struct Collision,0,Dynamic,NULL,NULL -FREERTOS.Tasks01=GameMaster,2,1024,f_GameMaster,Default,NULL,Dynamic,NULL,NULL;Joueur_1,1,1024,f_Joueur_1,Default,NULL,Dynamic,NULL,NULL;Block_Enemie,-2,1024,f_block_enemie,Default,NULL,Dynamic,NULL,NULL;Projectile,0,1024,f_projectile,Default,NULL,Dynamic,Dynamic,NULL;HUD,-1,1024,f_HUD,Default,NULL,Dynamic,NULL,NULL +FREERTOS.Tasks01=GameMaster,2,1024,f_GameMaster,Default,NULL,Dynamic,NULL,NULL;Joueur_1,1,1024,f_Joueur_1,Default,NULL,Dynamic,NULL,NULL;Block_Enemie,-2,1024,f_block_enemie,Default,NULL,Dynamic,NULL,NULL;Projectile,0,1024,f_projectile,Default,NULL,Dynamic,Dynamic,NULL;HUD,-1,1024,f_HUD,Default,NULL,Dynamic,NULL,NULL;chargeur,-1,128,f_chargeur,Default,NULL,Dynamic,NULL,NULL FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2 FREERTOS.configENABLE_FPU=1 FREERTOS.configGENERATE_RUN_TIME_STATS=0 diff --git a/docs/Architecture_projet.svg b/docs/Architecture_projet.svg new file mode 100644 index 0000000..19c54f1 --- /dev/null +++ b/docs/Architecture_projet.svg @@ -0,0 +1,198 @@ +HALVarriables partagéesFonctions globalesCAN JoystickEcranGPIOrng«black board»Table_ennemis«black board»joueur«black board»Charge«Mutex»LCD«functions»Probabilité«functions»Encapsulation LCD«function»Remplissage ennemis«function»Mise à jour des ledsQueue_Jchoc joueurQueue_Echoc ennemieQueue_Ffin du jeuQueue_Nnouveau projectileThread : game_masterBloqué en attente de messagesgère l'apparition des porjectiles,gère les autres Thread,fait l'affichage des scoresThread : HUDT = 100 msAffiche :- La vie,- Le numéro de la vague,- Le nombre de monstre tué.Thread : ChargeurT = 5/8 sIncremente la chargeTread : joueur_1T = 5 msgère le joystick,la vie du joueur,la position du joueur 1,et l'affichage du joueurTread : EnnemiesT = 200 msgère les ennemiesTread : projectileT = 10 msgère les projectilesgère les colisionslit la valeurtouchétouchéplus de vieplus d'ennemienouveau tire du joueurnouveau tire des ennemieuseuseuseuseusesuspendsuspendsuspendecrisecrislislisuseecrisuseuselis/ecritlis/ecrituseuseuse \ No newline at end of file diff --git a/docs/class.svg b/docs/class.svg new file mode 100644 index 0000000..a9b2433 --- /dev/null +++ b/docs/class.svg @@ -0,0 +1,89 @@ +Joueurint32_t xint32_t yint8_t dxint8_t dyint8_t healthMissile missilemodelise le joueurMissileint16_t xint16_t yint8_t dxint8_t dyCamps_missile equipeuint8_t damageuint8_t validemodelise les missiles.Monsterint32_t xint32_t yint16_t healthMissile missilemodelise les monstres.Collisionuint8_t idx1uint8_t idx2uint8_t damagedécrit les colision entre missile et monstre.Camps_missileMISSILE_AMIMISSILE_ENNEMIdécrit le camps du missile.End_typeEND_TABLEAU_VIDEEND_MORT_JOUEURdécrit le type de fin de la partie.Sens_ennemieDROITEGAUCHEdécrit le sens de déplacement actuel des ennemis.décrit le missile de base du joueur.décrit le missile de base des monstres.décrit le missile de base des monstres. \ No newline at end of file diff --git a/docs/lcd.md b/docs/lcd.md new file mode 100644 index 0000000..284f603 --- /dev/null +++ b/docs/lcd.md @@ -0,0 +1,11 @@ +# L'écran + +## Organisation de l'écran +Les dix pixel en haut de l'écran sont reservés pour l'affichage des informations. + +Les monstres sont rangés sur trois rangs + +## Mutex +Pour ne pas aoir de problème d'interruption entre les threads pendant la manipulation de la mémoire de l'écran, on utilise un mutex ainsi que une série de fonction permetant de faire automatiquement l'attente et le relachement du mutex. + +## Bitmap diff --git a/docs/rng.md b/docs/rng.md new file mode 100644 index 0000000..8c935a1 --- /dev/null +++ b/docs/rng.md @@ -0,0 +1,17 @@ +# Génerateur de nombre aléatoire + +## Utilisation du pérriphérique : +On utilise le code suivant, car il n'y a pas toujours de nouveau nombre aléatoire disponible dans le buffer. +``` C + uint32_t nombre_aleatoire; + while (HAL_RNG_GenerateRandomNumber(&hrng, &nombre_aleatoire) != HAL_OK) + ; +``` + +## Fonctions utilitaires + +On définit deux fonctions pour la suite : + +- ```uint8_t proba_bernoulli(uint32_t numerateur, uint32_t denominateur)``` qui revoit ```1``` avec une probabilité de $\frac{\text{numerateur}}{\text{denominateur}}$, ```0``` sinon, + +- ```uint8_t proba_tirrage(uint8_t nombre_valeur)``` qui renvoit une nombre entre $1$ et $\text{nombre_valeur}$ avec une probabilité uniforme, utile pour tirer un objet au hasard dans un liste.