-
Notifications
You must be signed in to change notification settings - Fork 0
Operation/adding error manager implementaton #212
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
base: alpha
Are you sure you want to change the base?
Changes from all commits
e9cff6c
66deed8
41f3d6c
c0ce724
8ae8090
2871627
73adab5
d43cf26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| #include <hal/errors.h> | ||
| #include <hal/Storage/FRAM.h> | ||
| #include <RCommon.h> | ||
| #include <RErrorManager.h> | ||
|
|
||
|
|
||
| /*************************************************************************************************** | ||
|
|
@@ -34,7 +35,8 @@ int framInit(void) { | |
|
|
||
| int error = FRAM_start(); | ||
|
|
||
| // TODO: record errors (if present) to System Manager | ||
| if (error != SUCCESS) | ||
| errorReportComponent(componentHalFram , error); | ||
|
|
||
| return error; | ||
| } | ||
|
|
@@ -57,7 +59,8 @@ int framRead(uint8_t* data, uint32_t address, uint32_t size) { | |
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ missed error |
||
| int error = FRAM_read(data, address, size); | ||
|
|
||
| // TODO: record errors (if present) to System Manager | ||
| if (error != SUCCESS) | ||
| errorReportComponent(componentHalFram , error); | ||
|
|
||
| return error; | ||
| } | ||
|
|
@@ -80,7 +83,8 @@ int framWrite(uint8_t* data, uint32_t address, uint32_t size) { | |
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ missed error |
||
| int error = FRAM_writeAndVerify(data, address, size); | ||
|
|
||
| // TODO: record errors (if present) to System Manager | ||
| if (error != SUCCESS) | ||
| errorReportComponent(componentHalFram , error); | ||
|
|
||
| return error; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |||||||||||||||
| #include <RKey.h> | ||||||||||||||||
| #include <RFram.h> | ||||||||||||||||
| #include <RDebug.h> | ||||||||||||||||
| #include <RErrorManager.h> | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| /*************************************************************************************************** | ||||||||||||||||
|
|
@@ -55,13 +56,22 @@ uint8_t privateKey(void) { | |||||||||||||||
| int error = 0; | ||||||||||||||||
|
|
||||||||||||||||
| // read from FRAM | ||||||||||||||||
| error = framRead(&key1, PRIVATE_KEY_ADDR_ONE, sizeof(key1)); | ||||||||||||||||
| if (error) return 0; | ||||||||||||||||
| error = framRead(&key1, PRIVATE_KEY_ADDR_ONE, sizeof(key1)) | ||||||||||||||||
|
|
||||||||||||||||
| if (error != SUCCESS) | ||||||||||||||||
| errorReportModule(moduleFram , error); | ||||||||||||||||
| return error; | ||||||||||||||||
|
Comment on lines
+61
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
|
|
||||||||||||||||
| error = framRead(&key2, PRIVATE_KEY_ADDR_TWO, sizeof(key2)); | ||||||||||||||||
| if (error) return 0; | ||||||||||||||||
|
|
||||||||||||||||
| if (error != SUCCESS) | ||||||||||||||||
| errorReportModule(moduleFram , error); | ||||||||||||||||
| return error; | ||||||||||||||||
|
Comment on lines
+67
to
+69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| error = framRead(&key3, PRIVATE_KEY_ADDR_THREE, sizeof(key3)); | ||||||||||||||||
| if (error) return 0; | ||||||||||||||||
|
|
||||||||||||||||
| if (error != SUCCESS) | ||||||||||||||||
| errorReportModule(moduleFram , error); | ||||||||||||||||
| return error; | ||||||||||||||||
|
Comment on lines
+72
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| // all of the keys are the same | ||||||||||||||||
| if ((key1 == key2) && (key1 == key3) && (key2 == key3)) { | ||||||||||||||||
| key = key1; | ||||||||||||||||
|
|
@@ -108,7 +118,6 @@ uint8_t privateKey(void) { | |||||||||||||||
|
|
||||||||||||||||
| debugPrint("RKey: all three keys are different (Key1 = %d, Key2 = %d, Key3 = %d). Sending Key1...\n", key1, key2, key3); | ||||||||||||||||
|
|
||||||||||||||||
| // TODO: report an error to the system manager | ||||||||||||||||
|
|
||||||||||||||||
| key = key1; | ||||||||||||||||
|
Comment on lines
120
to
122
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to produce error. |
||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| #include <RMessage.h> | ||
| #include <string.h> | ||
| #include <RCommon.h> | ||
| #include <RErrorManager.h> | ||
|
|
||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,11 @@ static uint32_t batteryTemperatureCommandBytes[4] = { | |
| 0x10E3B8 // Daughterboard 3 Temperature | ||
| }; | ||
|
|
||
| /** | ||
| * Command for Resetting Battery Watchdog (0x2200) | ||
| */ | ||
| static uint8_t batteryWatchdogResetCommand[2] = {0x22, 0x00}; | ||
|
|
||
| /*************************************************************************************************** | ||
| PRIVATE FUNCTION STUBS | ||
| ***************************************************************************************************/ | ||
|
|
@@ -246,6 +251,21 @@ int batteryIsNotSafe(uint8_t* safeFlag) { | |
| return SUCCESS; | ||
| } | ||
|
|
||
| /** | ||
| * Pet the Communications watchdog on the Battery using code 0x22 | ||
| * @return either an error if it occurred, or 0 | ||
| */ | ||
| int batteryPetWatchDog(void) { | ||
| // One way communication so just use transmit using reset watchdog command 0x22 | ||
| int error = i2cTransmit(BATTERY_I2C_SLAVE_ADDR, batteryWatchdogResetCommand, BATTERY_COMMAND_LENGTH); | ||
|
|
||
| if (error != SUCCESS) { | ||
| return error; | ||
| } | ||
|
Comment on lines
+262
to
+264
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was missed |
||
|
|
||
| return SUCCESS; | ||
| } | ||
|
|
||
|
|
||
| /*************************************************************************************************** | ||
| PRIVATE FUNCTIONS | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| #include <RI2c.h> | ||
| #include <string.h> | ||
| #include <RCommon.h> | ||
| #include <RErrorManager.h> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Incude can go into RCommon just like RDebug.h and then you don't Need to have it in every file. |
||
|
|
||
|
|
||
| /*************************************************************************************************** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ missed error