Changes between Version 3 and Version 4 of cores/w3_userio
- Timestamp:
- Aug 11, 2012, 11:36:46 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
cores/w3_userio
v3 v4 121 121 userio_write_control(USERIO_BASEADDR, (W3_USERIO_CTRLSRC_LEDS_RF | W3_USERIO_HEXDISP_L_MAPMODE | W3_USERIO_HEXDISP_R_MAPMODE)); 122 122 123 //Select software control of all outputs 124 //Set both hex dipslays to map 4-bit to 7-segment values 125 userio_write_control(USERIO_BASEADDR, (W3_USERIO_HEXDISP_L_MAPMODE | W3_USERIO_HEXDISP_R_MAPMODE)); 123 //Display "B" on the left hex dipslay (assumes map mode is enabled; see control register docs) 124 userio_write_hexdisp_left(USERIO_ADDR, 0xB); 126 125 127 //Select hardware control of RF LEDs 128 //Disable mapping for hex display values 129 userio_write_control(USERIO_BASEADDR, W3_USERIO_CTRLSRC_LEDS_RF); 126 //Display "4" on the right hex dipslay and light the decimal point (assumes map mode is enabled; see control register docs) 127 userio_write_hexdisp_right(USERIO_ADDR, (0x4 | W3_USERIO_HEXDISP_DP) ); 130 128 131 //Enable hardware control of green user LEDs, preserve other control settings 132 userio_write_control(USERIO_BASEADDR, (userio_read_control(USERIO_BASEADDR) | W3_USERIO_CTRLSRC_LEDS_GREEN)); 129 //Turn off all four green user LEDs 130 userio_write_leds_green(USERIO_ADDR, 0); 131 132 //Toggle the 2 LSB of the red user LEDs 133 userio_toggle_leds_red(USERIO_ADDR, 0x3); 134 135 //Check if middle push button is being pressed 136 if(userio_read_inputs(USERIO_BASEADDR) & W3_USERIO_PB_M) {...} 137 138 //Read 4-bit DIP switch value 139 u8 x = userio_read_inputs(USERIO_BASEADDR) & W3_USERIO_DIPSW; 133 140 }}} 134 141