From 8fdc41cb4ab142d3d92d09177ac0a935a7439ac4 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Tue, 24 Oct 2023 12:24:33 +0200 Subject: [PATCH] doc: Update readme with technical details --- README.md | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ea042b2..312f7c8 100755 --- a/README.md +++ b/README.md @@ -1,27 +1,140 @@ # fiveTargetGame -Set of two applications targetting Microchip AVR chips, implementing shooting game. -The game is made of two parts: the *gun* and the *targets*. -There is up to four players, trying to shoot five targets in a row, using 5 tries. +Set of two applications targetting Atmel/Microchip [ATMega328P](https://www.microchip.com/en-us/product/atmega328p), implementing shooting game. -At some point, games ends and the player with best shot/hit ratio wins the game. +Using a *gun*, users tries to hit *targets*. +The game is up to four players: yellow, green, red and blue. +There are 5 targets. -## target -The **target** application manages player points and communicate with an Android application implemented on top of [Bluetooth Electronics](https://www.keuwl.com/apps/bluetoothelectronics/) application. It manages the game logic and player points. +### Game mode +#### Biathlon like +Each player turn gives 5 shots. Player tries to hit each target. Total number of shoots is counted, as well as successfull hits. -## Gun +## Functional details +### target + +The **target** application manages player points and turns. It communicates with an Android application implemented on top of [Bluetooth Electronics](https://www.keuwl.com/apps/bluetoothelectronics/) application. It manages the game logic and player points. + + +### Gun The **Gun** application manages the gun. Using two buttons, it allows: | Press | Button 1 | Button 2 | |-------|------------------|--------------------------------| -| short | power on / shoot | Begin new round (give 5 shots) | +| short | shoot | Begin new round (give 5 shots) | | long | power off | continuous laser (calibration) | Gun application manages following outputs: * Laser * vibrator -* led +* 128x32 I²C display + +## Architecture details + +Some parts of the projet, implementing logic, can be used on both native and target platform. +All that code is represented in the "domain" package below. + +Both **target** and **Gun** application are run both native and cross environment. The current +target hardware for both is the [ATMega328p](https://www.microchip.com/en-us/product/atmega328p) chip from Atmel/Microchip. +To facilitate testing and extension, user interface (Gui) and hardware abstraction (HAL) are provided using interfaces. Implementation exists for native and cross (i.e. testing) environments. + + +```mermaid + +classDiagram + + Game "4" *--> User : "Manages" + BTEGui ..|> ITargetGui + + TargetApp *--> "1" Game + TargetApp *--> "1" 328TargetsHal + TargetApp *--> "1" BTEGui + + TestHal ..|> ITargetHal + TestGui ..|> ITargetGui + ConsoleTargets *--> "1" Game + ConsoleTargets *--> "1" TestGui + ConsoleTargets *--> "1" TestHal + ConsoleGun *--> "1" Gun + ConsoleGun *--> "1" TestHal + + GunApp *--> "1" Gun + GunApp *--> "1" 328GunHal + + 328TargetsHal ..|> ITargetHal + 328GunHal ..|> IGunHal + + namespace ATMega328{ + + class 328TargetsHal{ + + } + + class 328GunHal{ + + } + } + + namespace Domain { + + class Game{ + } + + class User{ + + } + + class BTEGui{ + Dedicated for communication with \nBlueTooth Electronics Android application + } + + class Gun{ + } + + class ITargetHal{ + <> + } + + class IGunHal{ + <> + } + + class ITargetGui{ + <> + } + } + + + namespace Native { + + class ConsoleTargets{ + Runs on native environment for test purpose + } + class ConsoleGun{ + Runs on native environment for test purpose + } + + class TestHal{ + + } + + class TestGui{ + + } + } + + + namespace TargetHost { + class TargetApp{ + Runs on dedicated hardware\nPlatform ATMega328P + } + } -For more details of gun logic, see test cases. + namespace GunHost { + class GunApp{ + Runs on modded Nerf gun\n Platform ATMega328P + } + } +``` \ No newline at end of file