Exemplo n.º 1
0
static void test_basefilter(void)
{
    IEnumPins *pin_enum = NULL;
    IBaseFilter *base = NULL;
    IPin *pins[2];
    ULONG ref;
    HRESULT hr;

    IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter, (void **)&base);
    if (base == NULL)
    {
        /* test_query_interface handles this case */
        skip("No IBaseFilter\n");
        return;
    }

    hr = IBaseFilter_EnumPins(base, NULL);
    ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);

    hr= IBaseFilter_EnumPins(base, &pin_enum);
    ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);

    hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
    ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);

    hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
    ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);

    pins[0] = (void *)0xdead;
    pins[1] = (void *)0xdeed;

    hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
    ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
    ok(pins[0] != (void *)0xdead && pins[0] != NULL,
        "pins[0] = %p\n", pins[0]);
    if (pins[0] != (void *)0xdead && pins[0] != NULL)
    {
        test_pin(pins[0]);
        IPin_Release(pins[0]);
    }

    ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);

    ref = IEnumPins_Release(pin_enum);
    ok(ref == 0, "ref is %u and not 0!\n", ref);

    IBaseFilter_Release(base);
}
Exemplo n.º 2
0
void ht1632_set_pixel(uns8 x, uns8 y, uns8 colour) {

uns8 common, panel, led_in_panel, inverted_x, out, mem_addr, bit_in_mem_addr, count, data;

	// first calculate memory address
	
	// y location on panels is top left based
	
	common = 15 - y;
	
/* Previous calculations:
	panel = x / 8;	// which panel of the three is it that we need to change?
	led_in_panel = x - (panel * 8); 
	inverted_x = 7 - led_in_panel;
	out = panel * 8 + led_in_panel; //inverted_x;
	mem_addr = out * 4 + common / 4;
*/
	bit_in_mem_addr = common & 0b00000011;
	

	mem_addr = x * 4 + common / 4;


	clear_pin(ht1632_cs1_port, ht1632_cs1_pin);

	// send WR command

	// send 1
	set_pin  (ht1632_data_port, ht1632_data_pin);
	// pulse wr
	clear_pin(ht1632_wr_port, ht1632_wr_pin);
	set_pin  (ht1632_wr_port, ht1632_wr_pin);
	
	// send 0
	clear_pin  (ht1632_data_port, ht1632_data_pin);
	// pulse wr
	clear_pin(ht1632_wr_port, ht1632_wr_pin);
	set_pin  (ht1632_wr_port, ht1632_wr_pin);

	// send 1
	set_pin  (ht1632_data_port, ht1632_data_pin);
	// pulse wr
	clear_pin(ht1632_wr_port, ht1632_wr_pin);
	set_pin  (ht1632_wr_port, ht1632_wr_pin);

	// write mem addr, bits 6 -> 0
	for(count = 0 ; count < 7 ; count++) {
		if (test_bit(mem_addr, 6)) {
			set_pin(ht1632_data_port, ht1632_data_pin);
		} else { 
			clear_pin(ht1632_data_port, ht1632_data_pin);
		}

		//change_pin_var(ht1632_data_port, ht1632_data_pin, test_bit(mem_addr, 6));
		// pulse rd
		clear_pin(ht1632_wr_port, ht1632_wr_pin);
		set_pin  (ht1632_wr_port, ht1632_wr_pin);

		// shift mem addr along
		mem_addr = mem_addr << 1;
	}

	// Retrieve 4 bits
	// read clocked out on falling edge of RD
	
	make_input(ht1632_data_port, ht1632_data_pin);

	for(count = 0 ; count < 4 ; count++) {
		// pulse rd
		clear_pin(ht1632_rd_port, ht1632_rd_pin);

		data = data >> 1;
		data.3 = test_pin(ht1632_data_port, ht1632_data_pin);

		set_pin  (ht1632_rd_port, ht1632_rd_pin);

	}

	make_output(ht1632_data_port, ht1632_data_pin);

	// now we have the data, we need to change the bit
	if (colour) {
		set_bit(data, bit_in_mem_addr);
	} else {
		clear_bit(data, bit_in_mem_addr);
	}	
	
	// Now write it back out again
	
	// write data, bits 0 -> 3 (different from mem addr format)
	for(count = 0 ; count < 4 ; count++) {
		//change_pin_var(ht1632_data_port, ht1632_data_pin, test_bit(data, 0));
		if (test_bit(data, 0)) {
			set_pin(ht1632_data_port, ht1632_data_pin);
		} else { 
			clear_pin(ht1632_data_port, ht1632_data_pin);
		}

		// pulse wr
		clear_pin(ht1632_wr_port, ht1632_wr_pin);
		set_pin  (ht1632_wr_port, ht1632_wr_pin);
		// shift data along
		data = data >> 1;
	}
	
	
	// reset CS
	// don't think this is necessary
//	set_pin(ht1632_cs1_port, ht1632_cs1_pin);
//	clear_pin(ht1632_cs1_port, ht1632_cs1_pin);
	set_pin  (ht1632_cs1_port, ht1632_cs1_pin);
	
	
}