Can we use bcd2dec function as below and avoid then having "type" as parameter ?
If so it shoud simplify the rest of code and avoid some shifting and masking commands ?
------
Regarding the reading function byte per byte i found the source here : ( see section 10.7 )
https://books.google.fr/books?id=CB9GaAU1dwsC&pg=PA489&lpg=PA489&dq=ds1306.c&source=bl&ots=Hfj8B1oy5g&sig=cPxc-cI0quvBR27qTD8ke3lLESc&hl=fr&ei=9VkYTY2mHISb8QPm5_iKCg&sa=X&oi=book_result&ct=result&resnum=8&ved=0CFsQ6AEwBzgU#v=onepage&q&f=false
If so it shoud simplify the rest of code and avoid some shifting and masking commands ?
Code:
unsigned char bcd2dec(unsigned char val)
{
return ((val/0x10*0xA)+(val%0x10));
}
------
Regarding the reading function byte per byte i found the source here : ( see section 10.7 )
https://books.google.fr/books?id=CB9GaAU1dwsC&pg=PA489&lpg=PA489&dq=ds1306.c&source=bl&ots=Hfj8B1oy5g&sig=cPxc-cI0quvBR27qTD8ke3lLESc&hl=fr&ei=9VkYTY2mHISb8QPm5_iKCg&sa=X&oi=book_result&ct=result&resnum=8&ved=0CFsQ6AEwBzgU#v=onepage&q&f=false
Last edited: