static int FS4412_LED_rotate(void) { uint8_t i, dir, pos, wval, n; do { dir = FS4412_LED.rt_cmd[0] == 1 || FS4412_LED.rt_cmd[0] == 3 ? 0 : 1; n = dir ? 3 : 4; FS4412_LED_state(LOCK); for (i = 0; i < n; i++) { pos = (dir ? i + 1 : i - 1) & 3; wval = FS4412_LED.state[i] ? FS4412_LED.dat[pos] | FS4412_LED_reg_ops.GPIO_DAT_MSK[pos] : FS4412_LED.dat[pos] & FS4412_LED_reg_ops.GPIO_DAT_CLR[pos]; if (!pos) wval = FS4412_LED.state[++i] ? wval | FS4412_LED_reg_ops.GPIO_DAT_MSK[1] : wval & FS4412_LED_reg_ops.GPIO_DAT_CLR[1]; if (pos == 1) wval = FS4412_LED.state[3] ? wval | FS4412_LED_reg_ops.GPIO_DAT_MSK[0] : wval & FS4412_LED_reg_ops.GPIO_DAT_CLR[0]; writel(wval, &FS4412_LED.reg[pos]->DAT); } spin_unlock(&FS4412_LED.slock); if (FS4412_LED.rt_cmd[0] > 2) mdelay(FS4412_LED.rt_cmd[1]); } while (FS4412_LED.rt_cmd[0] > 2 && !kthread_should_stop()); return 0; }中dir=03、使,LED如何显示
时间: 2023-06-16 07:03:02 浏览: 100
unit8_2_int32_.rar_uint8 int32_unit8
5星 · 资源好评率100%
根据代码中的条件语句,如果FS4412_LED.rt_cmd[0]的值为1或3,dir的值为0,否则为1。所以如果FS4412_LED.rt_cmd[0]的值为3,dir的值为0。在循环中,LED的状态会依次向左或向右旋转。具体地,LED的状态会从数组FS4412_LED.state中读取,然后根据旋转方向更新LED的状态并写入到寄存器中,最终实现LED的旋转显示。
阅读全文