コード例 #1
0
ファイル: can.cpp プロジェクト: yallawalla/stm32
/*******************************************************************************
* Function Name	: 
* Description		: 
* Output				:
* Return				:
*******************************************************************************/
void			_CAN::RX_ISR(_CAN *p) {
CanRxMsg	buf;
					if(p) {																					// klic za prijavo instance
							p->rx=_buffer_init(100*(sizeof(CanRxMsg) + sizeof(unsigned int)));
							me=p;
					} else {																				// klic iz ISR, instanca in 
						CAN_Receive(__CAN__, CAN_FIFO0, &buf);				// buffer morata bit ze formirana
						_buffer_push(me->rx,&buf,sizeof(CanRxMsg));
						_buffer_push(me->rx,(void *)&__time__,sizeof(unsigned int));
					}
}
コード例 #2
0
ファイル: can.cpp プロジェクト: yallawalla/stm32
/*******************************************************************************
* Function Name	: 
* Description		: 
* Output				:
* Return				:
*******************************************************************************/
void			_CAN::TX_ISR(_CAN *p) {
CanTxMsg	buf={0,0,CAN_ID_STD,CAN_RTR_DATA,0,0,0,0,0,0,0,0,0};
					if(p) {																					// klic za prijavo instance
						me=p;
						me->tx=_buffer_init(100*sizeof(CanTxMsg));
					} else {																				// klic iz ISR, instanca in buffer morata bit ze formirana
						if(_buffer_pull(me->tx,&buf,sizeof(CanTxMsg)))
							CAN_Transmit(__CAN__,&buf);									// oddaj, ce je kaj na bufferju
						else
							CAN_ITConfig(__CAN__, CAN_IT_TME, DISABLE);	// sicer zapri interrupt
					}					
}
コード例 #3
0
ファイル: wifi.c プロジェクト: yallawalla/stm32
void	WiFi(void) {

static 
void	(*f)(void)=NULL;	
static 
int		fo=true;

			if(f==NULL) {
				DbgPrint(NULL);
				Dbg=_buffer_init(128);
				SN8200_API_Init(921600);
				strcpy(domain, "www.murata-ws.com");
				strcpy(uri, "/index.html");	
				if(!__com0 || !Dbg)
					NVIC_SystemReset();
				else {
					f=App_Loop;
					App_Loop=WiFi;
					SnicCleanup(seqNo++);
					WifiOff(seqNo++);
					Wait(200,App_Loop);
					WifiOn(seqNo++);
					Wait(200,App_Loop);
	        SnicInit(seqNo++);
					Wait(200,App_Loop);
					GetStatus(seqNo++);
					Wait(200,App_Loop);
					_buffer_push(Dbg,"0\r",2);	
					SnicGetDhcp(seqNo++);
					_buffer_push(Dbg,"6000\r",5);
					while (setTCPinfo() == CMD_ERROR)
						Wait(200,App_Loop); 
					mysock = -1;
					tcpCreateSocket(1, srcIP, (unsigned short)srcPort, seqNo++, SNIC_TCP_CREATE_SOCKET_REQ);
					if (mysock != -1) {
						tcpCreateConnection(mysock, TEST_BUFFERSIZE, 0x5, seqNo++);
					}
				}
			} else {
				__sendFromSock();
				if(fo==true) {
					fo=false;
					fo=ProcessUserInput();
				}
				if(SN8200_API_HasInput())
					ProcessSN8200Input();	
				f();
			}
}
コード例 #4
0
ファイル: hale_document.cpp プロジェクト: martincohen/Hale
void
document_init(Document *document)
{
    *document = {};

    document->arena = 0;

    vector_init(&document->path);
    _buffer_init(&document->buffer);

    document->indentation_mode = IndentationMode::Spaces;
    document->indentation_size = 4;

    // document->undo = new UndoStream(NULL);

    document->indentation_size = 4;
    document->indentation_mode = IndentationMode::Spaces;

    Document::Block block = {};
    vector_init(&document->blocks, 1);
    vector_push(&document->blocks, block);
    // vector_push(&document->block_info, (Document::Block*)NULL);
}
コード例 #5
0
ファイル: buffer.c プロジェクト: AlexShiLucky/lighttpd2
liBuffer* li_buffer_new(gsize max_size) {
	liBuffer *buf = g_slice_new0(liBuffer);
	_buffer_init(buf, li_mempool_align_page_size(max_size));
	buf->refcount = 1;
	return buf;
}