| Line 9... | Line 9... | 
      
        | 9 |  */ | 9 |  */ | 
      
        | 10 |   | 10 |   | 
      
        | 11 | #ifndef USBASP_H_ | 11 | #ifndef USBASP_H_ | 
      
        | 12 | #define USBASP_H_ | 12 | #define USBASP_H_ | 
      
        | 13 |   | 13 |   | 
      
        | - |  | 14 | /* PORTS Definitions */ | 
      
        | - |  | 15 | #define LED_RED_PORT       C | 
      
        | - |  | 16 | #define LED_RED_BIT        0 | 
      
        | - |  | 17 | #define LED_GREEN_PORT     C | 
      
        | - |  | 18 | #define LED_GREEN_BIT      1 | 
      
        | - |  | 19 | #define CLKSW_PORT         D | 
      
        | - |  | 20 | #define CLKSW_BIT          0 | 
      
        | - |  | 21 | #define PORTB_UNUSED_MASK  (1<<PB1 | 1<<PB0) | 
      
        | - |  | 22 | #define PORTC_UNUSED_MASK  (1<<PC5 | 1<<PC4 | 1<<PC3 | 1<<PC2) | 
      
        | - |  | 23 | #define PORTD_UNUSED_MASK  (1<<PD7 | 1<<PD6 | 1<<PD5 | 1<<PD3 | 1<<PD1) | 
      
        | - |  | 24 |   | 
      
        | 14 | /* USB function call identifiers */ | 25 | /* USB function call identifiers */ | 
      
        | 15 | #define USBASP_FUNC_CONNECT     1 | 26 | #define USBASP_FUNC_CONNECT     1 | 
      
        | 16 | #define USBASP_FUNC_DISCONNECT  2 | 27 | #define USBASP_FUNC_DISCONNECT  2 | 
      
        | 17 | #define USBASP_FUNC_TRANSMIT    3 | 28 | #define USBASP_FUNC_TRANSMIT    3 | 
      
        | 18 | #define USBASP_FUNC_READFLASH   4 | 29 | #define USBASP_FUNC_READFLASH   4 | 
      
        | Line 59... | Line 70... | 
      
        | 59 | #define USBASP_ISP_SCK_187_5  9   /* 187.5  kHz */ | 70 | #define USBASP_ISP_SCK_187_5  9   /* 187.5  kHz */ | 
      
        | 60 | #define USBASP_ISP_SCK_375    10  /* 375 kHz   */ | 71 | #define USBASP_ISP_SCK_375    10  /* 375 kHz   */ | 
      
        | 61 | #define USBASP_ISP_SCK_750    11  /* 750 kHz   */ | 72 | #define USBASP_ISP_SCK_750    11  /* 750 kHz   */ | 
      
        | 62 | #define USBASP_ISP_SCK_1500   12  /* 1.5 MHz   */ | 73 | #define USBASP_ISP_SCK_1500   12  /* 1.5 MHz   */ | 
      
        | 63 |   | 74 |   | 
      
        | - |  | 75 | /* Macros for Port (enables to easily define IO signals) */ | 
      
        | - |  | 76 | #define GLUE(A,B) A##B | 
      
        | - |  | 77 | #define DDR(PORT_LETTER)  GLUE(DDR, PORT_LETTER)		// Makes DDRC  from DDR(C) etc. | 
      
        | - |  | 78 | #define PORT(PORT_LETTER) GLUE(PORT,PORT_LETTER)		// Makes PORTC from PORT(C) | 
      
        | - |  | 79 | #define PIN(PORT_LETTER)  GLUE(PIN, PORT_LETTER)		// Makes PINC  from PIN(C) | 
      
        | - |  | 80 |   | 
      
        | 64 | /* macros for gpio functions */ | 81 | /* macros for gpio functions */ | 
      
        | 65 | #define ledRedOn()    PORTC &= ~(1 << PC1) | 82 | #define ledRedOn()    PORT(LED_RED_PORT)   &= ~(1 << LED_RED_BIT)	// Active L | 
      
        | 66 | #define ledRedOff()   PORTC |= (1 << PC1) | 83 | #define ledRedOff()   PORT(LED_RED_PORT)   |=  (1 << LED_RED_BIT) | 
      
        | 67 | #define ledGreenOn()  PORTC &= ~(1 << PC0) | 84 | #define ledGreenOn()  PORT(LED_GREEN_PORT) &= ~(1 << LED_GREEN_BIT)	// Active L | 
      
        | 68 | #define ledGreenOff() PORTC |= (1 << PC0) | 85 | #define ledGreenOff() PORT(LED_GREEN_PORT) |=  (1 << LED_GREEN_BIT) | 
      
        | - |  | 86 | #define ledInit()     DDR(LED_RED_PORT)    |=  (1 << LED_RED_BIT),\ | 
      
        | - |  | 87 |                       DDR(LED_GREEN_PORT)  |=  (1 << LED_GREEN_BIT)	// Outputs | 
      
        | - |  | 88 | #define clkswInit()   DDR(CLKSW_PORT)      &= ~(1 << CLKSW_BIT),\ | 
      
        | - |  | 89 |                       PORT(CLKSW_PORT)     |=  (1 << CLKSW_BIT)		// Input with PullUp | 
      
        | 69 |   | 90 |   | 
      
        | 70 | #endif /* USBASP_H_ */ | 91 | #endif /* USBASP_H_ */ |