Commit Graph

27 Commits

Author SHA1 Message Date
László Monda
51b2631012 Make saving the user configuration faster by only writing the part of the EEPROM which actually contains the user configuration. Resolves #111. 2018-05-15 02:40:21 +02:00
Kristian Sloth Lauszus
e12e219b4e Various fixes and improvements (#96)
* Global variables shared between an interrupt and the main code should be volatile

See: https://www.embedded.com/electronics-blogs/beginner-s-corner/4023801/Introduction-to-the-Volatile-Keyword

* There is no reason to change the active report if it has not changed

* Declare local functions and variables static

This both helps the compiler and the programmer
2018-03-11 19:19:15 +01:00
László Monda
5798f9e4fb Refactor UsbCommandId_LaunchEepromTransfer, change its arguments, and change its ID to 0x08. 2017-12-12 03:24:34 +01:00
László Monda
086ab239b4 Fix the previously introduced EEPROM read bug by making addressBuffer static. Rename EEPROM_ADDRESS_LENGTH to EEPROM_ADDRESS_SIZE. 2017-11-18 03:18:37 +01:00
László Monda
a7ba0add18 Simplify eeprom.c 2017-11-18 03:11:17 +01:00
László Monda
5c7a3faa9c Use buffer functions in eeprom.c for easier readability. 2017-11-11 03:41:03 +01:00
László Monda
f45ebdde4f Comment that the EEPROM address has to be big-endian. 2017-11-11 01:15:27 +01:00
László Monda
377fe4a2b2 Make EEPROM transfers receive an operation and a buffer id parameter. This allows reading and writing both staging and validated user configurations which will aid future debugging. This API is also cleaner. 2017-10-05 02:45:22 +02:00
László Monda
f348aec97a Rename UserConfigBuffer to ValidatedUserConfigBuffer. 2017-10-04 22:10:55 +02:00
László Monda
751810ec4c Explicitly add void to the argument list of zero argument functions. 2017-09-28 03:03:11 +02:00
László Monda
e6b5b3b3a5 Read the hardware configuration area and the user configuration area of the EEPROM into the RAM and try to apply it. 2017-09-14 09:55:29 +02:00
László Monda
dd5a0e058d Split config_state.[ch] to config_globals.[ch] and basic_types.[ch] 2017-08-08 23:22:18 +02:00
László Monda
f779f3ec6f Rename the config directory to config_parser. 2017-08-06 16:52:04 +02:00
László Monda
b5fd93f578 Send address bytes to the EEPROM in the right order. 2017-07-26 16:11:41 +02:00
László Monda
19b3a73e3d Correctly maintain the state of the isEepromBusy flag during reads. Make sure the correct EEPROM memory offsets are sent when dealing with the user configuration. 2017-07-26 13:34:24 +02:00
László Monda
b48e2b42d3 Stop reading when the desired amount of bytes have been read. 2017-07-26 02:11:55 +02:00
László Monda
f5d794ec98 Deal with NAKs in the I2C callback while the EEPROM is busy persisting the data. 2017-07-26 00:49:30 +02:00
László Monda
35f78f542d Write all the bytes to the EEPROM that are needed to be written, including the last 2 bytes. 2017-07-25 23:57:06 +02:00
László Monda
3d98a66b64 Rename pageLength to writeLength and improve readability a bit. 2017-07-23 14:47:16 +02:00
László Monda
65ff2bf799 Slighly improve readability. 2017-07-23 14:44:48 +02:00
László Monda
e601ee6c3c Rename setStartAddressCommand to eepromStartAddress. 2017-07-23 14:36:00 +02:00
László Monda
b6a0470bdb Set IsEepromBusy at the right time inside of the I2C callback when dealing with EepromTransfer_Write*Configuration. 2017-07-23 14:33:26 +02:00
László Monda
a5c088689e Use the EEPROM_ADDRESS_LENGTH macro instead of a magic constant. 2017-07-23 14:30:56 +02:00
László Monda
87cee8b8eb Always update LastEepromTransferStatus in the beginning of i2cCallback() 2017-07-23 14:04:48 +02:00
László Monda
d399d5f1bf Stop writing the EEPROM when every byte has been transferred. 2017-07-23 14:03:26 +02:00
László Monda
d87c22a1e1 Abort EEPROM I2C callback if its status is anything but success. 2017-07-23 13:58:35 +02:00
László Monda
8ed4a6ba09 Separate the configuration to hardware configuration and user configuration. Implement async I2C EEPROM handling. Remove USB functions that dealt with EEPROM and individual LEDs because they were dependent on sync I2C functions. 2017-07-22 23:49:47 +02:00