Skip to content

Commit

Permalink
doc: Update readme with technical details
Browse files Browse the repository at this point in the history
  • Loading branch information
arcadien committed Oct 24, 2023
1 parent 54e8dc6 commit a9f1089
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 10 deletions.
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
# 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.

For more details of gun logic, see test cases.
Note: The *BTEGui* implementation can be used in native environment. Based on plain string exchange, if it may be difficult to interpret.

![Architecture overview](architecture.png)
84 changes: 84 additions & 0 deletions architecture.mermaid
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
classDiagram

Game "4" *--> User
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{
}

class Gun{
}

class ITargetHal{
<<interface>>
}

class IGunHal{
<<interface>>
}

class ITargetGui{
<<interface>>
}
}


namespace Native_Environment{

class ConsoleTargets{
}
class ConsoleGun{
}

class TestHal{

}

class TestGui{

}
}


namespace Cross_Environment {
class TargetApp{
}

class GunApp{
}
}
Binary file added architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a9f1089

Please sign in to comment.