mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] ExamMode: add comment
This commit is contained in:
committed by
LeaNumworks
parent
3454265d7e
commit
0254266803
@@ -107,8 +107,11 @@ void IncrementExamMode(uint8_t delta) {
|
||||
}
|
||||
|
||||
// Write the value in flash
|
||||
/* Avoid writing out of sector */
|
||||
/* As the number of changed bits is capped by 2, if *writingAddress has more
|
||||
* than one remaining 1 bit, we know we toggle bits only in the first byte of
|
||||
* newValue. We can settle for writing one byte instead of two. */
|
||||
size_t writtenFlash = *writingAddress == 1 ? sizeof(uint16_t) : sizeof(uint8_t);
|
||||
/* Avoid writing out of sector */
|
||||
assert(writingAddress < (uint8_t *)&_exam_mode_buffer_end - 1 || (writingAddress == (uint8_t *)&_exam_mode_buffer_end - 1 && writtenFlash == 1));
|
||||
Ion::Device::Flash::WriteMemory(writingAddress, newValue, writtenFlash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user