tmk_keyboard icon indicating copy to clipboard operation
tmk_keyboard copied to clipboard

User Definable NUM_LAYERS. Builds upon layer_state_t

Open alex-ong opened this issue 7 years ago • 1 comments

Users can now define NUM_LAYERS. I haven't yet tested:

#if NUM_LAYERS > 16   // layer_state is uint32_t
    return action.layer_bitop.part*4;
#elif NUM_LAYERS > 8   // unit16_t
    return (action.layer_bitop.part & 3)*4;
#else  // uint8_t
    return (action.layer_bitop.part & 1)*4;
#endif
  • Major space saving from using uint8_t instead of uint32_t, on the order of 300+ bytes.
  • Minor time saving for all the bitshifts.

TODO: define constant "Layer_size_ONE" as ((layer_state_t)1) for all bitshifting everywhere.

alex-ong avatar Jan 24 '18 06:01 alex-ong

I pulled the changes and did quick test, it looks promissing! I'll look into codes closely and do some tests later.

For someone intrested this PR is related to this discussion #523 and supercedes PR #526.

tmk avatar Jan 25 '18 06:01 tmk