ispprog2: keep ISP_RESET (/SS) as output

ISP_RESET is /SS pin of mega328p.
In master mode, the /SS pin must be configured as output.
If configured as input it must held high to ensure Master SPI operation.
This commit is contained in:
Olaf Rempel 2014-10-14 21:45:04 +02:00
parent 9f98314832
commit 798fa7fbb1

View File

@ -86,13 +86,13 @@
#define ISP_SCK PORTB5 /* to target */
#define RESET_IN PORTB1 /* low active */
#define ISP_INACTIVE() { /* ISP_SCK, ISP_MOSI and ISP_RESET are inputs */ \
DDRB &= ~((1<<ISP_SCK) | (1<<ISP_MOSI) | (1<<ISP_RESET)); \
#define ISP_INACTIVE() { /* ISP_SCK, ISP_MOSI are inputs, set ISP_RESET high */ \
DDRB &= ~((1<<ISP_SCK) | (1<<ISP_MOSI)); \
PORTB |= (1<<ISP_RESET); \
};
#define ISP_ACTIVE() { /* ISP_SCK, ISP_MOSI and ISP_RESET are outputs, set ISP_RESET low */ \
DDRB |= ((1<<ISP_SCK) | (1<<ISP_MOSI) | (1<<ISP_RESET)); \
DDRB |= ((1<<ISP_SCK) | (1<<ISP_MOSI)); \
PORTB &= ~(1<<ISP_RESET); \
};