Commit Graph
1712 Commits
Author SHA1 Message Date
László Monda 7061345ec2 Fix hard faults by moving slaveConfig and slaveHandle out of InitI2c(), thereby making them always available for KSDK. Fixed by @santiagogf89. 2017-10-03 19:15:33 +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 724d72132a Rearrange slave_command_t enum values a bit to reflect their relative importance and rearrange a related case block too. 2017-10-01 22:21:00 +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 6edf4113a4 Make the slave check message integrity and only process if it's valid. 2017-10-01 22:05:20 +02:00
László Monda 1b1111e9da Rename I2C_BUFFER_MAX_LENGTH to I2C_MESSAGE_MAX_TOTAL_LENGTH. 2017-10-01 21:55:37 +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 4ade25d739 Add I2C_MESSAGE_HEADER_LENGTH and use it in i2cSlaveCallback() instead of magic numbers. 2017-10-01 21:42:55 +02:00
László Monda 0ba979a658 Refactor i2cSlaveCallback(). 2017-10-01 21:38:02 +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 894103a944 Disable the watchdog of the left half because for some reason it makes I2C recovery less reliable. 2017-09-30 20:54:27 +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 cec8bbfe01 Clone InitI2c() as InitI2cV2() and use it in the LPTMR interrupt handler to avoid the hard fault. 2017-09-30 17:06:17 +02:00
László Monda 3e5767e141 Use KEYBOARD_MATRIX_ROWS_NUM and KEYBOARD_MATRIX_COLS_NUM to compute MODULE_KEY_COUNT. 2017-09-30 01:11:12 +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 abc1923897 Rename LEFT_KEYBOARD_HALF_KEY_COUNT to MODULE_KEY_COUNT. 2017-09-30 00:47:15 +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 fad17aeb32 Add example for switch-case. 2017-09-29 02:26: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
László Monda 92c0da9695 For the sake of correctness, only initialize the LED driver control register of the ISO key for the left LED driver IC. 2017-09-29 01:53:08 +02:00
László Monda 07142c3ce2 Fix coding style. 2017-09-29 01:46:51 +02:00
László Monda 81de51244a Leave some breathing room in dense code blocks. 2017-09-29 01:39:34 +02:00
László Monda 2b6762d3e0 Indent cases inside switches. 2017-09-29 01:35:25 +02:00
László Monda 28f0cdd2c0 Use LED_BRIGHTNESS_LEVEL in led_display.c instead of magic values. 2017-09-29 01:33:21 +02:00
László Monda eb2d7ada3a Extract LED_BRIGHTNESS_LEVEL. 2017-09-29 01:30:02 +02:00
László Monda 76a80c3090 Inline SetLeds() 2017-09-29 01:27:34 +02:00
László Monda 67c4b413b4 Remove SetLeds() from slave_scheduler.h 2017-09-29 01:21:49 +02:00
László Monda b42fc8b3f1 Remove module declarations that won't be used. 2017-09-29 01:19:02 +02:00
László Monda 8909bb6a16 Convert MODULE_ID_* macros to ModuleId_* enum values. 2017-09-29 01:09:41 +02:00
László Monda d6254b6903 Extract I2C_WATCHDOG_INTERVAL_USEC. 2017-09-29 01:01:29 +02:00
László Monda 7313d8d87e Fix the grammar of watchdog interrupt related comment and don't include specific timeout as it may change later. 2017-09-29 00:58:52 +02:00
László Monda 7d1cecc2b4 Move macros from i2c_watchdog.c to i2c_watchdog.h 2017-09-29 00:54:57 +02:00
László Monda 1889f78b98 Make previousSlaveId and currentSlaveId static. 2017-09-29 00:52:43 +02:00
László Monda 827ad7e08e Rename BridgeCounter to I2cSchedulerCounter and move it to the top of masterCallback. 2017-09-29 00:50:56 +02:00
László Monda 508ef870ae Rename I2C_Watchdog*Counter to I2cWatchdog_*Counter. 2017-09-29 00:44:22 +02:00
László Monda 69f3c86185 Rename UhkModuleId_* to UhkModuleDriverId_*. 2017-09-28 23:26:58 +02:00
László Monda 8b180d94b0 No need to zero prevWatchdogCounter because it's zero by default. 2017-09-28 23:23:19 +02:00