embedded

Atan2 in C# (or similar lanaguge)

不羁岁月 提交于 2019-12-02 01:24:46
Can anyone point me to a good example of Atan2 defined in C# (or something vaguely close to C#) that doesn't use any internal math methods? This is on .NET Microframework, so there is no such thing as an internal math library. I have already defined Sin()/Cos(), but I am having a lot of trouble with Atain2. There are a few scatter shot math libraries in NETMF, but I have found them all to be flawed or broken. One of the major ones didn't even define PI correctly! An implementation should be quite straight forward starting with the definition on Wikipedia/atan2 and then using the infinite

Arduino RFID checksum calculation and key visualization

拈花ヽ惹草 提交于 2019-12-02 00:46:06
I'm using this RFID module for Arduino Ethernet R3 and I need to retrieve from the Software Serial the card ( TAG ) ID that is written outside the tag. The module's datasheet says that 14 bytes are sent to the Arduino. The first is the header, the last the footer, the 2 bytes before the footer are the checksum, and the other 10 bytes are the ASCII data that contains the tag ID. How can I recreate the ID of the card, and control the checksum? For example with a tag that has this ID: 0013530444, the Arduino response is: I received: 2 I received: 51 I received: 67 I received: 48 I received: 48 I

How to use a variable as a parameter in a function that only suports constant expresssion

旧城冷巷雨未停 提交于 2019-12-02 00:01:17
I'm using this function: __delay_cycles(var); and I get the following error: Argument to _delay_cycles must be a constant expression Fair enough! But how can I bypass this? I have to delay my program with a different value every time. I receive my data from RS232 and I sore it in an int variable. I have to use this function and I can't modify its structure. I'm using AtMega16. One suggestion that immediately springs to mind is to call __delay_cycles() with a constant argument, but do it in a loop, and vary the number of loop iterations. The loop will add some overhead, so if you need precision

arm-none-eabi-ld: cannot find -lc

佐手、 提交于 2019-12-01 23:44:38
I'm trying to code for XMC1100 based development board. I'm trying this tutorial : http://eleceng.dit.ie/frank/arm/BareMetalXMC2Go/index.html I have downloaded the blinky.tar.gz file and unzipped. When I try "make" I'm getting this error : arm-none-eabi-ld: cannot find -lc Here is the output of "make" arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -g init.c -o init.o arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -g main.c -o main.o arm-none-eabi-ld init.o main.o -L /usr/lib/gcc/arm-none-eabi/4.8.2/armv6-m -T linker_script.ld -lc --cref -Map main.map -nostartfiles -o main.elf arm-none-eabi-ld:

Qt Embedded 键盘驱动分析(下)

不羁岁月 提交于 2019-12-01 23:33:31
键盘驱动插件究竟是怎么工作的呢?怎么才能让它来响应板子上的按键消息呢?这些疑问需要分析一个完整的键盘处理插件才能回答,下面我们就来看看最基本的pc101这个键盘插件是怎么实现的吧。首先,说到插件, 先要实现一个插件的框架,这个框架的代码要遵循Qt中的插件规范,还要符合键盘驱动插件的特点。 听起来很难?呵呵,其实非常简单, 只有两个函数需要自己实现。 涉及的代码: 键盘plugin框架:src/plugins/kbddrivers/usb/main.cpp 键盘driver handler的实现:src/gui/embedded/qkbdusb_qws.cpp 实现插件框架 main.cpp class QUsbKbdDriver : public QKbdDriverPlugin { public: QUsbKbdDriver(); QStringList keys() const; QWSKeyboardHandler* create(const QString &driver, const QString &device); }; keys就是返回当前driver插件的键值,只要不和其他插件键值冲突就行。create返回你实现的QWSKeyboardHandler派生类的实例。 实现键盘处理实例 qkbdusb_qws.h class QWSUsbKeyboardHandler

OpenGL Extensions on Tegra 3 devices

不想你离开。 提交于 2019-12-01 22:56:47
I wonder what new OpenGL ES extensions are on the new Tegra 3 devices? Anyone care to post their device name, OpenGL version and a list of extensions (Tegra 3 devices only, please)? I think other developers could use that too. On Android, you can do: String oglVersion = GLES20.glGetString(GLES20.GL_VERSION); String deviceName = GLES20.glGetString(GLES20.GL_RENDERER); String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS); Also, is there any real chance that the value of GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS would be nonzero? Asus Eee PAD Transformer Prime TF201 extensions: GL_NV_platform

Undefined reference to `kill'

只谈情不闲聊 提交于 2019-12-01 20:36:44
I developed an application for an ARM7 embedded system in C. Now I want to compile and link it with C++ in order to use some C++ features. To do this, I am using mipsel-elf-g++ instead of mipsel-elf-gcc . I can compile my code with mipsel-elf-g++ successfully, but in linking step I get the errors: /opt/mipsel/lib/gcc/mipsel-elf/3.4.6/../../../../mipsel-elf/lib/libc.a(lib_a-abort.o): In function ```abort': /cygdrive/d/Files/cross/mips/newlib-1.15.0/newlib/libc/stdlib/abort.c:63: undefined reference to _exit'` /opt/mipsel/lib/gcc/mipsel-elf/3.4.6/../../../../mipsel-elf/lib/libc.a(lib_a-signalr.o

Enabling external aborts on an ARM CPU

﹥>﹥吖頭↗ 提交于 2019-12-01 19:00:29
From the Cortex-R reference manual , probably not Cortex-R specific Asynchronous abort masking The nature of asynchronous aborts means that they can occur while the processor is handling a different abort. If an asynchronous abort generates a new exception in such a situation, the r14_abt and SPSR_abt values are overwritten. If this occurs before the data is pushed to the stack in memory, the state information about the first abort is lost. To prevent this from happening, the CPSR contains a mask bit, the A-bit, to indicate that an asynchronous abort cannot be accepted. When the A-bit is set,

How can I use the format! macro in a no_std environment?

守給你的承諾、 提交于 2019-12-01 17:58:39
How could I implement the following example without using std? let text = format!("example {:.1} test {:x} words {}", num1, num2, num3); text has type &str and num1 , num2 and num3 have any numeric type. I've tried using numtoa and itoa/dtoa for displaying numbers but numtoa does not support floats and itoa does not support no_std . I feel like displaying a number in a string is fairly common and that I'm probably missing something obvious. Shepmaster In general, you don't . format! allocates a String , and a no_std environment doesn't have an allocator. If you do have an allocator, you can

Prevent C++11 removal of endless loops

萝らか妹 提交于 2019-12-01 17:02:12
As discussed in this question , C++11 optimizes endless loops away. However, in embedded devices which have a single purpose, endless loops make sense and are actually quite often used. Even a completely empty while(1); is useful for a watchdog-assisted reset. Terminating but empty loops can also be useful in embedded development. Is there an elegant way to specifically tell the compiler to not remove empty or endless loops, without disabling optimization altogether? One of the requirements for a loop to be removed (as mentioned in that question) is that it does not access or modify volatile