Commit Graph

821 Commits

Author SHA1 Message Date
László Monda
a9ba8a1907 Remove redundant module members. 2017-10-05 19:51:15 +02:00
László Monda
96eb2ef7a3 Make slaves send their protocol version to the master. 2017-10-05 17:55:59 +02:00
László Monda
bd76fb44c2 Make slaves send their module id to the master. 2017-10-05 17:26:10 +02:00
László Monda
21beb59cb6 Add merge sensor state to getKeyboardState() 2017-10-05 14:21:37 +02:00
László Monda
3ed3272fa3 Write the validated user config area to the EEPROM, not the staging area. 2017-10-05 09:12:50 +02: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
259f4d3299 Add config_buffer_id_t. 2017-10-04 23:57:43 +02:00
László Monda
8e420f8592 Rename and rearrange some variables in config_globals.c for better readability. 2017-10-04 22:39:40 +02:00
László Monda
63674e02b7 Now rename the other guard macro, too. I thought it was renamed by the IDE. 2017-10-04 22:36:27 +02:00
László Monda
e27fb83693 Rename guard macro according to the filename. 2017-10-04 22:35:17 +02:00
László Monda
4295793fb9 Add ATTR_* macros in the newly created attributes.h and use them wherever possible for improved readability. 2017-10-04 22:26:48 +02:00
László Monda
f348aec97a Rename UserConfigBuffer to ValidatedUserConfigBuffer. 2017-10-04 22:10:55 +02:00
László Monda
9ecdfc0b71 Improve the readability of ApplyConfig() 2017-10-04 22:06:45 +02:00
László Monda
af52c017d8 No need to assign a value to I2C_WATCHDOG. Just define it. 2017-10-04 13:02:40 +02:00
László Monda
316602bb02 Rename the obsoleted LED_DRIVER_FORCE_UPDATE macro to LED_DRIVER_STRESS_TEST. 2017-10-04 12:59:05 +02:00
László Monda
6658d62805 Group module phases. 2017-10-04 02:52:53 +02:00
László Monda
c707f0e408 Transfer a synchronization message to make I2C recovery more robust. 2017-10-04 02:24:34 +02:00
László Monda
efb0f982d2 Only try to recover I2C if SDA is low. 2017-10-04 01:22:22 +02:00
László Monda
2027940b4c Use the correct I2C_MAIN_BUS_{SDA,SCL}{PORT,PIN} macros at the right spots. 2017-10-04 01:04:56 +02:00
László Monda
e5595bc757 Extract I2C recovery code to recoverI2c() 2017-10-03 23:59:27 +02:00
László Monda
72812724ef Now do send a STOP condition at the end of the I2C recovery which might make it more robust. 2017-10-03 23:37:16 +02:00
László Monda
1daf43b751 Set SDA as GPIO upon trying to recovering I2C, not just SDL. 2017-10-03 23:23:26 +02:00
László Monda
2804d3e447 Don't cycle SDA just before initialzing I2C. Merely pull it high to generate a STOP condition. 2017-10-03 22:05:42 +02:00
László Monda
ff1d5dffaa Cycle through the I2C clock by using 20 cycles instead of 16. Should be a bit more reliable, although I can't see a definite improvement. 2017-10-03 21:56:08 +02:00
László Monda
5de396bb68 Don't mess around with SDA and SCL before cycling through the clock because it seems redundant. 2017-10-03 21:37:35 +02:00
László Monda
7af8042c93 Fine tune delay to match the I2C peripheral driven at 100kHz. 2017-10-03 21:06:04 +02:00
László Monda
51a9acbb68 Extract delay() from InitI2cMainBus() 2017-10-03 20:54:05 +02:00
László Monda
f1a8d9a330 Toggle SCL from a loop. 2017-10-03 20:49:54 +02:00
László Monda
b5f1bcc4d6 Split InitI2c() as InitI2cMainBus() and initI2cEepromBus() and invoke InitI2cMainBus() from PIT_I2C_WATCHDOG_HANDLER() 2017-10-03 20:43:26 +02:00
László Monda
90bad68287 No need to explicitly initialize slaves before starting up the scheduler as the scheduler takes care of them. 2017-10-02 00:03:51 +02:00
László Monda
f921753b63 Call slaveSchedulerCallback() instead of the update callback of the first slave to trigger the slave protocol scheduler. Given that the callback is involved from the start this should result in a more reliable startup state. 2017-10-01 23:54:46 +02:00
László Monda
858586ef2a Fix data size by using I2C_MESSAGE_MAX_TOTAL_LENGTH instead of I2C_MESSAGE_MAX_PAYLOAD_LENGTH. 2017-10-01 22:12:00 +02:00
László Monda
ecc2d2db9a Use I2C_MESSAGE_HEADER_LENGTH instead of magic number. 2017-10-01 22:08:38 +02:00
László Monda
b443b56357 Rename I2C_MESSAGE_MAX_LENGTH to I2C_MESSAGE_MAX_PAYLOAD_LENGTH. 2017-10-01 21:52:41 +02:00
László Monda
42e17ca1bf Rename masterCallback to slaveSchedulerCallback. 2017-10-01 03:15:25 +02:00
László Monda
37cf632f2a Reindent Slaves[] because its lines have gotten overly long. 2017-10-01 02:53:42 +02:00
László Monda
3079d527b1 Add uhk_slave_t.disconnect() callback so that upon disconnecting the left keyboard half, the left LED driver IC can be marked as disconnected too, so it'll be reinitialized upon reconnect. This usually didn't happen because LED states are cached so the LED drivers are rarely spoken to. 2017-10-01 02:47:29 +02:00
László Monda
320923b41c Properly update uhk_slave_t.isConnected by introducing isFirstIteration. 2017-10-01 01:39:12 +02:00
László Monda
b49cb30070 Try to resurrect I2C not only in the watchdog but upon initialization. This may be useful when only the right half reboots after a firmware upgrade. 2017-09-30 22:17:44 +02:00
László Monda
b87042a44a Resurrect the state machine of frozen IS31FL3731 ICs by toggling SCL and SDA. 2017-09-30 20:34:35 +02:00
László Monda
ea71253d6a Remove KEY_STATE_SIZE in favor of the more general BOOL_BYTES_TO_BITS_COUNT() macro. 2017-09-30 00:57:10 +02:00
László Monda
c23d327384 Rename uhkModuleId to uhkModuleDriverId in UhkModuleSlaveDriver_Init() and UhkModuleSlaveDriver_Update() 2017-09-30 00:40:13 +02:00
László Monda
a7b0dfef1d Compute slot id based on module driver id instead of using a hardcoded value. 2017-09-30 00:23:34 +02:00
László Monda
d8de4f0b3e Update variable names. 2017-09-30 00:18:37 +02:00
László Monda
01ef8f59c2 Create separate sections of module driver phases. 2017-09-30 00:14:29 +02:00
László Monda
04047eb128 Make modules send their features (key count and whether they have pointer input) to the master upon enumeration. 2017-09-30 00:08:28 +02:00
László Monda
e7a1d27cde Make private LED driver variables static. 2017-09-29 15:22:52 +02:00
László Monda
877cb78b0a Extract LedDriverValues from LedDriverStates to make them public, and make LedDriverStates values private. 2017-09-29 15:18:01 +02:00
László Monda
0624d088b6 Remove unused LED driver BUFFER_SIZE. 2017-09-29 02:19:12 +02:00
László Monda
1ab984413a Extract ISO key related LED driver macros. 2017-09-29 02:07:55 +02:00