embedded

graphics library on lua

偶尔善良 提交于 2019-12-12 15:15:10
问题 Currently I am working with lua on embedded platfrom, and I faced the next problem - I need some open-source graphic library written in lua. Is there any existed library which match these requirments? Thank you on advance. 回答1: I need some open-source graphic library written in lua. Such a thing not only does not exist, it is not actually possible to write one. The Lua runtime does not provide access to the low-level platform-specific details that would be required to actually display

Handle GPIO in User Space ARM9 Embedded Linux AM1808

 ̄綄美尐妖づ 提交于 2019-12-12 14:20:45
问题 This question was migrated from Ask Ubuntu because it can be answered on Stack Overflow. Migrated 6 years ago . I have to interface my GSM module with the AM1808 based on ARM9. I have assigned all the GPIO pins to the Da850.c as well as mux.h files. I successfully created a uImage and inserted that image in my flash. I need to handle some of that GPIO from User application. I know that we can handle the GPIO from the Kerel space but i need to handle from the user space. As for example I have

Pattern to prevent continually checking error?

若如初见. 提交于 2019-12-12 13:21:57
问题 In C, is there a pattern that removes the need to continually check for errors in functions that call other functions? e.g. If function foo() calls a(), b() and c() one after the other the return value from each has to be checked before continuing. if a(), b(), or c() also call other functions, which possibly also call other functions, this leaves a long sequence of error checking of possibly the same error... int16_t a(x_t x) {return DO_SOME_WORK(x);} int16_t b(y_t y) {return DO_OTHER_WORK(y

Check if number is in range on 8051

末鹿安然 提交于 2019-12-12 12:52:07
问题 I have received a character over UART, and need to validate if it's a number character. Normally I'd do if (char >= '0' && char <= '9') { /* VALID */ } However, I have to do it in assembly . I haven't found any compare instruction (so I assume there is none). How can I do this? mov A, SBUF ; load the number ; -- pseudocode -- cmp A, #'0' ; In AVR, I'd do it this way brlt fail ; but I'm new to 8051 cmp A, #'9' brge fail ; -- pseudocode -- ; number is good fail: edit: ok here's what I have now

IIR Filter Implementation in C

孤者浪人 提交于 2019-12-12 12:32:32
问题 I am trying to implement an IIR filter in C for the FRDMKL25Z board. My current code is shown below: #include "Cpu.h" #include "Events.h" #include "ADC_1.h" #include "AdcLdd1.h" #include "DAC_1.h" #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" #define NSP 16 static uint16_t DACvalue, ADCvalue; static LDD_TError Error; static LDD_TDeviceData *MyDacPtr; int N=10; // Filter order double NumCoeff[11]={0.8017, -8.0174, 36.0785, -96.2094, 168.3664, -202.0397,

How generate REAL random number using STM32 MCU?

故事扮演 提交于 2019-12-12 11:13:43
问题 I'm working on a project with STM32F103E arm cortex-m3 MCU in keil microvision IDE. I need to generate random numbers for some purposes, but I don't want to use pseudo-random numbers which standard c++ libraries are generating, so I need a way to generate REAL random numbers using hardware features, but I don't know how I can do it. Any idea? (I'm a software engineer & not an electronic professional, so please describe it simple :P) 回答1: As pointed out, the chip does not have a hardware RNG.

Is the following “flag” variable access safe between interrupt and user code?

浪尽此生 提交于 2019-12-12 10:59:01
问题 We have inherited a project which targets Renesas RX231 microcontroller that I have been looking at. This uC has only one instruction that locks the bus for atomicity (XCHG). Because the processor is the only component that accesses RAM memory (no DMA or DTC being used), to manipulate variables in user code that are shared with interrupts, the interrupts are disabled (in the processor status word register) for the access time i.e. disable_interrupts(); /* set_psw(get_psw() & ~(1 << 16)); */ /

How to implement a circular buffer using a file?

旧巷老猫 提交于 2019-12-12 10:43:00
问题 My application (C program) opens two file handles to the same file (one in write and one in read mode). Two separate threads in the app read from and write to the file. This works fine. Since my app runs on embedded device with a limited ram disk size, I would like write FileHandle to wrap to beginning of file on reaching max size and the read FileHandle to follow like a circular buffer. I understand from answers to this question that this should work. However as soon as I do fseek of write

C++ exception handler on gnu arm cortex m4 with freertos

孤者浪人 提交于 2019-12-12 08:23:15
问题 Update 2016-12 There is now also a minimal example for this behavior: https://community.nxp.com/message/862676 I'm using a ARM Cortex M4 with freertos using freescales freedom Kinetis IDE (gnu arm toolchain). Problem is that try { throw 4; // old scenario also not working: throw std::runtime_error("wut"); } catch (...) { } results in a halted CPU and code after the try or (when some is added) in the catch handler is not executed. And assembly can be found here: https://gist.github.com

Design patterns commonly used for RTOS (VXworks)

﹥>﹥吖頭↗ 提交于 2019-12-12 08:17:11
问题 Can anyone help me on design patterns commonly used for RTOS? In VXworks, which pattern is more preferable? 回答1: Can we ignore the second sentence in your question? It is meaningless, and perhaps points to a misunderstanding of design patterns. The first part is interesting however. That said, I would generalise it to cover real-time systems rather than RTOS. Many of the most familiar patterns are mechanistic, but in real-time systems higher-level architectural patterns are also important.