diff --git a/lib/cbor/include/cbor.h b/lib/cbor/include/cbor.h index 0193aaa1c..3d8aac801 100644 --- a/lib/cbor/include/cbor.h +++ b/lib/cbor/include/cbor.h @@ -54,13 +54,13 @@ uint32_t cbor_decode_array_size(cbor_value_t *dec, cbor_container_t *array); cbor_result_t cbor_decode_map(cbor_value_t *dec, cbor_container_t *map); uint32_t cbor_decode_map_size(cbor_value_t *dec, cbor_container_t *map); -cbor_result_t cbor_decode_uint8(cbor_value_t *dec, uint8_t *val); -cbor_result_t cbor_decode_uint16(cbor_value_t *dec, uint16_t *val); -cbor_result_t cbor_decode_uint32(cbor_value_t *dec, uint32_t *val); +cbor_result_t cbor_decode_uint8_t(cbor_value_t *dec, uint8_t *val); +cbor_result_t cbor_decode_uint16_t(cbor_value_t *dec, uint16_t *val); +cbor_result_t cbor_decode_uint32_t(cbor_value_t *dec, uint32_t *val); -cbor_result_t cbor_decode_int8(cbor_value_t *dec, int8_t *val); -cbor_result_t cbor_decode_int16(cbor_value_t *dec, int16_t *val); -cbor_result_t cbor_decode_int32(cbor_value_t *dec, int32_t *val); +cbor_result_t cbor_decode_int8_t(cbor_value_t *dec, int8_t *val); +cbor_result_t cbor_decode_int16_t(cbor_value_t *dec, int16_t *val); +cbor_result_t cbor_decode_int32_t(cbor_value_t *dec, int32_t *val); cbor_result_t cbor_decode_float(cbor_value_t *dec, float *val); @@ -80,13 +80,13 @@ cbor_result_t cbor_encode_array_indefinite(cbor_value_t *enc); cbor_result_t cbor_encode_map_indefinite(cbor_value_t *enc); cbor_result_t cbor_encode_end_indefinite(cbor_value_t *enc); -cbor_result_t cbor_encode_uint8(cbor_value_t *enc, const uint8_t *val); -cbor_result_t cbor_encode_uint16(cbor_value_t *enc, const uint16_t *val); -cbor_result_t cbor_encode_uint32(cbor_value_t *enc, const uint32_t *val); +cbor_result_t cbor_encode_uint8_t(cbor_value_t *enc, const uint8_t *val); +cbor_result_t cbor_encode_uint16_t(cbor_value_t *enc, const uint16_t *val); +cbor_result_t cbor_encode_uint32_t(cbor_value_t *enc, const uint32_t *val); -cbor_result_t cbor_encode_int8(cbor_value_t *enc, const int8_t *val); -cbor_result_t cbor_encode_int16(cbor_value_t *enc, const int16_t *val); -cbor_result_t cbor_encode_int32(cbor_value_t *enc, const int32_t *val); +cbor_result_t cbor_encode_int8_t(cbor_value_t *enc, const int8_t *val); +cbor_result_t cbor_encode_int16_t(cbor_value_t *enc, const int16_t *val); +cbor_result_t cbor_encode_int32_t(cbor_value_t *enc, const int32_t *val); cbor_result_t cbor_encode_float(cbor_value_t *enc, const float *val); diff --git a/lib/cbor/src/cbor.c b/lib/cbor/src/cbor.c index 7fb5aa233..1fe3ee2c8 100644 --- a/lib/cbor/src/cbor.c +++ b/lib/cbor/src/cbor.c @@ -280,21 +280,21 @@ uint32_t cbor_decode_map_size(cbor_value_t *dec, cbor_container_t *map) { return UINT32_MAX; } -cbor_result_t cbor_decode_uint8(cbor_value_t *dec, uint8_t *val) { +cbor_result_t cbor_decode_uint8_t(cbor_value_t *dec, uint8_t *val) { cbor_result_t type = _cbor_decode_ensure_type(dec, CBOR_TYPE_UINT); if (type < 0) { return type; } return _cbor_advance(dec, _cbor_decode_raw(dec, (uint8_t *)val, CBOR_SIZE_BYTE)); } -cbor_result_t cbor_decode_uint16(cbor_value_t *dec, uint16_t *val) { +cbor_result_t cbor_decode_uint16_t(cbor_value_t *dec, uint16_t *val) { cbor_result_t type = _cbor_decode_ensure_type(dec, CBOR_TYPE_UINT); if (type < 0) { return type; } return _cbor_advance(dec, _cbor_decode_raw(dec, (uint8_t *)val, CBOR_SIZE_SHORT)); } -cbor_result_t cbor_decode_uint32(cbor_value_t *dec, uint32_t *val) { +cbor_result_t cbor_decode_uint32_t(cbor_value_t *dec, uint32_t *val) { cbor_result_t type = _cbor_decode_ensure_type(dec, CBOR_TYPE_UINT); if (type < 0) { return type; @@ -302,7 +302,7 @@ cbor_result_t cbor_decode_uint32(cbor_value_t *dec, uint32_t *val) { return _cbor_advance(dec, _cbor_decode_raw(dec, (uint8_t *)val, CBOR_SIZE_WORD)); } -cbor_result_t cbor_decode_int8(cbor_value_t *dec, int8_t *val) { +cbor_result_t cbor_decode_int8_t(cbor_value_t *dec, int8_t *val) { if (_cbor_remaining(dec) <= 0) { return CBOR_ERR_EOF; } @@ -322,7 +322,7 @@ cbor_result_t cbor_decode_int8(cbor_value_t *dec, int8_t *val) { } return res; } -cbor_result_t cbor_decode_int16(cbor_value_t *dec, int16_t *val) { +cbor_result_t cbor_decode_int16_t(cbor_value_t *dec, int16_t *val) { if (_cbor_remaining(dec) <= 0) { return CBOR_ERR_EOF; } @@ -342,7 +342,7 @@ cbor_result_t cbor_decode_int16(cbor_value_t *dec, int16_t *val) { } return res; } -cbor_result_t cbor_decode_int32(cbor_value_t *dec, int32_t *val) { +cbor_result_t cbor_decode_int32_t(cbor_value_t *dec, int32_t *val) { if (_cbor_remaining(dec) <= 0) { return CBOR_ERR_EOF; } @@ -404,7 +404,7 @@ cbor_result_t cbor_decode_float(cbor_value_t *dec, float *val) { switch (type) { case CBOR_TYPE_NINT: { int32_t intval = 0; - cbor_result_t res = cbor_decode_int32(dec, &intval); + cbor_result_t res = cbor_decode_int32_t(dec, &intval); if (res < CBOR_OK) { return res; } @@ -414,7 +414,7 @@ cbor_result_t cbor_decode_float(cbor_value_t *dec, float *val) { case CBOR_TYPE_UINT: { uint32_t intval = 0; - cbor_result_t res = cbor_decode_uint32(dec, &intval); + cbor_result_t res = cbor_decode_uint32_t(dec, &intval); if (res < CBOR_OK) { return res; } @@ -522,31 +522,31 @@ cbor_result_t cbor_encode_end_indefinite(cbor_value_t *enc) { return CBOR_OK; } -cbor_result_t cbor_encode_uint8(cbor_value_t *enc, const uint8_t *val) { +cbor_result_t cbor_encode_uint8_t(cbor_value_t *enc, const uint8_t *val) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } -cbor_result_t cbor_encode_uint16(cbor_value_t *enc, const uint16_t *val) { +cbor_result_t cbor_encode_uint16_t(cbor_value_t *enc, const uint16_t *val) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } -cbor_result_t cbor_encode_uint32(cbor_value_t *enc, const uint32_t *val) { +cbor_result_t cbor_encode_uint32_t(cbor_value_t *enc, const uint32_t *val) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } -cbor_result_t cbor_encode_int8(cbor_value_t *enc, const int8_t *val) { +cbor_result_t cbor_encode_int8_t(cbor_value_t *enc, const int8_t *val) { if (*val >= 0) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } uint8_t proxy = (uint8_t)(-*val - 1); return _cbor_encode_raw(enc, CBOR_TYPE_NINT, (const uint8_t *)&proxy, _cbor_size_for_value(proxy)); } -cbor_result_t cbor_encode_int16(cbor_value_t *enc, const int16_t *val) { +cbor_result_t cbor_encode_int16_t(cbor_value_t *enc, const int16_t *val) { if (*val >= 0) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } uint16_t proxy = (uint16_t)(-*val - 1); return _cbor_encode_raw(enc, CBOR_TYPE_NINT, (const uint8_t *)&proxy, _cbor_size_for_value(proxy)); } -cbor_result_t cbor_encode_int32(cbor_value_t *enc, const int32_t *val) { +cbor_result_t cbor_encode_int32_t(cbor_value_t *enc, const int32_t *val) { if (*val >= 0) { return _cbor_encode_raw(enc, CBOR_TYPE_UINT, (const uint8_t *)val, _cbor_size_for_value(*val)); } diff --git a/lib/cbor/test/main.c b/lib/cbor/test/main.c index 9c48b6b07..701618c12 100644 --- a/lib/cbor/test/main.c +++ b/lib/cbor/test/main.c @@ -66,7 +66,7 @@ cbor_result_t print_value(cbor_value_t *dec, cJSON *decoded) { } case CBOR_TYPE_UINT: { uint32_t val = 0; - cbor_result_t res = cbor_decode_uint32(dec, &val); + cbor_result_t res = cbor_decode_uint32_t(dec, &val); if (res < CBOR_OK) { printf("CBOR uint error %d\n", res); return res; @@ -80,7 +80,7 @@ cbor_result_t print_value(cbor_value_t *dec, cJSON *decoded) { } case CBOR_TYPE_NINT: { int32_t val = 0; - cbor_result_t res = cbor_decode_int32(dec, &val); + cbor_result_t res = cbor_decode_int32_t(dec, &val); if (res < CBOR_OK) { printf("CBOR int error %d\n", res); return res; @@ -199,7 +199,7 @@ int main(int argc, char const *argv[]) { cbor_value_t enc; { cbor_encoder_init(&enc, buf, 512); - cbor_encode_uint16(&enc, 1337); + cbor_encode_uint16_t(&enc, 1337); uint32_t len = cbor_encoder_len(&enc); cbor_value_t dec; @@ -208,7 +208,7 @@ int main(int argc, char const *argv[]) { } { cbor_encoder_init(&enc, buf, 512); - cbor_encode_int16(&enc, -1337); + cbor_encode_int16_t(&enc, -1337); uint32_t len = cbor_encoder_len(&enc); cbor_value_t dec; @@ -237,8 +237,8 @@ int main(int argc, char const *argv[]) { cbor_encoder_init(&enc, buf, 512); cbor_encode_array(&enc, 3); - cbor_encode_uint16(&enc, 1337); - cbor_encode_int16(&enc, -1337); + cbor_encode_uint16_t(&enc, 1337); + cbor_encode_int16_t(&enc, -1337); cbor_encode_float(&enc, -13.37f); uint32_t len = cbor_encoder_len(&enc); @@ -251,9 +251,9 @@ int main(int argc, char const *argv[]) { cbor_encode_map(&enc, 3); cbor_encode_tstr(&enc, (uint8_t *)"KEY1", 4); - cbor_encode_uint16(&enc, 1337); + cbor_encode_uint16_t(&enc, 1337); cbor_encode_tstr(&enc, (uint8_t *)"KEY2", 4); - cbor_encode_int16(&enc, -1337); + cbor_encode_int16_t(&enc, -1337); cbor_encode_tstr(&enc, (uint8_t *)"KEY3", 4); cbor_encode_float(&enc, -13.37f); uint32_t len = cbor_encoder_len(&enc); @@ -267,9 +267,9 @@ int main(int argc, char const *argv[]) { cbor_encode_map_indefinite(&enc); cbor_encode_tstr(&enc, (uint8_t *)"KEY1", 4); - cbor_encode_uint16(&enc, 1337); + cbor_encode_uint16_t(&enc, 1337); cbor_encode_tstr(&enc, (uint8_t *)"KEY2", 4); - cbor_encode_int16(&enc, -1337); + cbor_encode_int16_t(&enc, -1337); cbor_encode_tstr(&enc, (uint8_t *)"KEY3", 4); cbor_encode_float(&enc, -13.37f); cbor_encode_end_indefinite(&enc); diff --git a/src/core/debug.c b/src/core/debug.c index eb598d269..2264ff6e3 100644 --- a/src/core/debug.c +++ b/src/core/debug.c @@ -62,7 +62,7 @@ void perf_counter_update() { #define ENCODE_CYCLES(val) \ { \ const uint32_t us = (val) / (SYS_CLOCK_FREQ_HZ / 1000000); \ - CBOR_CHECK_ERROR(res = cbor_encode_uint32(enc, &us)); \ + CBOR_CHECK_ERROR(res = cbor_encode_uint32_t(enc, &us)); \ } cbor_result_t cbor_encode_perf_counters(cbor_value_t *enc) { diff --git a/src/core/flash.c b/src/core/flash.c index 193de5920..fda6f5287 100644 --- a/src/core/flash.c +++ b/src/core/flash.c @@ -18,12 +18,12 @@ flash_storage_t flash_storage; rx_bind_storage_t bind_storage; CBOR_START_STRUCT_ENCODER(rx_bind_storage_t) -CBOR_ENCODE_MEMBER(bind_saved, uint8) +CBOR_ENCODE_MEMBER(bind_saved, uint8_t) CBOR_ENCODE_BSTR_MEMBER(raw, BIND_RAW_STORAGE_SIZE) CBOR_END_STRUCT_ENCODER() CBOR_START_STRUCT_DECODER(rx_bind_storage_t) -CBOR_DECODE_MEMBER(bind_saved, uint8) +CBOR_DECODE_MEMBER(bind_saved, uint8_t) CBOR_DECODE_BSTR_MEMBER(raw, BIND_RAW_STORAGE_SIZE) CBOR_END_STRUCT_DECODER() diff --git a/src/core/profile.c b/src/core/profile.c index a63fd8350..c074550fb 100644 --- a/src/core/profile.c +++ b/src/core/profile.c @@ -548,13 +548,13 @@ cbor_result_t cbor_encode_profile_metadata_t(cbor_value_t *enc, const profile_me const uint32_t version = PROFILE_VERSION; CBOR_CHECK_ERROR(res = cbor_encode_str(enc, "version")); - CBOR_CHECK_ERROR(res = cbor_encode_uint32(enc, &version)); + CBOR_CHECK_ERROR(res = cbor_encode_uint32_t(enc, &version)); CBOR_CHECK_ERROR(res = cbor_encode_str(enc, "name")); CBOR_CHECK_ERROR(res = cbor_encode_tstr(enc, meta->name, 36)); CBOR_CHECK_ERROR(res = cbor_encode_str(enc, "datetime")); - CBOR_CHECK_ERROR(res = cbor_encode_uint32(enc, &meta->datetime)); + CBOR_CHECK_ERROR(res = cbor_encode_uint32_t(enc, &meta->datetime)); CBOR_CHECK_ERROR(res = cbor_encode_end_indefinite(enc)); return res; @@ -623,7 +623,7 @@ cbor_result_t cbor_decode_profile_metadata_t(cbor_value_t *dec, profile_metadata } if (buf_equal_string(name, name_len, "datetime")) { - CBOR_CHECK_ERROR(res = cbor_decode_uint32(dec, &meta->datetime)); + CBOR_CHECK_ERROR(res = cbor_decode_uint32_t(dec, &meta->datetime)); continue; } diff --git a/src/core/profile.h b/src/core/profile.h index 6b87eb828..75d943894 100644 --- a/src/core/profile.h +++ b/src/core/profile.h @@ -49,7 +49,7 @@ typedef struct { #define RATE_MEMBERS \ START_STRUCT(rate_t) \ - MEMBER(mode, uint8) \ + MEMBER(mode, uint8_t) \ ARRAY_MEMBER(rate, 3, vec3_t) \ END_STRUCT() @@ -64,7 +64,7 @@ typedef struct { #define PROFILE_RATE_MEMBERS \ START_STRUCT(profile_rate_t) \ - MEMBER(profile, uint8) \ + MEMBER(profile, uint8_t) \ ARRAY_MEMBER(rates, STICK_RATE_PROFILE_MAX, rate_t) \ MEMBER(level_max_angle, float) \ MEMBER(sticks_deadband, float) \ @@ -104,7 +104,7 @@ typedef struct { #define PID_RATE_PRESET_MEMBERS \ START_STRUCT(pid_rate_preset_t) \ - MEMBER(index, uint32) \ + MEMBER(index, uint32_t) \ STR_MEMBER(name) \ MEMBER(rate, pid_rate_t) \ END_STRUCT() @@ -146,7 +146,7 @@ typedef struct { #define DTERM_ATTENUATION_MEMBERS \ START_STRUCT(throttle_dterm_attenuation_t) \ - MEMBER(tda_active, uint8) \ + MEMBER(tda_active, uint8_t) \ MEMBER(tda_breakpoint, float) \ MEMBER(tda_percent, float) \ END_STRUCT() @@ -163,9 +163,9 @@ typedef struct { #define PID_MEMBERS \ START_STRUCT(profile_pid_t) \ - MEMBER(pid_profile, uint8) \ + MEMBER(pid_profile, uint8_t) \ ARRAY_MEMBER(pid_rates, PID_PROFILE_MAX, pid_rate_t) \ - MEMBER(stick_profile, uint8) \ + MEMBER(stick_profile, uint8_t) \ ARRAY_MEMBER(stick_rates, STICK_PROFILE_MAX, stick_rate_t) \ MEMBER(big_angle, angle_pid_rate_t) \ MEMBER(small_angle, angle_pid_rate_t) \ @@ -200,17 +200,17 @@ typedef struct { float turtle_throttle_percent; } profile_motor_t; -#define MOTOR_MEMBERS \ - START_STRUCT(profile_motor_t) \ - MEMBER(digital_idle, float) \ - MEMBER(motor_limit, float) \ - MEMBER(dshot_time, uint16) \ - MEMBER(invert_yaw, uint8) \ - MEMBER(gyro_orientation, uint8) \ - MEMBER(torque_boost, float) \ - MEMBER(throttle_boost, float) \ - ARRAY_MEMBER(motor_pins, MOTOR_PIN_MAX, uint8) \ - MEMBER(turtle_throttle_percent, float) \ +#define MOTOR_MEMBERS \ + START_STRUCT(profile_motor_t) \ + MEMBER(digital_idle, float) \ + MEMBER(motor_limit, float) \ + MEMBER(dshot_time, uint16_t) \ + MEMBER(invert_yaw, uint8_t) \ + MEMBER(gyro_orientation, uint8_t) \ + MEMBER(torque_boost, float) \ + MEMBER(throttle_boost, float) \ + ARRAY_MEMBER(motor_pins, MOTOR_PIN_MAX, uint8_t) \ + MEMBER(turtle_throttle_percent, float) \ END_STRUCT() typedef enum { @@ -230,8 +230,8 @@ typedef struct { #define VOLTAGE_MEMBERS \ START_STRUCT(profile_voltage_t) \ - MEMBER(lipo_cell_count, uint8) \ - MEMBER(pid_voltage_compensation, uint8) \ + MEMBER(lipo_cell_count, uint8_t) \ + MEMBER(pid_voltage_compensation, uint8_t) \ MEMBER(vbattlow, float) \ MEMBER(actual_battery_voltage, float) \ MEMBER(reported_telemetry_voltage, float) \ @@ -260,10 +260,10 @@ typedef struct { #define RECEIVER_MEMBERS \ START_STRUCT(profile_receiver_t) \ - MEMBER(protocol, uint8) \ - ARRAY_MEMBER(aux, AUX_FUNCTION_MAX, uint8) \ - MEMBER(lqi_source, uint8) \ - MEMBER(channel_mapping, uint8) \ + MEMBER(protocol, uint8_t) \ + ARRAY_MEMBER(aux, AUX_FUNCTION_MAX, uint8_t) \ + MEMBER(lqi_source, uint8_t) \ + MEMBER(channel_mapping, uint8_t) \ ARRAY_MEMBER(stick_calibration_limits, 4, profile_stick_calibration_limits_t) \ END_STRUCT() @@ -275,9 +275,9 @@ typedef struct { #define SERIAL_MEMBERS \ START_STRUCT(profile_serial_t) \ - MEMBER(rx, uint8) \ - MEMBER(smart_audio, uint8) \ - MEMBER(hdzero, uint8) \ + MEMBER(rx, uint8_t) \ + MEMBER(smart_audio, uint8_t) \ + MEMBER(hdzero, uint8_t) \ END_STRUCT() typedef struct { @@ -287,12 +287,12 @@ typedef struct { uint32_t elements_hd[OSD_NUMBER_ELEMENTS]; } profile_osd_t; -#define OSD_MEMBERS \ - START_STRUCT(profile_osd_t) \ - MEMBER(guac_mode, uint8) \ - TSTR_MEMBER(callsign, 36) \ - ARRAY_MEMBER(elements, OSD_NUMBER_ELEMENTS, uint32) \ - ARRAY_MEMBER(elements_hd, OSD_NUMBER_ELEMENTS, uint32) \ +#define OSD_MEMBERS \ + START_STRUCT(profile_osd_t) \ + MEMBER(guac_mode, uint8_t) \ + TSTR_MEMBER(callsign, 36) \ + ARRAY_MEMBER(elements, OSD_NUMBER_ELEMENTS, uint32_t) \ + ARRAY_MEMBER(elements_hd, OSD_NUMBER_ELEMENTS, uint32_t) \ END_STRUCT() typedef struct { @@ -302,7 +302,7 @@ typedef struct { #define FILTER_PARAMETER_MEMBERS \ START_STRUCT(profile_filter_parameter_t) \ - MEMBER(type, uint8) \ + MEMBER(type, uint8_t) \ MEMBER(cutoff_freq, float) \ END_STRUCT() @@ -318,7 +318,7 @@ typedef struct { START_STRUCT(profile_filter_t) \ ARRAY_MEMBER(gyro, FILTER_MAX_SLOTS, profile_filter_parameter_t) \ ARRAY_MEMBER(dterm, FILTER_MAX_SLOTS, profile_filter_parameter_t) \ - MEMBER(dterm_dynamic_enable, uint8) \ + MEMBER(dterm_dynamic_enable, uint8_t) \ MEMBER(dterm_dynamic_min, float) \ MEMBER(dterm_dynamic_max, float) \ END_STRUCT() @@ -335,8 +335,8 @@ typedef struct { #define BLACKBOX_MEMBERS \ START_STRUCT(profile_blackbox_t) \ - MEMBER(field_flags, uint32) \ - MEMBER(sample_rate_hz, uint32) \ + MEMBER(field_flags, uint32_t) \ + MEMBER(sample_rate_hz, uint32_t) \ END_STRUCT() typedef struct { @@ -346,12 +346,12 @@ typedef struct { const char *name_osd; } blackbox_preset_t; -#define BLACKBOX_PRESET_MEMBERS \ - START_STRUCT(blackbox_preset_t) \ - MEMBER(field_flags, uint32) \ - MEMBER(sample_rate_hz, uint32) \ - STR_MEMBER(name) \ - STR_MEMBER(name_osd) \ +#define BLACKBOX_PRESET_MEMBERS \ + START_STRUCT(blackbox_preset_t) \ + MEMBER(field_flags, uint32_t) \ + MEMBER(sample_rate_hz, uint32_t) \ + STR_MEMBER(name) \ + STR_MEMBER(name_osd) \ END_STRUCT() // Full Profile diff --git a/src/core/target.h b/src/core/target.h index b88d0aa71..3d1fbc883 100644 --- a/src/core/target.h +++ b/src/core/target.h @@ -88,7 +88,7 @@ typedef struct { } target_serial_port_t; #define TARGET_SERIAL_MEMBERS \ - MEMBER(index, uint8) \ + MEMBER(index, uint8_t) \ MEMBER(rx, gpio_pins_t) \ MEMBER(tx, gpio_pins_t) \ MEMBER(inverter, gpio_pins_t) @@ -101,7 +101,7 @@ typedef struct { } target_spi_port_t; #define TARGET_SPI_MEMBERS \ - MEMBER(index, uint8) \ + MEMBER(index, uint8_t) \ MEMBER(miso, gpio_pins_t) \ MEMBER(mosi, gpio_pins_t) \ MEMBER(sck, gpio_pins_t) @@ -112,7 +112,7 @@ typedef struct { } target_spi_device_t; #define TARGET_SPI_DEVICE_MEMBERS \ - MEMBER(port, uint8) \ + MEMBER(port, uint8_t) \ MEMBER(nss, gpio_pins_t) typedef struct { @@ -128,7 +128,7 @@ typedef struct { } target_rx_spi_device_t; #define TARGET_RX_SPI_DEVICE_MEMBERS \ - MEMBER(port, uint8) \ + MEMBER(port, uint8_t) \ MEMBER(nss, gpio_pins_t) \ MEMBER(exti, gpio_pins_t) \ MEMBER(ant_sel, gpio_pins_t) \ @@ -176,7 +176,7 @@ typedef struct { INDEX_ARRAY_MEMBER(serial_soft_ports, SERIAL_SOFT_COUNT, target_serial_port_t) \ INDEX_ARRAY_MEMBER(spi_ports, SPI_PORT_MAX, target_spi_port_t) \ MEMBER(gyro, target_spi_device_t) \ - MEMBER(gyro_orientation, uint8) \ + MEMBER(gyro_orientation, uint8_t) \ MEMBER(osd, target_spi_device_t) \ MEMBER(flash, target_spi_device_t) \ MEMBER(sdcard, target_spi_device_t) \ @@ -188,8 +188,8 @@ typedef struct { MEMBER(sdcard_detect, target_invert_pin_t) \ MEMBER(buzzer, target_invert_pin_t) \ ARRAY_MEMBER(motor_pins, MOTOR_PIN_MAX, gpio_pins_t) \ - MEMBER(vbat_scale, uint16) \ - MEMBER(ibat_scale, uint16) + MEMBER(vbat_scale, uint16_t) \ + MEMBER(ibat_scale, uint16_t) typedef enum { FEATURE_BRUSHLESS = (1 << 1), @@ -209,13 +209,13 @@ typedef struct { uint8_t gyro_id; } target_info_t; -#define TARGET_INFO_MEMBERS \ - STR_MEMBER(mcu) \ - STR_MEMBER(git_version) \ - MEMBER(quic_protocol_version, uint32) \ - MEMBER(features, uint32) \ - ARRAY_MEMBER(rx_protocols, RX_PROTOCOL_MAX, uint8) \ - MEMBER(gyro_id, uint8) +#define TARGET_INFO_MEMBERS \ + STR_MEMBER(mcu) \ + STR_MEMBER(git_version) \ + MEMBER(quic_protocol_version, uint32_t) \ + MEMBER(features, uint32_t) \ + ARRAY_MEMBER(rx_protocols, RX_PROTOCOL_MAX, uint8_t) \ + MEMBER(gyro_id, uint8_t) extern target_t target; extern target_info_t target_info; diff --git a/src/driver/serial_4way.h b/src/driver/serial_4way.h index 0c19ba240..337468cbf 100644 --- a/src/driver/serial_4way.h +++ b/src/driver/serial_4way.h @@ -199,13 +199,13 @@ typedef struct { uint8_t NAME[16]; } blheli_settings_t; -#define BLHELI_SETTINGS_MEMBERS \ - MEMBER(MAIN_REVISION, uint8) \ - MEMBER(SUB_REVISION, uint8) \ - MEMBER(LAYOUT_REVISION, uint8) \ - MEMBER(MOTOR_DIRECTION, uint8) \ - TSTR_MEMBER(LAYOUT, 16) \ - TSTR_MEMBER(MCU, 16) \ +#define BLHELI_SETTINGS_MEMBERS \ + MEMBER(MAIN_REVISION, uint8_t) \ + MEMBER(SUB_REVISION, uint8_t) \ + MEMBER(LAYOUT_REVISION, uint8_t) \ + MEMBER(MOTOR_DIRECTION, uint8_t) \ + TSTR_MEMBER(LAYOUT, 16) \ + TSTR_MEMBER(MCU, 16) \ TSTR_MEMBER(NAME, 16) cbor_result_t cbor_decode_blheli_settings_t(cbor_value_t *dec, blheli_settings_t *p); diff --git a/src/flight/control.h b/src/flight/control.h index abcd69de9..b4105f97e 100644 --- a/src/flight/control.h +++ b/src/flight/control.h @@ -105,49 +105,49 @@ typedef struct { float angleerror[ANGLE_PID_SIZE]; } control_state_t; -#define STATE_MEMBERS \ - MEMBER(failloop, uint8) \ - MEMBER(looptime_autodetect, uint16) \ - MEMBER(looptime, float) \ - MEMBER(looptime_us, uint32) \ - MEMBER(loop_counter, uint32) \ - MEMBER(uptime, float) \ - MEMBER(armtime, float) \ - MEMBER(cpu_load, uint32) \ - MEMBER(failsafe_time_ms, uint32) \ - MEMBER(lipo_cell_count, uint8) \ - MEMBER(cpu_temp, float) \ - MEMBER(vbat, float) \ - MEMBER(vbat_filtered, float) \ - MEMBER(vbat_filtered_decay, float) \ - MEMBER(vbat_cell_avg, float) \ - MEMBER(vbat_compensated, float) \ - MEMBER(vbat_compensated_cell_avg, float) \ - MEMBER(ibat, float) \ - MEMBER(ibat_filtered, float) \ - MEMBER(rx, vec4_t) \ - MEMBER(rx_filtered, vec4_t) \ - MEMBER(rx_override, vec4_t) \ - MEMBER(stick_calibration_wizard, uint8) \ - MEMBER(rx_rssi, float) \ - MEMBER(rx_status, uint32) \ - MEMBER(throttle, float) \ - MEMBER(thrsum, float) \ - ARRAY_MEMBER(aux, AUX_CHANNEL_MAX, uint8) \ - MEMBER(accel_raw, vec3_t) \ - MEMBER(accel, vec3_t) \ - MEMBER(gyro_temp, float) \ - MEMBER(gyro_raw, vec3_t) \ - MEMBER(gyro, vec3_t) \ - MEMBER(GEstG, vec3_t) \ - MEMBER(attitude, vec3_t) \ - MEMBER(setpoint, vec3_t) \ - MEMBER(error, vec3_t) \ - MEMBER(pid_p_term, vec3_t) \ - MEMBER(pid_i_term, vec3_t) \ - MEMBER(pid_d_term, vec3_t) \ - MEMBER(pidoutput, vec3_t) \ - MEMBER(motor_mix, vec4_t) \ +#define STATE_MEMBERS \ + MEMBER(failloop, uint8_t) \ + MEMBER(looptime_autodetect, uint16_t) \ + MEMBER(looptime, float) \ + MEMBER(looptime_us, uint32_t) \ + MEMBER(loop_counter, uint32_t) \ + MEMBER(uptime, float) \ + MEMBER(armtime, float) \ + MEMBER(cpu_load, uint32_t) \ + MEMBER(failsafe_time_ms, uint32_t) \ + MEMBER(lipo_cell_count, uint8_t) \ + MEMBER(cpu_temp, float) \ + MEMBER(vbat, float) \ + MEMBER(vbat_filtered, float) \ + MEMBER(vbat_filtered_decay, float) \ + MEMBER(vbat_cell_avg, float) \ + MEMBER(vbat_compensated, float) \ + MEMBER(vbat_compensated_cell_avg, float) \ + MEMBER(ibat, float) \ + MEMBER(ibat_filtered, float) \ + MEMBER(rx, vec4_t) \ + MEMBER(rx_filtered, vec4_t) \ + MEMBER(rx_override, vec4_t) \ + MEMBER(stick_calibration_wizard, uint8_t) \ + MEMBER(rx_rssi, float) \ + MEMBER(rx_status, uint32_t) \ + MEMBER(throttle, float) \ + MEMBER(thrsum, float) \ + ARRAY_MEMBER(aux, AUX_CHANNEL_MAX, uint8_t) \ + MEMBER(accel_raw, vec3_t) \ + MEMBER(accel, vec3_t) \ + MEMBER(gyro_temp, float) \ + MEMBER(gyro_raw, vec3_t) \ + MEMBER(gyro, vec3_t) \ + MEMBER(GEstG, vec3_t) \ + MEMBER(attitude, vec3_t) \ + MEMBER(setpoint, vec3_t) \ + MEMBER(error, vec3_t) \ + MEMBER(pid_p_term, vec3_t) \ + MEMBER(pid_i_term, vec3_t) \ + MEMBER(pid_d_term, vec3_t) \ + MEMBER(pidoutput, vec3_t) \ + MEMBER(motor_mix, vec4_t) \ ARRAY_MEMBER(angleerror, ANGLE_PID_SIZE, float) typedef struct { diff --git a/src/io/blackbox.c b/src/io/blackbox.c index cec95351e..3da275883 100644 --- a/src/io/blackbox.c +++ b/src/io/blackbox.c @@ -18,8 +18,8 @@ cbor_result_t cbor_encode_blackbox_t(cbor_value_t *enc, const blackbox_t *b, con CBOR_CHECK_ERROR(cbor_result_t res = cbor_encode_array_indefinite(enc)); // loop and time are always emitted regardless of what field_flags indicates - CBOR_CHECK_ERROR(res = cbor_encode_uint32(enc, &b->loop)); - CBOR_CHECK_ERROR(res = cbor_encode_uint32(enc, &b->time)); + CBOR_CHECK_ERROR(res = cbor_encode_uint32_t(enc, &b->loop)); + CBOR_CHECK_ERROR(res = cbor_encode_uint32_t(enc, &b->time)); if (field_flags & (1 << BBOX_FIELD_PID_P_TERM)) { CBOR_CHECK_ERROR(res = cbor_encode_compact_vec3_t(enc, &b->pid_p_term)); @@ -60,15 +60,15 @@ cbor_result_t cbor_encode_blackbox_t(cbor_value_t *enc, const blackbox_t *b, con } if (field_flags & (1 << BBOX_FIELD_CPU_LOAD)) { - CBOR_CHECK_ERROR(res = cbor_encode_uint16(enc, &b->cpu_load)); + CBOR_CHECK_ERROR(res = cbor_encode_uint16_t(enc, &b->cpu_load)); } if (field_flags & (1 << BBOX_FIELD_DEBUG)) { CBOR_CHECK_ERROR(res = cbor_encode_array(enc, 4)); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &b->debug[0])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &b->debug[1])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &b->debug[2])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &b->debug[3])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[0])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[1])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[2])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[3])); } CBOR_CHECK_ERROR(res = cbor_encode_end_indefinite(enc)); diff --git a/src/io/blackbox_device.h b/src/io/blackbox_device.h index 7c69b507e..7a844314c 100644 --- a/src/io/blackbox_device.h +++ b/src/io/blackbox_device.h @@ -50,11 +50,11 @@ typedef struct { } blackbox_device_file_t; #define BLACKBOX_DEVICE_FILE_MEMBERS \ - MEMBER(field_flags, uint32) \ - MEMBER(looptime, uint32) \ - MEMBER(blackbox_rate, uint8) \ - MEMBER(start, uint32) \ - MEMBER(size, uint32) + MEMBER(field_flags, uint32_t) \ + MEMBER(looptime, uint32_t) \ + MEMBER(blackbox_rate, uint8_t) \ + MEMBER(start, uint32_t) \ + MEMBER(size, uint32_t) #define BLACKBOX_DEVICE_MAX_FILES 10 @@ -66,8 +66,8 @@ typedef struct { } blackbox_device_header_t; #define BLACKBOX_DEVICE_HEADER_MEMBERS \ - MEMBER(magic, uint32) \ - MEMBER(file_num, uint8) \ + MEMBER(magic, uint32_t) \ + MEMBER(file_num, uint8_t) \ ARRAY_MEMBER(files, BLACKBOX_DEVICE_MAX_FILES, blackbox_device_file_t) extern blackbox_device_header_t blackbox_device_header; diff --git a/src/io/msp.c b/src/io/msp.c index 26430dc29..d5d1b49f2 100644 --- a/src/io/msp.c +++ b/src/io/msp.c @@ -50,12 +50,12 @@ static void msp_quic_send(uint8_t *data, uint32_t len, void *priv) { msp_send_reply(msp, MSP1_MAGIC, MSP_RESERVE_1, data, len); } -static void msp_write_uint16(uint8_t *data, uint16_t val) { +static void msp_write_uint16_t(uint8_t *data, uint16_t val) { data[0] = val >> 0; data[1] = val >> 8; } -static void msp_write_uint32(uint8_t *data, uint32_t val) { +static void msp_write_uint32_t(uint8_t *data, uint32_t val) { data[0] = val >> 0; data[1] = val >> 8; data[2] = val >> 16; @@ -184,16 +184,16 @@ static void msp_process_serial_cmd(msp_t *msp, msp_magic_t magic, uint16_t cmd, uint8_t data[22]; memset(data, 0, 22); - msp_write_uint16(data, state.cpu_load); - msp_write_uint16(data + 2, 0); // i2c errors - msp_write_uint16(data + 4, 0); // sensors + msp_write_uint16_t(data, state.cpu_load); + msp_write_uint16_t(data + 2, 0); // i2c errors + msp_write_uint16_t(data + 4, 0); // sensors // flight mode, only arm for now uint32_t flight_mode = 0; if (flags.arm_state) { flight_mode |= 0x1; } - msp_write_uint32(data + 6, flight_mode); + msp_write_uint32_t(data + 6, flight_mode); msp_send_reply(msp, magic, cmd, data, 22); break; diff --git a/src/io/quic.c b/src/io/quic.c index 4d36308e1..7c5a89af0 100644 --- a/src/io/quic.c +++ b/src/io/quic.c @@ -37,7 +37,7 @@ static cbor_result_t cbor_encode_motor_test_t(cbor_value_t *enc, const motor_tes CBOR_CHECK_ERROR(cbor_result_t res = cbor_encode_map_indefinite(enc)); CBOR_CHECK_ERROR(res = cbor_encode_str(enc, "active")); - CBOR_CHECK_ERROR(res = cbor_encode_uint8(enc, &b->active)); + CBOR_CHECK_ERROR(res = cbor_encode_uint8_t(enc, &b->active)); CBOR_CHECK_ERROR(res = cbor_encode_str(enc, "value")); CBOR_CHECK_ERROR(res = cbor_encode_float_array(enc, b->value, 4)); @@ -108,10 +108,10 @@ static void get_quic(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_values value = QUIC_CMD_INVALID; - res = cbor_decode_uint8(dec, &value); + res = cbor_decode_uint8_t(dec, &value); check_cbor_error(QUIC_CMD_GET); - res = cbor_encode_uint8(&enc, &value); + res = cbor_encode_uint8_t(&enc, &value); check_cbor_error(QUIC_CMD_GET); switch (value) { @@ -228,10 +228,10 @@ static void set_quic(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_values value; - res = cbor_decode_uint8(dec, &value); + res = cbor_decode_uint8_t(dec, &value); check_cbor_error(QUIC_CMD_SET); - res = cbor_encode_uint8(&enc, &value); + res = cbor_encode_uint8_t(&enc, &value); check_cbor_error(QUIC_CMD_SET); switch (value) { @@ -328,7 +328,7 @@ static void process_blackbox(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_blackbox_command cmd; - res = cbor_decode_uint8(dec, &cmd); + res = cbor_decode_uint8_t(dec, &cmd); check_cbor_error(QUIC_CMD_BLACKBOX); switch (cmd) { @@ -344,12 +344,12 @@ static void process_blackbox(quic_t *quic, cbor_value_t *dec) { res = cbor_encode_str(&enc, "flash_size"); check_cbor_error(QUIC_CMD_BLACKBOX); const uint32_t size_in_kb = blackbox_bounds.total_size / 1024; - res = cbor_encode_uint32(&enc, &size_in_kb); + res = cbor_encode_uint32_t(&enc, &size_in_kb); check_cbor_error(QUIC_CMD_BLACKBOX); res = cbor_encode_str(&enc, "file_num"); check_cbor_error(QUIC_CMD_BLACKBOX); - res = cbor_encode_uint8(&enc, &blackbox_device_header.file_num); + res = cbor_encode_uint8_t(&enc, &blackbox_device_header.file_num); check_cbor_error(QUIC_CMD_BLACKBOX); res = cbor_encode_str(&enc, "files"); @@ -371,7 +371,7 @@ static void process_blackbox(quic_t *quic, cbor_value_t *dec) { extern blackbox_device_header_t blackbox_device_header; uint8_t file_index; - res = cbor_decode_uint8(dec, &file_index); + res = cbor_decode_uint8_t(dec, &file_index); check_cbor_error(QUIC_CMD_BLACKBOX); quic_send(quic, QUIC_CMD_BLACKBOX, QUIC_FLAG_STREAMING, encode_buffer, cbor_encoder_len(&enc)); @@ -407,7 +407,7 @@ static void process_motor_test(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_motor_command cmd; - res = cbor_decode_uint8(dec, &cmd); + res = cbor_decode_uint8_t(dec, &cmd); check_cbor_error(QUIC_CMD_MOTOR); switch (cmd) { @@ -424,7 +424,7 @@ static void process_motor_test(quic_t *quic, cbor_value_t *dec) { } motor_test.active = 1; - res = cbor_encode_uint8(&enc, &motor_test.active); + res = cbor_encode_uint8_t(&enc, &motor_test.active); check_cbor_error(QUIC_CMD_MOTOR); quic_send(quic, QUIC_CMD_MOTOR, QUIC_FLAG_NONE, encode_buffer, cbor_encoder_len(&enc)); @@ -436,7 +436,7 @@ static void process_motor_test(quic_t *quic, cbor_value_t *dec) { } motor_test.active = 0; - res = cbor_encode_uint8(&enc, &motor_test.active); + res = cbor_encode_uint8_t(&enc, &motor_test.active); check_cbor_error(QUIC_CMD_MOTOR); quic_send(quic, QUIC_CMD_MOTOR, QUIC_FLAG_NONE, encode_buffer, cbor_encoder_len(&enc)); @@ -465,7 +465,7 @@ static void process_motor_test(quic_t *quic, cbor_value_t *dec) { case QUIC_MOTOR_ESC4WAY_IF: { uint8_t count = serial_4way_init(); - res = cbor_encode_uint8(&enc, &count); + res = cbor_encode_uint8_t(&enc, &count); check_cbor_error(QUIC_CMD_MOTOR); quic_send(quic, QUIC_CMD_MOTOR, QUIC_FLAG_EXIT, encode_buffer, cbor_encoder_len(&enc)); @@ -486,11 +486,11 @@ static void process_osd(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_osd_command cmd; - res = cbor_decode_uint8(dec, &cmd); + res = cbor_decode_uint8_t(dec, &cmd); check_cbor_error(QUIC_CMD_OSD); uint16_t index; - res = cbor_decode_uint16(dec, &index); + res = cbor_decode_uint16_t(dec, &index); check_cbor_error(QUIC_CMD_OSD); switch (cmd) { @@ -532,26 +532,26 @@ static void process_serial(quic_t *quic, cbor_value_t *dec) { cbor_encoder_init(&enc, encode_buffer, ENCODE_BUFFER_SIZE); quic_motor_command cmd; - res = cbor_decode_uint8(dec, &cmd); + res = cbor_decode_uint8_t(dec, &cmd); check_cbor_error(QUIC_CMD_SERIAL); switch (cmd) { case QUIC_SERIAL_ENABLE: { serial_ports_t port = SERIAL_PORT_INVALID; - res = cbor_decode_uint8(dec, &port); + res = cbor_decode_uint8_t(dec, &port); check_cbor_error(QUIC_CMD_SERIAL); uint32_t baudrate = 0; - res = cbor_decode_uint32(dec, &baudrate); + res = cbor_decode_uint32_t(dec, &baudrate); check_cbor_error(QUIC_CMD_SERIAL); uint8_t half_duplex = 0; - res = cbor_decode_uint8(dec, &half_duplex); + res = cbor_decode_uint8_t(dec, &half_duplex); uint8_t stop_bits = 1; - res = cbor_decode_uint8(dec, &stop_bits); + res = cbor_decode_uint8_t(dec, &stop_bits); - res = cbor_encode_uint8(&enc, &port); + res = cbor_encode_uint8_t(&enc, &port); check_cbor_error(QUIC_CMD_SERIAL); quic_send(quic, QUIC_CMD_SERIAL, QUIC_FLAG_NONE, encode_buffer, cbor_encoder_len(&enc)); diff --git a/src/io/vtx.h b/src/io/vtx.h index ddaf0698e..3e2ac0a34 100644 --- a/src/io/vtx.h +++ b/src/io/vtx.h @@ -70,9 +70,9 @@ typedef struct { } vtx_power_table_t; #define VTX_POWER_TABLE_MEMBERS \ - MEMBER(levels, uint8) \ + MEMBER(levels, uint8_t) \ TSTR_ARRAY_MEMBER(labels, VTX_POWER_LEVEL_MAX, 3) \ - ARRAY_MEMBER(values, VTX_POWER_LEVEL_MAX, uint16) + ARRAY_MEMBER(values, VTX_POWER_LEVEL_MAX, uint16_t) typedef struct { uint16_t magic; @@ -89,14 +89,14 @@ typedef struct { vtx_power_table_t power_table; } vtx_settings_t; -#define VTX_SETTINGS_MEMBERS \ - MEMBER(magic, uint16) \ - MEMBER(protocol, uint8) \ - MEMBER(detected, uint8) \ - MEMBER(band, uint8) \ - MEMBER(channel, uint8) \ - MEMBER(pit_mode, uint8) \ - MEMBER(power_level, uint8) \ +#define VTX_SETTINGS_MEMBERS \ + MEMBER(magic, uint16_t) \ + MEMBER(protocol, uint8_t) \ + MEMBER(detected, uint8_t) \ + MEMBER(band, uint8_t) \ + MEMBER(channel, uint8_t) \ + MEMBER(pit_mode, uint8_t) \ + MEMBER(power_level, uint8_t) \ MEMBER(power_table, vtx_power_table_t) extern vtx_settings_t vtx_settings; diff --git a/src/util/cbor_helper.c b/src/util/cbor_helper.c index a236bc566..373688a58 100644 --- a/src/util/cbor_helper.c +++ b/src/util/cbor_helper.c @@ -21,7 +21,7 @@ cbor_result_t cbor_encode_uint8_array(cbor_value_t *enc, const uint8_t *array, u CBOR_CHECK_ERROR(cbor_result_t res = cbor_encode_array(enc, size)); for (uint32_t i = 0; i < size; i++) { - CBOR_CHECK_ERROR(res = cbor_encode_uint8(enc, &array[i])); + CBOR_CHECK_ERROR(res = cbor_encode_uint8_t(enc, &array[i])); } return res; @@ -43,7 +43,7 @@ cbor_result_t cbor_decode_uint8_array(cbor_value_t *enc, uint8_t *array, uint32_ CBOR_CHECK_ERROR(cbor_result_t res = cbor_decode_array(enc, &container)); for (uint32_t i = 0; i < size; i++) { - CBOR_CHECK_ERROR(res = cbor_decode_uint8(enc, &array[i])); + CBOR_CHECK_ERROR(res = cbor_decode_uint8_t(enc, &array[i])); } return res; diff --git a/src/util/vector.c b/src/util/vector.c index 950fe2f5c..f48398ed2 100644 --- a/src/util/vector.c +++ b/src/util/vector.c @@ -40,9 +40,9 @@ cbor_result_t cbor_encode_compact_vec3_t(cbor_value_t *enc, const compact_vec3_t CBOR_CHECK_ERROR(res = cbor_encode_array(enc, 3)); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[0])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[1])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[2])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[0])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[1])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[2])); return res; } @@ -53,9 +53,9 @@ cbor_result_t cbor_decode_compact_vec3_t(cbor_value_t *it, compact_vec3_t *vec) cbor_container_t array; CBOR_CHECK_ERROR(res = cbor_decode_array(it, &array)); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[0])); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[1])); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[2])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[0])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[1])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[2])); return res; } @@ -104,10 +104,10 @@ cbor_result_t cbor_encode_compact_vec4_t(cbor_value_t *enc, const compact_vec4_t CBOR_CHECK_ERROR(res = cbor_encode_array(enc, 4)); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[0])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[1])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[2])); - CBOR_CHECK_ERROR(res = cbor_encode_int16(enc, &vec->axis[3])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[0])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[1])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[2])); + CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &vec->axis[3])); return res; } @@ -118,10 +118,10 @@ cbor_result_t cbor_decode_compact_vec4_t(cbor_value_t *it, compact_vec4_t *vec) cbor_container_t array; CBOR_CHECK_ERROR(res = cbor_decode_array(it, &array)); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[0])); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[1])); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[2])); - CBOR_CHECK_ERROR(res = cbor_decode_int16(it, &vec->axis[3])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[0])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[1])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[2])); + CBOR_CHECK_ERROR(res = cbor_decode_int16_t(it, &vec->axis[3])); return res; }