1 /************************************************************************
2 * @brief Checks for the board revision and returns a value < 0 if wrong
3 * revision is specified in main.c
4 *
5 * @param none
6 *
7 * @return Whether or not the board revision matches the software
8 * - 0 - The board revision does not match the software
9 * - 1 - The board revision matches the software
10 *************************************************************************/
assert_board_version(void)11 unsigned char assert_board_version( void )
12 {
13 P8DIR &= ~BIT7; // Set P8.7 input
14 P8OUT |= BIT7; // Set pullup resistor
15 P8REN |= BIT7; // Enable pull up resistors
16
17 #ifdef REV_02
18 if(!(P8IN & BIT7)) // Board rev = 0_02?
19 return 0;
20 #else
21 if((P8IN & BIT7)) // Board rev = 0_03?
22 return 0;
23 #endif
24
25 P8DIR |= BIT7; // Set P8.7 output
26 P8OUT &= ~BIT7; // Set P8.7 = 0
27 P8REN &= ~BIT7; // Disable pull up resistors
28
29 return 1;
30 }
31