Add compiler_support.h (#25274)

This commit is contained in:
Pablo Martínez 2025-05-22 15:31:15 +02:00 committed by GitHub
parent fa24b0fcce
commit 955809bd5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 142 additions and 81 deletions

View file

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>
#include "compiler_support.h"
#include "keyboard.h"
#include "progmem.h"
#include "timer.h"
@ -265,7 +266,7 @@ void st7565_write_char(const char data, bool invert) {
static uint8_t st7565_temp_buffer[ST7565_FONT_WIDTH];
memcpy(&st7565_temp_buffer, st7565_cursor, ST7565_FONT_WIDTH);
_Static_assert(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array");
STATIC_ASSERT(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array");
// set the reder buffer data
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index

View file

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "keyboard.h"
# endif
#endif
#include "compiler_support.h"
#include "oled_driver.h"
#include OLED_FONT_H
#include "timer.h"
@ -601,7 +603,7 @@ void oled_write_char(const char data, bool invert) {
static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);
_Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
STATIC_ASSERT(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
// set the reder buffer data
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index

View file

@ -4,6 +4,7 @@
#pragma once
#include "compiler_support.h"
#include "i2c_master.h"
#include "pointing_device.h"
#include "util.h"
@ -79,7 +80,7 @@ typedef struct {
azoteq_iqs5xx_relative_xy_t y;
} azoteq_iqs5xx_base_data_t;
_Static_assert(sizeof(azoteq_iqs5xx_base_data_t) == 10, "azoteq_iqs5xx_basic_report_t should be 10 bytes");
STATIC_ASSERT(sizeof(azoteq_iqs5xx_base_data_t) == 10, "azoteq_iqs5xx_basic_report_t should be 10 bytes");
typedef struct {
uint8_t number_of_fingers;
@ -87,7 +88,7 @@ typedef struct {
azoteq_iqs5xx_relative_xy_t y;
} azoteq_iqs5xx_report_data_t;
_Static_assert(sizeof(azoteq_iqs5xx_report_data_t) == 5, "azoteq_iqs5xx_report_data_t should be 5 bytes");
STATIC_ASSERT(sizeof(azoteq_iqs5xx_report_data_t) == 5, "azoteq_iqs5xx_report_data_t should be 5 bytes");
typedef struct PACKED {
bool sw_input : 1;
@ -159,7 +160,7 @@ typedef struct PACKED {
uint16_t zoom_consecutive_distance;
} azoteq_iqs5xx_gesture_config_t;
_Static_assert(sizeof(azoteq_iqs5xx_gesture_config_t) == 24, "azoteq_iqs5xx_gesture_config_t should be 24 bytes");
STATIC_ASSERT(sizeof(azoteq_iqs5xx_gesture_config_t) == 24, "azoteq_iqs5xx_gesture_config_t should be 24 bytes");
typedef struct {
uint16_t x_resolution;

View file

@ -10,6 +10,7 @@
#pragma once
#include "compiler_support.h"
#include "keyboard.h"
#include <stdint.h>
#include "spi_master.h"
@ -39,8 +40,8 @@ typedef struct __attribute__((packed)) {
int16_t delta_y; // displacement on y directions.
} pmw33xx_report_t;
_Static_assert(sizeof(pmw33xx_report_t) == 6, "pmw33xx_report_t must be 6 bytes in size");
_Static_assert(sizeof((pmw33xx_report_t){0}.motion) == 1, "pmw33xx_report_t.motion must be 1 byte in size");
STATIC_ASSERT(sizeof(pmw33xx_report_t) == 6, "pmw33xx_report_t must be 6 bytes in size");
STATIC_ASSERT(sizeof((pmw33xx_report_t){0}.motion) == 1, "pmw33xx_report_t.motion must be 1 byte in size");
#if !defined(PMW33XX_CLOCK_SPEED)
# define PMW33XX_CLOCK_SPEED 2000000