Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if A0-3 are not 1, will break resolution switch statement() #189

Closed
karlg100 opened this issue Dec 29, 2020 · 2 comments
Closed

if A0-3 are not 1, will break resolution switch statement() #189

karlg100 opened this issue Dec 29, 2020 · 2 comments

Comments

@karlg100
Copy link
Contributor

switch (scratchPad[CONFIGURATION]) {

It appears this switch statement will fail if any of the A0-3 bits are pulled down.

This is because bits 0-3 match these hardware set address bits. Default they are pulled up. But a user can configure these with hardware or dynamically pulling up or down.

The CONFIGURATION bit probably needs to be masked out with a | of 11110000 or 0xF0, then the macros redefined to be 0xN0.

Not sure what other repercussions this change would have however.

@MalcolmBoura
Copy link

There is the same problem in setResolution(). It won't actually fail but it may write when it does not need to.
Needs a systematic look through all of the code.

@MalcolmBoura
Copy link

The correct fix is to write a Scratchpad class which hides the details of how to access things such as the resolution. I have one in preparation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants