Neopixel seems to work

This commit is contained in:
Michal Moskal 2016-04-03 17:49:35 -07:00
parent 8a124812b6
commit c661fd0eca
3 changed files with 16 additions and 4 deletions

View File

@ -69,6 +69,13 @@ namespace pins {
if (!pin) return 0; \ if (!pin) return 0; \
return pin->op return pin->op
//%
MicroBitPin *getPinAddress(int id) {
return getPin(id);
}
/** /**
* Read the specified pin or connector as either 0 or 1 * Read the specified pin or connector as either 0 or 1
* @param name pin to read from * @param name pin to read from

View File

@ -8,7 +8,7 @@ basic.showLeds(`
console.log("Start") console.log("Start")
// Create a NeoPixel driver - specify the number of LEDs: // Create a NeoPixel driver - specify the number of LEDs:
let strip = neopixel.create(24); let strip = neopixel.create(7);
// If your strip is not at P0, specify the pin. // If your strip is not at P0, specify the pin.
strip.setPin(DigitalPin.P0) strip.setPin(DigitalPin.P0)

View File

@ -1,23 +1,26 @@
sendBufferAsm:
push {r4,r5,r6,r7,lr} push {r4,r5,r6,r7,lr}
mov r4, r0 ; save buff mov r4, r0 ; save buff
mov r6, r1 ; save pin mov r6, r1 ; save pin
mov r0, r4 mov r0, r4
bl buffer::count bl BufferMethods::length
mov r5, r0 mov r5, r0
mov r0, r4 mov r0, r4
bl buffer::cptr bl BufferMethods::getBytes
mov r4, r0 mov r4, r0
; setup pin as digital ; setup pin as digital
mov r0, r6 mov r0, r6
movs r1, #0 movs r1, #0
bl micro_bit::digitalWritePin bl pins::digitalWritePin
; load pin address ; load pin address
mov r0, r6 mov r0, r6
bl pins::getPinAddress
ldr r0, [r0, #8] ; get mbed DigitalOut from MicroBitPin ldr r0, [r0, #8] ; get mbed DigitalOut from MicroBitPin
ldr r1, [r0, #4] ; r1-mask for this pin ldr r1, [r0, #4] ; r1-mask for this pin
@ -60,3 +63,5 @@
cpsie i ; enable irq cpsie i ; enable irq
pop {r4,r5,r6,r7,pc} pop {r4,r5,r6,r7,pc}