Skip to content

Commit 01e0fea

Browse files
committed
Add flowchart and documentation for it
1 parent ea6defe commit 01e0fea

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ These are all of the files we've created to make the project more *readable*:
6464
- Here we have some *utility functionality* like:
6565
- A **Delay** method with it's **interrupt handler** and a function to **enable or disable** `systicks`.
6666
- A method to **initialize the LED's** and to **turn on or off LED0**.
67-
- A method to **stop code execution when an error occured**.
67+
- A method to **stop code execution when an `error` occured** and flash the LED's to indicate this.
6868

6969
- `handlers.c` (& `handlers.h`)
7070
- Here we've gathered the *interrupt handlers* for **`RTC compare`** and **odd and even pin interrupts**.
@@ -76,7 +76,7 @@ These are all of the files we've created to make the project more *readable*:
7676
- `void initADXL_SPI (void)`: Initialize the SPI pins and settings to communicate with the accelerometer.
7777
- `void testADXL (void)`: Test all the ODR (Output Data Rate) settings to see the effect they have on power.
7878
- `void readValuesADXL (void)`: Read and display the X-Y-Z g-values on UART.
79-
- `void resetHandlerADXL (void)`: This method tries to read the sensor ID. If this fails it tries to soft reset it and tries to read the ID again after a second. If this fails again the power to the sensor is turned off for one second. If the ID check fails again after this, the code stops executing and the `error` method is called.
79+
- `void resetHandlerADXL (void)`: This method tries to read the sensor ID. If this fails it tries to *soft reset* it and tries to read the ID again after a delay of one second. If this fails again the power to the sensor is turned off for one second. If the ID check fails again after this, the code stops executing and the `error` method is called.
8080
- `uint8_t readADXL (uint8_t address)`: Read one byte of data from a given register address. This method is called by other methods like `readADXL_XYZDATA`.
8181
- `void writeADXL (uint8_t address, uint8_t data)`: Write one byte of data to a given register address. This method is called by other methods like `configADXL_ODR`, `configADXL_range`, ... .
8282
- `void readADXL_XYZDATA (void)`: Read the X-Y-Z data registers using *burst reads* and put the response data in the global array.
@@ -95,7 +95,14 @@ These are all of the files we've created to make the project more *readable*:
9595

9696
### 2.2 - Code flow
9797

98-
TODO (flowchart)
98+
![Flowchart](/doc/reports/figures/flowchart.png?raw=true "Flowchart")
99+
100+
**Extra notes on the flowchart:**
101+
102+
- **(\*1):** Every minute the RTC compare function will give an interrupt to wakeup the microcontroller.
103+
- **(\*2):** This handler tries to read the sensor ID. If this fails it tries to *soft reset* it and tries to read the ID again after a delay of one second. If this fails again the power to the sensor is turned off for one second. If the ID check fails again after this, the code stops executing and the `error` method is called.
104+
- **(\*3):** Every minute an interrupt gets generated by the Real Time Counter Compare functionality.
105+
- **(\*4):** This can be a button (`PB0` or `PB1`) interrupt or an interrupt generated by the **accelerometer** if the activity threshold is surpassed.
99106

100107
------
101108

doc/reports/flowchart.png

115 KB
Loading

0 commit comments

Comments
 (0)