Closed GoogleCodeExporter closed 9 years ago
This is badly needed!
Original comment by sammyl...@gmail.com
on 26 Jan 2012 at 2:04
implementation started:
uint8_t u8_x = 2;
uint8_t u8_cb(m2_el_fnarg_p fnarg, uint8_t msg, uint8_t val)
{
if ( msg == M2_U8_MSG_SET_VALUE )
u8_x = val;
return u8_x;
}
#define M2_U8_MSG_GET_VALUE 0
#define M2_U8_MSG_SET_VALUE 1
M2_U8NUMFN(el,fmt,min,max,fn)
documentation: SET_VALUE is only called, if value has really changed
Original comment by olikr...@gmail.com
on 26 Jan 2012 at 10:34
changed first arg to the element pointer (to be consistent between u8 and u32)
started with u32 (testing needed)
Original comment by olikr...@gmail.com
on 27 Jan 2012 at 5:53
- write u32 test case, check the code
- rewrite u8 procedure, remove el_data, use runtime object type identification
as in u32 code
Original comment by olikr...@gmail.com
on 27 Jan 2012 at 8:16
implemented, documentation needs to be done
Original comment by olikr...@gmail.com
on 27 Jan 2012 at 9:33
done
Original comment by olikr...@gmail.com
on 28 Jan 2012 at 8:26
Seem to make problems with classes - get error: "a pointer to a bound function
my only be used to call the function"
This works:
uint8_t u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val)
{
if ( msg == M2_U8_MSG_SET_VALUE )
global_value = val;
return global_value;
}
M2_U8NUMFN(el_Frost_aktiv_num,"c2", 1, 20, u8_cb );
This does not work:
class testclass {
public:
uint8_t u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val);
};
uint8_t testclass::u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val)
{
if ( msg == M2_U8_MSG_SET_VALUE )
global_value = val;
return global_value;
}
testclass test;
M2_U8NUMFN(el_Frost_aktiv_num,"c2", 1, 20, test.u8_cb );
Any ideas?
Original comment by sammyl...@gmail.com
on 30 Jan 2012 at 2:14
This is not possible:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html
Original comment by olikr...@gmail.com
on 30 Jan 2012 at 3:54
This will not work. Member functions be not be passed directly (see also the
C++ FAQ)
Original comment by olikr...@gmail.com
on 30 Jan 2012 at 4:02
OK I got it - Thanks
Original comment by sammyl...@gmail.com
on 30 Jan 2012 at 4:18
Original issue reported on code.google.com by
olikr...@gmail.com
on 26 Jan 2012 at 11:25