mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-09-30 07:54:44 +00:00
Add utility function for determining the AVR model
This is needed in order to handle slightly different functionality between the AT90USB64x and AT90USB128x.
This commit is contained in:
parent
14cf8505f7
commit
a7fe6d9b39
@ -25,6 +25,7 @@
|
|||||||
#ifndef HAL_AT90USB646_HARDWARE_H_
|
#ifndef HAL_AT90USB646_HARDWARE_H_
|
||||||
#define HAL_AT90USB646_HARDWARE_H_
|
#define HAL_AT90USB646_HARDWARE_H_
|
||||||
|
|
||||||
|
#include <avr/boot.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
@ -63,4 +64,15 @@ static inline void DelayUS(uint16_t us)
|
|||||||
_delay_us(us);
|
_delay_us(us);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Determines if this code is running on an AT90USB128x or AT90USB64x
|
||||||
|
*
|
||||||
|
* @return True if it's an AT90USB128x, false if AT90USB64x
|
||||||
|
*/
|
||||||
|
static inline bool IsAT90USB128x(void)
|
||||||
|
{
|
||||||
|
// Read the device signature byte 2 to determine whether this is an
|
||||||
|
// AT90USB128x or AT90USB64x.
|
||||||
|
return boot_signature_byte_get(0x0002) == 0x97;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAL_AT90USB646_HARDWARE_H_ */
|
#endif /* HAL_AT90USB646_HARDWARE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user