Post Created date
Is longjmp incompatible with serial on the ATmega32U4?
That should work fine (your code in post #16). But you also want to look at the return value of setjmp if you want to know if an exception happened.
Friday, 6 May 2016 - 14:18
Problem with a function that return a structure
C has supported returning a struct from a function since C89. In all of the ABIs that I'm familiar with, the caller allocates space for the structure (typically in its stack frame...
Friday, 6 May 2016 - 14:14
Is longjmp incompatible with serial on the ATmega32U4?
You call setjmp from setup and then return from setup. This invalidates the stack frame where setjmp was called from, so you cannot longjmp back to it. You can longjmp only to a...
Thursday, 5 May 2016 - 18:42
Why to use a ringbuffer in usart peripheral (receiving) ?
theusch wrote: netizen wrote: theusch wrote: How many elements are contained in the buffer when this macro is invoked with m_putIdx of 2 and m_getIdx of 6? Will you get the same...
Wednesday, 20 April 2016 - 15:57
A bit of fun - new way to program AVRs - beta testers invited!
Just a note: bit fields have implementation-defined signedness if you don't specify "signed" or "unsigned". AVR-GCC defaults to signed bit fields, I believe, which may give...
Tuesday, 5 April 2016 - 16:46
Returning variables from a function call
In some implementations, the calling convention for calling a function that returns a struct is for the caller to allocate space for the return value and then pass a pointer to...
Monday, 21 September 2015 - 18:51
Returning variables from a function call
clawson wrote: typedef struct { uint8_t one; uint8_t two; uint8_t three; } vars_t; vars_t function(uint8_t a, uint8_t uint8_t c) { static vars_t the_vars...
Saturday, 19 September 2015 - 16:53
Read a hexadecimal '0x000000' style number on AVR!
You don't ever call get_rgb() in the code you posted.
Wednesday, 9 September 2015 - 02:13
Dealing with floats in C
A 20-bit value with a step size of (about) 0.00000763 sounds like a 3.17 fixed-point value to me. That means there are 3 integer bits and 17 fraction bits, giving a range of 0 to...
Thursday, 3 September 2015 - 15:35
Problem regardong USART COM using ATMEGA88
Visovian wrote: while (buffer[k] |= 0)Should be while (buffer[k] != 0) Incidentally, the first line happens to work because anything OR zero is unmodified, so if buffer[k] is...
Monday, 10 August 2015 - 18:23
GCC vs ASM code size - Help me close the gap
Note that code like this has undefined (or implementation defined at best) behavior: return( mmc_get_byte() + mmc_get_byte()<<8 );   C doesn't specify the order in...
Saturday, 1 August 2015 - 17:38
file opening and file reading in SD card
These lines immediately stood out: char buffer[15]; // ... char line[82]; /* Line buffer */ // ... sprintf(buffer, "%s", line);Why are you filling up a...
Thursday, 30 July 2015 - 21:54