kriswiner / dragonfly Goto Github PK
View Code? Open in Web Editor NEWArduino sketches for use with the Dragonfly (STM32L4)
Arduino sketches for use with the Dragonfly (STM32L4)
i did a test on both the teensy 3.2 and the dragonfly, with good results:
i did it as the following test conditions:
both mcu's @ set at 72 MHZ
all code runs from internal SRAM
no interrupts disabled
both mcu's blend an 24bit array of 8bit colors in seperate arrays (red, green, blue)
blending is done using floating point math
all arrays are 128*128px
dragonfly test results: about 22ms
teensy 3.2 test results: about 160ms
over 7x the performance!
code below:
#define width 128
#define height 128
//uncomment line below for dragonfly
//#define FASTRUN __attribute__ ((section (".ramfunc")))
uint8_t red_[width][height];
uint8_t green_[width][height];
uint8_t blue_[width][height];
uint16_t rgb_to_u16(uint8_t x, uint8_t y) {
return (((red_[x][y] & 0xFF) / 8) << 11) | (((green_[x][y] & 0xFF) / 4) << 5) | ((blue_[x][y]) / 8);
}
// the setup function runs once when you press reset or power the board
void setup() {
delay(1500);
Serial.begin(250000);
// initialize digital pin LED_BUILTIN as an output.
delay(800);
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
uint32_t end = 0;
uint32_t start = micros();
blend_screen(0.2);
end = micros();
Serial.println("a blend took: ");
Serial.println(end - start);
Serial.println("microseconds");
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
FASTRUN void blend_screen(float AA) {
if ( AA <= 0 ) {
AA = 0;
}
if ( AA >= 1) {
AA = 1;
}
uint8_t bgbuffer[3];
for (int16_t y = 0; y < height; y++) {
for (int16_t x = 0; x < width; x++) {
bgbuffer[0] = red_[x][y];
bgbuffer[1] = green_[x][y];
bgbuffer[2] = blue_[x][y];
blendColor(red_[x][y],green_[x][y],blue_[x][y],bgbuffer[0],bgbuffer[1],bgbuffer[2], AA, red_[x][y], green_[x][y], blue_[x][y]);
}
}
}
FASTRUN void blendColor(uint8_t bg_red, uint8_t bg_green, uint8_t bg_blue, uint8_t fg_red, uint8_t fg_green, uint8_t fg_blue, float alpha, uint8_t &ret_red, uint8_t &ret_green, uint8_t &ret_blue) {
ret_red = (bg_red * (1 - alpha) + (fg_red * alpha));
ret_green = (bg_green * (1 - alpha) + (fg_green * alpha));
ret_blue = (bg_blue * (1 - alpha) + (fg_blue * alpha));
}
on the spi header, it is impossible to trace which pin the CS pin is without looking at the schematic.
this can be a little problematic for newbies.
Hi Kris,
I have the ladybug + MPU-9250 / BME280.
I sold the 2 I2C pads and GND + VCC (no more)
-->Is it great?
I trried to run this script : https://github.com/kriswiner/Dragonfly/blob/master/MPU9250_BME280_BasicAHRS2_Butterfly.ino
but I have this error :
MPU9250 9-axis motion sensor...
MPU9250 I AM 73 I should be 71
Could not connect to MPU9250: 0x73
If I replace, at ligne n°365, 0x71 by 0x73, the program run but I Have information providing from MPU9250 :
In the following lines, the output of the serial :
ax = 0.00 ay = 0.00 az = 0.00 mg
gx = 0.00 gy = 0.00 gz = 0.00 deg/s
mx = 0 my = 0 mz = 0 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Gyro temperature is 21.0 degrees C
Yaw, Pitch, Roll: 13.80, 0.00, 0.00
Grav_x, Grav_y, Grav_z: 0.00, 0.00, 1000.00 mg
Lin_ax, Lin_ay, Lin_az: 0.00, 0.00, -1000.00 mg
rate = 541917.50 Hz
BME280:
Altimeter temperature = 28.76 C
Altimeter temperature = 83.77 F
Altimeter pressure = 986.05 mbar
Altitude = 750.64 feet
Altimeter humidity = 59.0 %rH
Howdy,
Catching this error:
In file included from C:\Users\randa\Desktop\Dragonfly STM32L47696 Development Board\Dragonfly-master\MPU9250Basic\MPU9250Basic.ino:16:0:
C:\Users\randa\AppData\Local\Arduino15\packages\grumpyoldpizza\hardware\stm32l4\0.0.28\libraries\Wire\src/Wire.h:122:10: note: void TwoWireEx::begin(TwoWireExPins)
void begin(TwoWireExPins pins = TWI_PINS_20_21);
I was thinking that I do have the correct core installed, and selected. Not sure why I am pulling incorrect wire.h ?
Thoughts? Thanks!!!
i have a suggestion to reduce power consumption on the dragonfly,
namely: use a chip select signal to the qspi flash.
as it consumes more power when the chip select is high (which is always the case right now)
I would like to use the canbus. Any ideas how to do that with the dragonfly? I think until now, there is no libary, is there anybody who have any thoughts about it?
I am trying to compile an Arduino usb hostshield code for the Dragonfly, and the compiler says ''please define board in avrpins.h''.
How can i do this, i am on Linux, manjaro, and found the avrpins.h file and see there is no
STM32F4 entry, can i put it in, and yes what? Or can i use the teensy pinout for the dragonfly since they are lookalikes.
Is this the good place for this question or is there a better place to find answers for this kind of things.
Thanks in advance, Dian from the Netherlands
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.