示例#1
0
void main(void) {

    /****************
     * Setup
     ****************/
     _Setup();

     /****************
     * loop
     ****************/
//     _Loop();
     _Loop_LCD();

//    while(1) {
//
//        //REF binary http://www.microchip.com/forums/m504764.aspx
//        PORTB = 0x01;
//
//        __delay_ms(500);
//
//        PORTB = 0x02;
//
//        __delay_ms(500);
//
//    }

    return;
}
示例#2
0
status_t
BProxySecureSocket::Connect(const BNetworkAddress& peer, bigtime_t timeout)
{
	status_t status = InitCheck();
	if (status != B_OK)
		return status;

	BSocket::Connect(fProxyAddress, timeout);
	if (status != B_OK)
		return status;

	BString connectRequest;
	connectRequest.SetToFormat("CONNECT %s:%d HTTP/1.0\r\n\r\n",
		peer.HostName().String(), peer.Port());
	BSocket::Write(connectRequest.String(), connectRequest.Length());

	char buffer[256];
	ssize_t length = BSocket::Read(buffer, sizeof(buffer) - 1);
	if (length <= 0)
		return length;

	buffer[length] = '\0';
	int httpStatus = 0;
	int matches = scanf(buffer, "HTTP/1.0 %d %*[^\r\n]\r\n\r\n", httpStatus);
	if (matches != 2)
		return B_BAD_DATA;

	if (httpStatus < 200 || httpStatus > 299)
		return B_BAD_VALUE;

	return _Setup();
}
示例#3
0
RimeWithWeaselHandler::RimeWithWeaselHandler(weasel::UI *ui)
	: m_ui(ui)
	, m_active_session(0)
	, m_disabled(true)
	, _UpdateUICallback(NULL)
	, m_vista_greater(IsWindowsVistaOrGreater())
{
	_Setup();
}
示例#4
0
void main(void) {

	///////////////////////

	// setups

	///////////////////////
	_Setup();			// init MCU

	count = 0;

	pulse_250ms(3);

	_Setup_Timer();

	pulse_250ms_RB2(3);

	///////////////////////

	// LCD-related

	///////////////////////
	SD1602_init_2();	// init LCD

	pulse_250ms(2);

	_Display();

	pulse_250ms_RB2(2);

	///////////////////////

	// while

	///////////////////////
	while(1) {

		if (flag_Intr == true) {

//			hex ++;

			hex = TMR0;

//			_Display__Hex(hex);
			_Display__Hex_3Items(hex);

			flag_Intr = false;

		}
	}

    return;
}
示例#5
0
PasswordWindow::PasswordWindow(ScreenSaverSettings& settings) 
	: BWindow(BRect(100, 100, 380, 249), "Password Window", B_MODAL_WINDOW_LOOK,
		B_MODAL_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE),
	fSettings(settings)
{
	_Setup();
	Update();

	BRect screenFrame = BScreen(B_MAIN_SCREEN_ID).Frame();
	BPoint point;
	point.x = (screenFrame.Width() - Bounds().Width()) / 2;
	point.y = (screenFrame.Height() - Bounds().Height()) / 2;

	if (screenFrame.Contains(point))
		MoveTo(point);
}
status_t
AVCodecEncoder::SetUp(const media_format* inputFormat)
{
	TRACE("AVCodecEncoder::SetUp()\n");

	if (fContext == NULL)
		return B_NO_INIT;

	if (inputFormat == NULL)
		return B_BAD_VALUE;

	// Codec IDs for raw-formats may need to be figured out here.
	if (fCodec == NULL && fCodecID == CODEC_ID_NONE) {
		fCodecID = raw_audio_codec_id_for(*inputFormat);
		if (fCodecID != CODEC_ID_NONE)
			fCodec = avcodec_find_encoder(fCodecID);
	}
	if (fCodec == NULL) {
		TRACE("  encoder not found!\n");
		return B_NO_INIT;
	}

	_CloseCodecIfNeeded();

	fInputFormat = *inputFormat;
	fFramesWritten = 0;

	const uchar* userData = inputFormat->user_data;
	if (*(uint32*)userData == 'ffmp') {
		userData += sizeof(uint32);
		// The Writer plugin used is the FFmpeg plugin. It stores the
		// AVCodecContext pointer in the user data section. Use this
		// context instead of our own. It requires the Writer living in
		// the same team, of course.
		app_info appInfo;
		if (be_app->GetAppInfo(&appInfo) == B_OK
			&& *(team_id*)userData == appInfo.team) {
			userData += sizeof(team_id);
			// Use the AVCodecContext from the Writer. This works better
			// than using our own context with some encoders.
			fContext = *(AVCodecContext**)userData;
		}
	}

	return _Setup();
}
status_t
AVCodecEncoder::SetEncodeParameters(encode_parameters* parameters)
{
	TRACE("AVCodecEncoder::SetEncodeParameters(%p)\n", parameters);

	if (fFramesWritten > 0)
		return B_NOT_SUPPORTED;

	fEncodeParameters.quality = parameters->quality;
	TRACE("  quality: %.5f\n", parameters->quality);
	if (fEncodeParameters.quality == 0.0f) {
		TRACE("  using default quality (1.0)\n");
		fEncodeParameters.quality = 1.0f;
	}

// TODO: Auto-bit_rate versus user supplied. See above.
//	int avgBytesPerSecond = 0;
//	int maxBytesPerSecond = 0;
//
//	if (fInputFormat.type == B_MEDIA_RAW_AUDIO) {
//		avgBytesPerSecond = (int)(parameters->avg_field_size
//			* fInputFormat.u.raw_audio.frame_rate);
//		maxBytesPerSecond = (int)(parameters->max_field_size
//			* fInputFormat.u.raw_audio.frame_rate);
//	} else if (fInputFormat.type == B_MEDIA_RAW_VIDEO) {
//		avgBytesPerSecond = (int)(parameters->avg_field_size
//			* fInputFormat.u.raw_video.field_rate);
//		maxBytesPerSecond = (int)(parameters->max_field_size
//			* fInputFormat.u.raw_video.field_rate);
//	}
//
//	if (maxBytesPerSecond < avgBytesPerSecond)
//		maxBytesPerSecond = avgBytesPerSecond;
//
//	// Reset these, so we can tell the difference between uninitialized
//	// and initialized...
//	if (avgBytesPerSecond > 0) {
//		fContext->bit_rate = avgBytesPerSecond * 8;
//		fContext->bit_rate_tolerance = (maxBytesPerSecond
//			- avgBytesPerSecond) * 8;
//		fBitRateControlledByUser = true;
//	}

	return _Setup();
}
示例#8
0
status_t
AVCodecEncoder::SetUp(const media_format* inputFormat)
{
	TRACE("AVCodecEncoder::SetUp()\n");

	if (fContext == NULL || fCodec == NULL)
		return B_NO_INIT;

	if (inputFormat == NULL)
		return B_BAD_VALUE;

	_CloseCodecIfNeeded();

	fInputFormat = *inputFormat;
	fFramesWritten = 0;

	return _Setup();
}
示例#9
0
void main(void) {

				//  0123456789012345
//	char msg_1[] = "ddram addressing";
//	char msg_1[] = "display 0x02...";
//	char msg_1[] = "register done";
//	char msg_1[] = "register_Char";

	///////////////////////

	// setups

	///////////////////////
	_Setup();			// init MCU

	///////////////////////
	while(1) {

		_While();

	}//while(1)

	return;
}
示例#10
0
void main(void) {

	///////////////////////

	// setups

	///////////////////////
	_Setup();			// init MCU

	_Setup_ANSEL();

	count = 0;

	pulse_250ms(3);

	_Setup_Timer();

	pulse_250ms_RB2(3);

	///////////////////////

	// LCD-related

	///////////////////////
	SD1602_init_2();	// init LCD

	pulse_250ms(2);

	_Display();

	pulse_250ms_RB2(2);

	///////////////////////

	// while

	///////////////////////
	while(1) {

		_While();

//		if (flag_Intr == true) {
//
////			hex ++;
//
////			hex = TMR0;
//
//			adcL ++;
//
//			hex = adcL;
//
////			_Display__Hex(hex);
////			_Display__Hex_3Items(hex);
//			_Display__Hex_2Items(hex);
//
//			flag_Intr = false;
//
//		}
	}//while(1)

    return;
}