Commit Graph

79 Commits

Author SHA1 Message Date
László Monda
f80a88c419 RX messages are per-module by nature, so instead of using a singleton, add rxMessage to uhk_module_state_t. 2017-09-28 17:17:30 +02:00
László Monda
3fda14df27 Update the coding style of dereference operators. 2017-09-28 17:09:59 +02:00
László Monda
ef2c4a1e7f Add uhk_module_state_t containing module variables and phase. Merge uhkModuleTargetStates and uhkModulePhases to uhkModuleStates. 2017-09-28 17:06:56 +02:00
László Monda
de21cfc07e Rename uhk_module_state_t to uhk_module_vars_t. 2017-09-28 16:57:46 +02:00
László Monda
8b5b224bf3 Compute KEY_STATE_SIZE the right way. 2017-09-28 04:05:44 +02:00
László Monda
9a42123648 Rename kStatus_Uhk_NoOp to kStatus_Uhk_NoTransfer. 2017-09-28 03:30:32 +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
ecf1ad2468 Don't use the extern keyword for functions because it's redundant. 2017-09-28 02:37:55 +02:00
László Monda
41c2556386 Use the static keyword wherever it's valid inside of uhk_module_driver.c 2017-09-28 02:26:56 +02:00
László Monda
5473c102ec Add per-module UHK module phases. 2017-09-28 02:24:28 +02:00
László Monda
d43bbbbf51 Not being an extern function, lowerCamelCase uhkModuleTargetStates. 2017-09-28 02:14:40 +02:00
László Monda
9a4c49e9a6 Extract MAX_PWM_BRIGHTNESS. 2017-09-28 01:35:04 +02:00
László Monda
d4124d8331 Cache UHK module state variables and only tranfer them when changed. 2017-09-28 01:30:27 +02:00
László Monda
9dde9ee917 Replace SLOT_ID_* macros with SlotId_* enum values. 2017-09-26 20:01:18 +02:00
László Monda
3bd943aa85 Extract rx() and tx(). 2017-09-26 19:19:44 +02:00
László Monda
b88c6e4291 Add i2c_message_t and use it all across the codebase. This will allow handling variable-length I2C messages and validation with minimal effort. The test LED and brightness PWM update features got temporarily broken and will fix them soon. 2017-09-25 03:03:14 +02:00
László Monda
ef9d9ee9a7 Add kStatus_Uhk_NoOp and make the scheduler handle it. 2017-09-22 14:32:43 +02:00
László Monda
2aa74853b5 Add UhkModulePhase_ProcessKeystates and extract relevant code into its section. 2017-09-22 03:13:53 +02:00
László Monda
cc57daa674 Rename UhkModulePhase_SendTestLedCommand to UhkModulePhase_SetTestLed 2017-09-22 02:59:12 +02:00
László Monda
2e33a83e29 Rename UhkModulePhase_SendPwmBrightnessCommand to UhkModulePhase_SetLedPwmBrightness 2017-09-22 02:55:00 +02:00
László Monda
43c07dde21 Rename UhkModulePhase_SendKeystatesRequestCommand to UhkModulePhase_RequestKeyStates 2017-09-22 02:51:01 +02:00
László Monda
ac138d2da6 Rename SlaveCommand_GetKeyStates to SlaveCommand_RequestKeyStates 2017-09-22 02:47:05 +02:00
László Monda
5c8138f123 Be more specific by using IC names instead of generic names like LED driver or touchpad. 2017-09-20 13:13:57 +02:00
László Monda
4d5214fdc9 Add I2C addresses for add-ons and touchpad modules. 2017-09-20 02:21:39 +02:00
László Monda
946d3c1451 Add kStatus_Uhk_IdleSlave and ditch the global IsI2cTransferScheduled. Make slave drivers return status_t and utilize that value instead. 2017-08-19 17:47:56 +02:00
László Monda
430c02f0ed Remove test actions and related code. 2017-08-19 13:32:02 +02:00
László Monda
a954c63f62 Rename LedDriverPhase_Initialized to LedDriverPhase_UpdateChangedLedValues 2017-08-19 13:07:21 +02:00
László Monda
992fea28ad Split LED_DRIVER_STRESS_TEST as I2C_WATCHDOG and LED_DRIVER_FORCE_UPDATE 2017-08-19 12:31:49 +02:00
László Monda
f7bc6a8f82 Don't memcpy source LED values to target values when LED_DRIVER_STRESS_TEST is set because it's redundant. 2017-08-19 11:58:39 +02:00
László Monda
f56290aa62 Branch based on LED_DRIVER_STRESS_TEST in is31fl3731_driver.c 2017-08-10 15:42:02 +02:00
László Monda
31b01864eb Make sure to send no more than LED_DRIVER_LED_COUNT LED values to the LED driver IC even if LED_DRIVER_LED_COUNT is not an exact multiple of PMW_REGISTER_UPDATE_CHUNK_SIZE. 2017-08-10 15:07:03 +02:00
László Monda
f9583eb4f4 Copy source LED values to target LED values after LedDriverPhase_InitLedValues finished executing. 2017-08-10 13:25:15 +02:00
László Monda
9c5e86df11 Place curly in the same line as LedDriverPhase_Initialized. 2017-08-10 13:20:35 +02:00
László Monda
e9976f6888 Explicitly initialize all LED values in LedDriverPhase_InitLedValues before moving on to LedDriverPhase_Initialized. 2017-08-10 13:16:37 +02:00
László Monda
c81291346f Initialize target LED values with zeros, so that they'll be explicitly set to non-zero values by the LED updater algorithm. This makes the desired LEDs light up. 2017-08-10 01:13:04 +02:00
László Monda
7a45fd7e6c Add uhk_module_id_t. Use UhkModuleId_LeftKeyboardHalf in the Slaves array. Set UHK_MODULE_MAX_COUNT to 3. 2017-08-09 00:02:44 +02:00
László Monda
68e2dab576 Add config.h and move LED_DRIVER_STRESS_TEST and FIXED_BUSPAL_BOOTLOADER to it. 2017-08-06 17:28:32 +02:00
László Monda
01baa31241 Rename slave_driver_led_driver.[ch] to is31fl3731_driver.[ch] 2017-08-06 16:09:33 +02:00
László Monda
fef35bf68e Rename slave_driver_uhk_module.[ch] to uhk_module_driver.[ch] 2017-08-06 16:06:40 +02:00
László Monda
78eac147d6 Only delay the initialization of the left LED driver until the KL03 pulls up its SDB. 2017-08-03 01:42:11 +02:00
László Monda
546ca5d0b2 Implement much more efficient LED driver updater algorithm that only talks to the LED driver ICs when necessary. Add LED_DRIVER_STRESS_TEST macro. 2017-07-31 17:30:33 +02:00
Eric Tang
58899f092d Merge branch 'led-display' of https://github.com/UltimateHackingKeyboard/firmware into led-display 2017-07-14 11:02:49 -07:00
László Monda
7ed508943f Try to display "ABC" on the display. 2017-07-14 19:51:56 +02:00
Eric Tang
59d03cc5b9 Merge branch 'master' into led-display 2017-07-14 09:27:32 -07:00
László Monda
282c77c850 Fix LED driver update, so it'll keep working after initialization. 2017-07-14 17:40:41 +02:00
Eric Tang
335c77a158 Expose LedDriverStates 2017-07-12 20:44:18 -07:00
Eric Tang
595ced9902 Treat the LED driver as a peripheral with a driver 2017-07-12 20:03:50 -07:00
László Monda
f8883e416d Rename slaves to Slaves now that it's extern. 2017-06-01 11:01:49 +02:00
László Monda
d0678bbb51 Make sure that SDB of the LED driver is pulled high before talking to it over I2C. 2017-06-01 10:59:41 +02:00
László Monda
7be20e34c2 Reinitialize slaves after reconnecting them. 2017-06-01 01:32:57 +02:00