Turn off JTAG in adc_init
This commit is contained in:
parent
ef06560465
commit
1a1aaa883e
1 changed files with 13 additions and 0 deletions
|
@ -39,9 +39,22 @@ static inline void adc_fin (void)
|
|||
|
||||
static inline void adc_init (void)
|
||||
{
|
||||
uint8_t temp;
|
||||
ADCSRC = 0;
|
||||
ADCSRB = 0;
|
||||
adc_fin ();
|
||||
/*
|
||||
* Disable JTAG interface
|
||||
* Hardware manual about JTD bit:
|
||||
* "In order to avoid unintentional disabling or enabling of the
|
||||
* JTAG interface, a timed sequence must be followed when changing
|
||||
* this bit: The application software must write this bit to the
|
||||
* desired value twice within four cycles to change its value."
|
||||
* 15.4.1 "MCUCR - MCU Control Register", p. 219
|
||||
*/
|
||||
temp = MCUCR | (1 << JTD);
|
||||
MCUCR = temp;
|
||||
MCUCR = temp;
|
||||
}
|
||||
|
||||
int readADC(uint8_t pin);
|
||||
|
|
Loading…
Reference in a new issue