Added the zig_main project to software for zig based implementation of code for robot

This commit is contained in:
2026-05-05 20:14:04 +12:00
parent 7d752f2534
commit f21f909a71
83 changed files with 13631 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
pub const led_color_component_format_t = extern union {
format: struct_format_layout_15,
format_id: u32,
};

View File

@@ -0,0 +1,10 @@
pub const led_strip_config_t = extern struct {
strip_gpio_num: c_int = 0,
max_leds: u32 = 0,
led_model: led_model_t = @import("std").mem.zeroes(led_model_t),
color_component_format: led_color_component_format_t = @import("std").mem.zeroes(led_color_component_format_t),
flags: led_strip_flags = @import("std").mem.zeroes(led_strip_flags),
pub const led_strip_new_rmt_device = __root.led_strip_new_rmt_device;
pub const led_strip_new_spi_device = __root.led_strip_new_spi_device;
pub const device = __root.led_strip_new_rmt_device;
};

View File

@@ -0,0 +1,10 @@
pub const led_strip_rmt_config_t = extern struct {
clk_src: rmt_clock_source_t = @import("std").mem.zeroes(rmt_clock_source_t),
resolution_hz: u32 = 0,
mem_block_symbols: usize = 0,
flags: led_strip_flags = @import("std").mem.zeroes(led_strip_flags),
};
const led_strip_flags = extern struct {
invert_out: u32,
};

View File

@@ -0,0 +1,3 @@
pub const struct_led_strip_rmt_extra_config_20 = extern struct {
with_dma: u32 = 0,
};

View File

@@ -0,0 +1,9 @@
pub const struct_format_layout_15 = extern struct {
r_pos: u32 = 0,
g_pos: u32 = 0,
b_pos: u32 = 0,
w_pos: u32 = 0,
reserved: u32 = 0,
bytes_per_color: u32 = 0,
num_components: u32 = 0,
};

View File

@@ -0,0 +1 @@
pub const portTICK_PERIOD_MS: TickType_t = @as(TickType_t, @divExact(@as(c_int, 1000), configTICK_RATE_HZ));

View File

@@ -0,0 +1,22 @@
pub const wifi_ap_config_t = extern struct {
ssid: [32]u8 = @import("std").mem.zeroes([32]u8),
password: [64]u8 = @import("std").mem.zeroes([64]u8),
ssid_len: u8 = 0,
channel: u8 = 0,
authmode: wifi_auth_mode_t = @import("std").mem.zeroes(wifi_auth_mode_t),
ssid_hidden: u8 = 0,
max_connection: u8 = 0,
beacon_interval: u16 = 0,
csa_count: u8 = 0,
dtim_period: u8 = 0,
pairwise_cipher: wifi_cipher_type_t = @import("std").mem.zeroes(wifi_cipher_type_t),
ftm_responder: bool = false,
pmf_cfg: wifi_pmf_config_t = @import("std").mem.zeroes(wifi_pmf_config_t),
sae_pwe_h2e: wifi_sae_pwe_method_t = @import("std").mem.zeroes(wifi_sae_pwe_method_t),
transition_disable: u8 = 0,
sae_ext: u8 = 0,
wpa3_compatible_mode: u8 = 0,
reserved: u8 = 0,
bss_max_idle_cfg: wifi_bss_max_idle_config_t = @import("std").mem.zeroes(wifi_bss_max_idle_config_t),
gtk_rekey_interval: u16 = 0,
};

View File

@@ -0,0 +1,40 @@
pub const wifi_sta_config_t = extern struct {
ssid: [32]u8 = @import("std").mem.zeroes([32]u8),
password: [64]u8 = @import("std").mem.zeroes([64]u8),
scan_method: wifi_scan_method_t = @import("std").mem.zeroes(wifi_scan_method_t),
bssid_set: bool = false,
bssid: [6]u8 = @import("std").mem.zeroes([6]u8),
channel: u8 = 0,
listen_interval: u16 = 3,
sort_method: wifi_sort_method_t = @import("std").mem.zeroes(wifi_sort_method_t),
threshold: wifi_scan_threshold_t = @import("std").mem.zeroes(wifi_scan_threshold_t),
pmf_cfg: wifi_pmf_config_t = @import("std").mem.zeroes(wifi_pmf_config_t),
// Connection Feature
// 0 rm_enabled
// 1 btm_enabled
// 2 mbo_enabled
// 3 ft_enabled
// 4 owe_enabled
// 5 transition_disable
// 6-31 reserved
connection_features: u32 = 0, // Stores BTM, RM, MBO, FT, OWE, etc.
sae_pwe_h2e: wifi_sae_pwe_method_t = @import("std").mem.zeroes(wifi_sae_pwe_method_t),
sae_pk_mode: wifi_sae_pk_mode_t = @import("std").mem.zeroes(wifi_sae_pk_mode_t),
failure_retry_cnt: u8 = 0,
// HE Capabilities
// 0 he_dcm_set
// 1-2 he_dcm_max_constellation_tx (2-bit)
// 3-4 he_dcm_max_constellation_rx (2-bit)
// 5 he_mcs9_enabled
// 6 he_su_beamformee_disabled
// 7 he_trig_su_bmforming_feedback_disabled
// 8 he_trig_mu_bmforming_partial_feedback_disabled
// 9 he_trig_cqi_feedback_disabled
// 10-31 he_reserved
he_capabilities: u32 = 0, // Stores HE-related flags (DCM, MCS9, beamforming, CQI, etc.)
sae_h2e_identifier: [32]u8 = @import("std").mem.zeroes([32]u8),
};

View File

@@ -0,0 +1,8 @@
pub fn xPortCanYield() callconv(.c) bool {
var threshold: u32 = blk: {
break :blk @as([*c]volatile u32, @ptrFromInt(@as(c_int, 545259520) + @as(c_int, 8))).*;
};
_ = &threshold;
threshold = threshold >> @intCast(@as(c_int, 24) + (@as(c_int, 8) - @as(c_int, 3)));
return threshold == @as(u32, @bitCast(@as(c_int, 0)));
}