00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef EVK_527_H
00045 #define EVK_527_H
00046
00047
00048 #include "config.h"
00049
00050 #if (TARGET_BOARD==EVK527)
00051
00052 #include "lib_mcu/flash/flash_drv.h"
00053
00054
00055
00060
00061
00065 #define LED_PORT PORTD
00066 #define LED_DDR DDRD
00067 #define LED_PIN PIND
00068
00069 #define LED0_BIT PIND5
00070 #define LED1_BIT PIND6
00071 #define LED2_BIT PIND7
00072
00073 #define Leds_init() (LED_DDR |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT))
00074 #define Led0_init() (LED_DDR |= (1<<LED0_BIT))
00075 #define Led1_init() (LED_DDR |= (1<<LED1_BIT))
00076 #define Led2_init() (LED_DDR |= (1<<LED2_BIT))
00077 #define Leds_on() (LED_PORT |= (1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT))
00078 #define Leds_off() (LED_PORT &= ~((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT)))
00079 #define Leds_set_val(val) (Leds_off(),LED_PORT |= (val<<5)&((1<<LED0_BIT) | (1<<LED1_BIT) | (1<<LED2_BIT)))
00080 #define Leds_get_val() (LED_PORT>>5)
00081
00082
00083 #define Led0_on() (LED_PORT |= (1<<LED0_BIT))
00084 #define Led1_on() (LED_PORT |= (1<<LED1_BIT))
00085 #define Led2_on() (LED_PORT |= (1<<LED2_BIT))
00086
00087 #define Led0_off() (LED_PORT &= ~(1<<LED0_BIT))
00088 #define Led1_off() (LED_PORT &= ~(1<<LED1_BIT))
00089 #define Led2_off() (LED_PORT &= ~(1<<LED2_BIT))
00090
00091 #define Led0_toggle() (LED_PIN |= (1<<LED0_BIT))
00092 #define Led1_toggle() (LED_PIN |= (1<<LED1_BIT))
00093 #define Led2_toggle() (LED_PIN |= (1<<LED2_BIT))
00094
00095 #define Is_led0_on() (LED_PIN & (1<<LED0_BIT) ? TRUE : FALSE)
00096 #define Is_led1_on() (LED_PIN & (1<<LED1_BIT) ? TRUE : FALSE)
00097 #define Is_led2_on() (LED_PIN & (1<<LED2_BIT) ? TRUE : FALSE)
00099
00104 #define Joy_init() {DDRC &= ~0x40; PORTC |= 0x40; if(!Is_JTAG_enable()) {DDRF &= ~0xF0; PORTF |= 0xF0;}}
00105 #define Is_joy_right() (Is_JTAG_enable() || (PINF & (1<<PINF7)) ? FALSE : TRUE)
00106 #define Is_joy_not_right() ((!Is_JTAG_enable()) && (PINF & (1<<PINF7)) ? TRUE : FALSE)
00107 #define Is_joy_select() (Is_JTAG_enable() || (PINF & (1<<PINF6)) ? FALSE : TRUE)
00108 #define Is_joy_not_select() ((!Is_JTAG_enable()) && (PINF & (1<<PINF6)) ? TRUE : FALSE)
00109 #define Is_joy_up() (Is_JTAG_enable() || (PINF & (1<<PINF5)) ? FALSE : TRUE)
00110 #define Is_joy_not_up() ((!Is_JTAG_enable()) && (PINF & (1<<PINF5)) ? TRUE : FALSE)
00111 #define Is_joy_left() (Is_JTAG_enable() || (PINF & (1<<PINF4)) ? FALSE : TRUE)
00112 #define Is_joy_not_left() ((!Is_JTAG_enable()) && (PINF & (1<<PINF4)) ? TRUE : FALSE)
00113 #define Is_joy_down() ((PINC & (1<<PINC6)) ? FALSE : TRUE)
00114 #define Is_joy_not_down() ((PINC & (1<<PINC6)) ? TRUE : FALSE)
00115
00117 #define Switches_enable_it()
00118
00120 #define Switches_disable_it()
00121
00123
00124
00129 #define Hwb_button_init() (DDRE &= ~(1<<PINE2), PORTE |= (1<<PINE2))
00130 #define Is_hwb() ((PINE & (1<<PINE2)) ? FALSE : TRUE)
00131 #define Is_not_hwb() ((PINE & (1<<PINE2)) ? TRUE : FALSE)
00133
00134
00138
00139
00140 #define DF_4_MB
00141 #define DF_NB_MEM 1
00142
00143
00144
00145
00146
00147
00148
00149 #define Df_init_spi() (DDRB &= ~((1<<PINB3)), \
00150 DDRB |= ((1<<PINB2)|(1<<PINB1)|(1<<PINB0)), \
00151 PORTB |= ((1<<PINB3)|(1<<PINB2)|(1<<PINB1)|(1<<PINB0)), \
00152 DDRE |= ((1<<PINE6)), \
00153 PORTE |= ((1<<PINE6)) )
00154 #define Df_select_0() (PORTE &= ~(1<<PINE6))
00155 #define Df_desel_all() (PORTE |= (1<<PINE6))
00157
00158
00162
00163
00164
00165
00166
00167
00168 #define Mmc_init_spi() (DDRB &= ~((1<<PINB3)), \
00169 DDRB |= ((1<<PINB2)|(1<<PINB1)|(1<<PINB0)), \
00170 PORTB |= ((1<<PINB3)|(1<<PINB2)|(1<<PINB1)|(1<<PINB0)) )
00171 #define Mmc_sd_select() (PORTB &= ~(1<<PINB0))
00172 #define Mmc_sd_unselect() (PORTB |= (1<<PINB0))
00174
00176
00177 #define Enable_DAC_pwm() Timerhs_enable_pwm_d()
00178 #define Enable_buck_pwm() Timerhs_enable_pwm_a()
00179
00180 #define Set_DAC_pwm(v) Timerhs_set_compare_d(v)
00181 #define Set_buck_pwm(v) Timerhs_set_compare_a(v)
00182
00184 #define ADC_MIC_CH 0x21 // Enable Single Ended Input on ADC9 pin
00185
00186 #define ADC_TEMP_CH 0x00 // Enable Single Ended Input on ADC0
00187
00188 #define Dac_micro_init() (DDRD &= ~(1<<PIND6))
00189
00190 #ifdef USE_ADC
00191
00203 U16 Get_adc_mic_val(void);
00204
00216 U16 Get_adc_temp_val(void);
00217
00229 S16 Read_temperature(void);
00230
00231 #endif // USE_ADC
00232
00233 #endif // TARGET_BOARD==EVK527
00234
00235 #endif // EVK_527_H