View Single Post
  #15   Spotlight this post!  
Unread 29-01-2007, 22:27
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Reading battery voltage in software

Quote:
Originally Posted by Joel J. View Post
I have an itchy finger that wants to change that alias to remove the float. Is this kosher? Would bad things happen?
I don't see why they would, unless any code depends on it (which you would find out about very quickly )

If you want to be safe, you can just take advantage of the global nature of the rxdata struct to get at the raw data:

Code:
if( rxdata.rc_main_batt < 127 )
    printf("HAMMER TIME!\n");

typedef struct  {     /* begin rx_data_record structure */


  ...
  unsigned char rc_main_batt, rc_backup_batt;
  ...

} rx_data_record;
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.