nx_robot_signal.nx
buildroot/runtime/nx_robot_signal.nx
about
nx_robot_signal.nx -- SOVEREIGN hardware SIGNAL/REGISTER rung (the lowest robot-control layer,
beneath the driver). A real stepper driver chip (A4988/DRV8825 class) does NOT consume an integer
"output" -- it consumes a STEP/DIR digital WAVEFORM on GPIO pins: a rising edge on STEP = one motor
micro-step, DIR level = direction. A servo/ESC consumes a PWM bit pattern. This rung MODELS the
GPIO register and GENERATES those actual signals from the pulse plan (nx_robot_step, the rung above
feeds DOWN into this one) -- building from the hardware rung up. 100% Nishi, integer-only.
NEVER-BRICK (#26) BY CONSTRUCTION at the register level:
* a write to a NON-allowed pin is REJECTED (can't poke arbitrary hardware registers);
* a pin level is normalized to {0,1} (can't write a garbage register value);
* PWM duty is clamped to [0, PERIOD] (can't command an out-of-range / >100% pulse).
GPIO modeled as arrays (pins[bit]=level, allowed[bit]=writable?) = a faithful register model with
no undefined bit-twiddling. Binding pins[] to a real board's MMIO base address is the bench step.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_robot_step.nx
imported by: nx_robot_signal_gate.nx
structs
| none |
consts
| 17 | const SIG_STEP_BIT: i64 = 0 |
| 18 | const SIG_DIR_BIT: i64 = 1 |
| 19 | const SIG_PWM_PERIOD: i64 = 100 |
functions
| 22 | func gpio_new(nbits: i64) -> *i64 |
| 30 | func gpio_write(pins: *i64, allowed: *i64, bit: i64, level: i64) -> i64 |
| 38 | func gpio_write_raw(pins: *i64, bit: i64, level: i64) -> i64 { pins[bit] = level; return level } called by 1: main |
| 39 | func gpio_read(pins: *i64, bit: i64) -> i64 { return pins[bit] } called by 1: main |
| 44 | func gen_step_dir(puls: *i64, naxes: i64, nt: i64, axis: i64, dir: i64, |
| 65 | func count_rising(trace: *i64, nw: i64, bit: i64) -> i64 called by 1: main |
| 82 | func gen_pwm(duty: i64, pat: *i64) -> i64 called by 1: main |
| 90 | func count_high(pat: *i64, n: i64) -> i64 called by 1: main |