Please I need help. I’m already trying to several days and I’m not getting success with wixels. I do not understand what is wrong. I’m trying to do the basics. The Wixel connected to the computer apparently is doing the right thing, but the other Wixel does not respond, and apparently did not receive the packets. Below the code I’m using. Its just a test. I need process the packet, not send back, but until now, I cant transmit any packet.
/*
* aaClient.c
*/
#include <wixel.h>
#include <string.h>
#include <usb.h>
#include <usb_com.h>
#include <radio_queue.h>
#define false 0
#define true !false
uint8 XDATA radioBuf[22];
BIT sendBuf = false;
uint32 redOn = 0;
uint32 yellowOn = 0;
void updateLeds()
{
usbShowStatusWithGreenLed();
LED_RED(redOn);
if(redOn) redOn--;
LED_YELLOW(yellowOn);
if(yellowOn) yellowOn--;
}
void radioRxService()
{
uint8 XDATA * pack;
pack = radioQueueRxCurrentPacket();
if (pack)
{
memcpy(radioBuf, pack, pack[0]+1);
radioQueueRxDoneWithPacket();
sendBuf = true;
yellowOn = 0x1000;
}
}
void radioTxService()
{
uint8 XDATA * pack;
if(!sendBuf)return;
pack = radioQueueTxCurrentPacket();
if (pack)
{
memcpy(radioBuf, pack, radioBuf[0]+1);
radioQueueTxSendPacket();
sendBuf = false;
redOn = 0x1000;
radioMacStrobe();
}
}
void main()
{
systemInit();
usbInit();
radioQueueInit();
while(1)
{
updateLeds();
boardService();
usbComService();
radioRxService();
radioTxService();
//imHere();
}
}
#define TIME_TO_SEND 5000
void imHere()
{ static uint32 lastSend = getMs();
uint8 XDATA * pack;
if(((getMs()-lastSend)>TIME_TO_SEND)&&radioQueueTxAvailable())
{
pack = radioQueueTxCurrentPacket();
if (pack)
{
pack[0] = 0x04;
pack[1] = serialNumber[3];
pack[2] = serialNumber[2];
pack[3] = serialNumber[1];
pack[4] = serialNumber[0];
radioQueueTxSendPacket();
lastSend = getMs();
radioMacStrobe();
}
}
}