Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
user:kluong:refactoring_the_firmware [2020/10/06 17:21] kluong |
user:kluong:refactoring_the_firmware [2021/09/19 21:59] (current) |
||
---|---|---|---|
Line 24: | Line 24: | ||
Definitions | Definitions | ||
- | <code> | + | <code cpp> |
class AbstractBoard { | class AbstractBoard { | ||
public: | public: | ||
virtual void sample(); | virtual void sample(); | ||
virtual void transmit(); | virtual void transmit(); | ||
- | } | + | }; |
class AppleBoard : public AbstractBoard{ | class AppleBoard : public AbstractBoard{ | ||
Line 35: | Line 35: | ||
void sample(); | void sample(); | ||
void transmit(); | void transmit(); | ||
- | } | + | }; |
</code> | </code> | ||
The main: | The main: | ||
- | <code> | + | <code cpp> |
loop(){ | loop(){ | ||
Line 60: | Line 60: | ||
Generally, here's how we can approach this: | Generally, here's how we can approach this: | ||
- | - Create the abstract base class | + | - Review the current code and create the abstract base class |
- | - Implement one board | + | - Implement a class for one board (apple?) that inherits from the abstract base class (essentially implementing it) |
- Test it | - Test it | ||
- Finish migrating the other boards | - Finish migrating the other boards |