/* Function for adding a key to the key packet. 
If key is found to be in the packet, it will not be added twice. Attempts to add more keys than the buffer capacity allows will be silently ignored. */
static void cherry8x16_keypacket_addkey(uint8_t key)
/* Function for adding a key to the key packet. 
If key is found to be in the packet, it will not be added twice. Attempts to add more keys than the buffer capacity allows will be silently ignored. */
static void cherry8x16_keypacket_addkey(uint8_t key)
{
    for (uint_fast8_t i = KEY_PACKET_KEY_INDEX; i < KEY_PACKET_SIZE; i++)
    {
        if (m_key_packet[i] == key)
        {
            return;
        }
    }
    for (uint_fast8_t i = KEY_PACKET_KEY_INDEX; i < KEY_PACKET_SIZE; i++)
    {
        if (m_key_packet[i] == KEY_PACKET_NO_KEY)
        {
            m_key_packet[i] = key;
            return;
        }
    }
}