mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-19 09:13:11 +00:00
584c0962d8
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started. * Furi record, stdglue: check mutex allocation * remove unused test * Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state. * Interrupt manager: explicitly init list. * Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options. * BLE: call debug uart callback on transmission complete * FreeRTOS: add configUSE_NEWLIB_REENTRANT * API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib. * F4: update stack protection CFLAGS to match used compiller * F4: disable compiller stack protection because of incompatibility with current compiller * Makefile: return openocd logs to gdb * BLE: fixed pin, moar power, ble trace info. * Prevent sleep when connection is active * Makefile: return serial port to upload rule, add workaround for mac os * Furi: prevent usage of stack for cmsis functions. * F4: add missing includes, add debugger breakpoints * Applications: per app stack size. * Furi: honor kernel state in stdglue * FreeRTOS: remove unused hooks * Cleanup and format sources Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
74 lines
No EOL
2 KiB
C
74 lines
No EOL
2 KiB
C
#include "u8g2/u8g2.h"
|
|
#include "qrcode/qrcode.h"
|
|
#include <furi.h>
|
|
|
|
/*
|
|
TODO: rework with new app api
|
|
|
|
void u8g2_DrawPixelSize(u8g2_t* u8g2, uint8_t x, uint8_t y, uint8_t size) {
|
|
for(uint8_t px = 0; px < size; px++) {
|
|
for(uint8_t py = 0; py < size; py++) {
|
|
u8g2_DrawPixel(u8g2, x + px, y + py);
|
|
}
|
|
}
|
|
}
|
|
|
|
void u8g2_qrcode(void* p) {
|
|
// open record
|
|
FuriRecordSubscriber* fb_record =
|
|
furi_open_deprecated("u8g2_fb", false, false, NULL, NULL, NULL);
|
|
|
|
// Allocate a chunk of memory to store the QR code
|
|
// https://github.com/ricmoo/QRCode
|
|
// we init version 1, 21x21 px, 16 alphanumeric chars with
|
|
// QUARTILE error correction
|
|
const uint8_t qr_version = 1;
|
|
const uint8_t qr_error_correction = ECC_QUARTILE;
|
|
|
|
const uint8_t qr_x = 32;
|
|
const uint8_t qr_y = 0;
|
|
const uint8_t qr_size = 3;
|
|
|
|
// The structure to manage the QR code
|
|
QRCode qrcode;
|
|
|
|
// QR Code init
|
|
uint8_t qrcodeBytes[qrcode_getBufferSize(qr_version)];
|
|
qrcode_initText(&qrcode, qrcodeBytes, qr_version, qr_error_correction, "HELLO FLIPPER");
|
|
|
|
if(fb_record == NULL) {
|
|
printf("[widget] cannot create fb record\r\n");
|
|
furiac_exit(NULL);
|
|
}
|
|
|
|
u8g2_t* fb = furi_take(fb_record);
|
|
|
|
// clear display
|
|
if(fb != NULL) {
|
|
u8g2_ClearBuffer(fb);
|
|
}
|
|
|
|
while(1) {
|
|
if(fb != NULL) {
|
|
// draw qr code
|
|
for(uint8_t y = 0; y < qrcode.size; y++) {
|
|
for(uint8_t x = 0; x < qrcode.size; x++) {
|
|
if(qrcode_getModule(&qrcode, x, y)) {
|
|
u8g2_SetDrawColor(fb, 1);
|
|
u8g2_DrawPixelSize(fb, qr_x + x * qr_size, qr_y + y * qr_size, qr_size);
|
|
} else {
|
|
u8g2_SetDrawColor(fb, 0);
|
|
u8g2_DrawPixelSize(fb, qr_x + x * qr_size, qr_y + y * qr_size, qr_size);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
furiac_exit(NULL);
|
|
}
|
|
|
|
furi_commit(fb_record);
|
|
|
|
delay(1);
|
|
}
|
|
}
|
|
*/ |