|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2020-6-10 14:56:10
|
显示全部楼层
本帖最后由 Eworm001 于 2020-6-10 14:58 编辑
CX32L003 GPIO 驱动 WS2812
- __asm void ws_send_asm(uint32_t *p,uint8_t n,uint32_t *dose)
- {
-
- PUSH {r0-r7,lr}
- MOVS r3,#0x08 //Pin_3
- STR r3,[r2,#0x04] //docl = Pin_3
- MOVS r4,#221 //tmp
- DelayLoop
- NOP
- NOP
- SUBS r4,r4,#1 //tmp--
- CMP r4,#0 //tmp==0
- BNE DelayLoop //if(tmp!=0) goto DelayLoop
- NOP
- MOVS r4,#0x00 //bitIdx
- MOVS r5,#0x00 //byteIdx
- LSLS R1,#2 //n = n * sizeof(n)
- LDR r6,[r0,r5] //d
- //reset finished And bit start
- START
- STR r3,[r2] //dose = Pin_3
- LSLS r7,r6,#8 //d_0 = d<<8
- LSRS r7,r7,#31 //d_0>>=31
- CMP r7,#0x00 //d_0 == 0
- BNE H_1 //if(d_0 == 0) goto H_1
- H_0
- NOP
- // NOP
- B H_END
- H_1
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- H_END
- STR r3,[r2,#0x04] //docl = Pin_3
- CMP r7,#0x00 //d_0 == 0
- BNE L_1 //if(d_0 == 0) goto L_1
- L_0
- NOP
- NOP
- NOP
- NOP
- B L_END
- L_1
- NOP
- L_END
- LSLS r6,r6,#1 //d <<=1
- CMP r4,#23 //bitIdx == 23
- BNE B_NEND //if(bitIdx != 23) goto B_END
- B_END
- MOVS r4,#0 //bitIdx = 0
- ADDS r5,r5,#4 //byteIdx += sizeof(*p)
- CMP r5,r1 //byteIdx == n*sizeof(*p)
- BEQ FRAME_END //if(==) goto FRAME_END
- LDR r6,[r0,r5] //d
- B START //else goto START
- B_NEND
- ADDS r4,r4,#1 //bitIdx ++
- NOP
- NOP
- B START
- FRAME_END
- //STR r3,[r2] //dose = Pin_3
- POP {r0-r7,pc}
- }
复制代码 |
|