Add compiler_support.h (#25274)
This commit is contained in:
parent
fa24b0fcce
commit
955809bd5a
36 changed files with 142 additions and 81 deletions
|
|
@ -13,6 +13,8 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "compiler_support.h"
|
||||
#include "split_util.h"
|
||||
#include "matrix.h"
|
||||
#include "keyboard.h"
|
||||
|
|
@ -62,7 +64,7 @@ static struct {
|
|||
} split_config;
|
||||
|
||||
#if defined(SPLIT_USB_DETECT)
|
||||
_Static_assert((SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL) <= UINT16_MAX, "Please lower SPLIT_USB_TIMEOUT and/or increase SPLIT_USB_TIMEOUT_POLL.");
|
||||
STATIC_ASSERT((SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL) <= UINT16_MAX, "Please lower SPLIT_USB_TIMEOUT and/or increase SPLIT_USB_TIMEOUT_POLL.");
|
||||
static bool usb_bus_detected(void) {
|
||||
for (uint16_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
|
||||
// This will return true if a USB connection has been established
|
||||
|
|
@ -88,9 +90,9 @@ static inline bool usb_bus_detected(void) {
|
|||
# endif
|
||||
# endif
|
||||
# if defined(SPLIT_USB_DETECT)
|
||||
_Static_assert(SPLIT_USB_TIMEOUT < SPLIT_WATCHDOG_TIMEOUT, "SPLIT_WATCHDOG_TIMEOUT should not be below SPLIT_USB_TIMEOUT.");
|
||||
STATIC_ASSERT(SPLIT_USB_TIMEOUT < SPLIT_WATCHDOG_TIMEOUT, "SPLIT_WATCHDOG_TIMEOUT should not be below SPLIT_USB_TIMEOUT.");
|
||||
# endif
|
||||
_Static_assert(SPLIT_MAX_CONNECTION_ERRORS > 0, "SPLIT_WATCHDOG_ENABLE requires SPLIT_MAX_CONNECTION_ERRORS be above 0 for a functioning disconnection check.");
|
||||
STATIC_ASSERT(SPLIT_MAX_CONNECTION_ERRORS > 0, "SPLIT_WATCHDOG_ENABLE requires SPLIT_MAX_CONNECTION_ERRORS be above 0 for a functioning disconnection check.");
|
||||
|
||||
static uint32_t split_watchdog_started = 0;
|
||||
static bool split_watchdog_done = false;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "compiler_support.h"
|
||||
|
||||
enum serial_transaction_id {
|
||||
#ifdef USE_I2C
|
||||
I2C_EXECUTE_CALLBACK,
|
||||
|
|
@ -122,4 +124,4 @@ enum serial_transaction_id {
|
|||
};
|
||||
|
||||
// Ensure we only use 5 bits for transaction
|
||||
_Static_assert(NUM_TOTAL_TRANSACTIONS <= (1 << 5), "Max number of usable transactions exceeded");
|
||||
STATIC_ASSERT(NUM_TOTAL_TRANSACTIONS <= (1 << 5), "Max number of usable transactions exceeded");
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <string.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "compiler_support.h"
|
||||
#include "transactions.h"
|
||||
#include "transport.h"
|
||||
#include "transaction_id_define.h"
|
||||
|
|
@ -36,7 +37,7 @@
|
|||
# include "i2c_slave.h"
|
||||
|
||||
// Ensure the I2C buffer has enough space
|
||||
_Static_assert(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shared_memory_t too large for I2C_SLAVE_REG_COUNT");
|
||||
STATIC_ASSERT(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shared_memory_t too large for I2C_SLAVE_REG_COUNT");
|
||||
|
||||
split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue