void clear_screen_lcd(void)
{
  char c1 = 0x7c;
  char c2 = 0x00;

  tx0_send(&c1, 1);
  tx0_send(&c2, 1);

  tx1_send(&c1, 1);
  tx1_send(&c2, 1);
}
bool tx1_send_wait( const void* data, size_t len )
  {
  if( len > 0 && data != NULL ) /* if the information looks viable */
    {
    while( len > 0 )            /* while there is data left to transfer */
      {
      int sz = tx1_peek( );      /* get free space in the fifo */

      if( sz > 0 )              /* if there is room for at least some data */
        {
        if( sz > len )          /* if more room than required          */
          sz = len;             /* limit size to just the data to send */

        tx1_send( data, sz );    /* send this portion of the information */

        data = (unsigned char*)data + sz; /* move the pointer */

        len -= sz;              /* adjust the count of remaining data to send */
        }
      }
    
    return true; /* indicate success */
    }
  
  return false; /* otherwise indicate failure */
  }
Beispiel #3
0
void DrumSet()
{
  Intitialize_Drumset();
  while(1)
  {
    if(P0 & 0x3F)
    {
      tmp_port = P0;
      for(inn=0;inn<6;inn++)
      {
        if((tmp_port>>inn) & 0x01)
           break;
      }
      if(inn<6 && timerID_DR[inn] == TimerId_INVALID)
      {
         timerID_DR[inn] = SetTimerReq(&Drum_ISR,200);
         halLedToggle(1);
         P0IFG &= ~(1<<inn);
         Capture_DR[inn] = 0;
      }
    }

    if(Print_Flag == 1)
    {
      tx1_send(tx1_buf,3);
      Print_Flag = 0;
    }
  }
/***********************************************************************************
* @fn      getTsXY
*
* @brief   Send X and Y Coordinates to Host
*
* @param   unsigned int xCoord
*			 X-Coordinate
*		   unsigned int yCoord
*			 Y-Coordinate
*
* @return  none
*/
void sendData(unsigned int xCoord, unsigned int yCoord) {
  //static   char byte[5];

//    xCoord -= 1100;
//    yCoord -= 700;
  	unsigned char keyNote = 0;

    if((signed int)xCoord < 0)  xCoord = 0;
    if((signed int)yCoord < 0)  yCoord = 0;


    sprintf(str_buf, "X: %d, Y:%d\n\r",xCoord, yCoord);
    tx1_send(str_buf,strlen(str_buf));
	
	keyNote = piano_key_match(xCoord, yCoord);
	//keyNote = drum_key_match(xCoord, yCoord);
	tx1_send(&keyNote, 1);
	RF_Send(&keyNote, 1);

}
Beispiel #5
0
//Plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that data values are less than 127
void talkMIDI(unsigned char cmd, unsigned char data1, unsigned char data2) {

	//bit_bang_tx(cmd);
	//putchar (cmd);
	tx0_send(&cmd, 1);
	tx1_send(&cmd, 1);

	//bit_bang_tx(data1);
	//putchar (data1);
	tx0_send(&data1, 1);
	tx1_send(&data1, 1);
	
	//Some commands only have one data byte. All cmds less than 0xBn have 2 data bytes
	//(sort of: http://253.ccarh.org/handout/midiprotocol/)
	//if( (cmd & 0xF0) <= 0xB0) {
	if(cmd <= 0xB0) {
		//bit_bang_tx(data2);
		//putchar (data2);
		tx0_send(&data2, 1);
		tx1_send(&data2, 1);
	}
	tx1_send("\n\r", 2);
}