PSoC™ 4 Forum Discussions
I am trying to set value on my Characteristics which is read able. But it always gives me 0 ( zero ) Value.
The application is very simple, I am trying to set led state from writing values, which is working good. But I want to set that same led state in another characteristics. I have gone through custom profile implementation document, but that didn't work for me. Can any one please guide me?
Below is my main code for your reference.
/**********************************************************************************************************/
#include "project.h"
void Stack_Handler ( uint32 evenCode, void * eventParam );
void Stack_Handler ( uint32 evenCode, void * eventParam )
{
CYBLE_GATTS_WRITE_CMD_REQ_PARAM_T * wrReqParam;
switch( evenCode )
{
case CYBLE_EVT_STACK_ON:
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
CyBle_GappStartAdvertisement( CYBLE_ADVERTISING_FAST );
//PWM_WriteCompare( 500 );
PWM_BLINK_Start();
PWM_DIM_Stop();
break;
case CYBLE_EVT_GATT_CONNECT_IND:
case CYBLE_EVT_GAP_DEVICE_CONNECTED:
//PWM_WriteCompare( 0 );
PWM_BLINK_Stop();
PWM_DIM_Start();
break;
case CYBLE_EVT_GATTS_WRITE_CMD_REQ:
case CYBLE_EVT_GATTS_WRITE_REQ:
wrReqParam = (CYBLE_GATTS_WRITE_CMD_REQ_PARAM_T *) eventParam;
if (CYBLE_LED_GREEN_CHAR_HANDLE == wrReqParam->handleValPair.attrHandle)
{
if (wrReqParam->handleValPair.value.len > 0)
{
uint8 Value[10] = {0};
int loopCounter = 0;
while(loopCounter < wrReqParam->handleValPair.value.len)
{
Value[loopCounter] = wrReqParam->handleValPair.value.val[loopCounter];
loopCounter ++;
}
Value[wrReqParam->handleValPair.value.len] = '\0';
if( strcmp((const char *)Value, "LED_ON") == 0 )
{
PWM_DIM_WriteCompare(0);
}
else if( strcmp((const char *)Value, "LED_OFF") == 0 )
{
PWM_DIM_WriteCompare(100);
}
}
}
CyBle_GattsWriteRsp(cyBle_connHandle);/* Send Response to Write request receievd */
break;
}
}
int main(void)
{
//uint8 String[10] = {0};
uint8 String = 4;
CyGlobalIntEnable; /* Enable global interrupts. */
CyBle_Start( Stack_Handler );
PWM_DIM_Start();
PWM_BLINK_Start();
CYBLE_GATT_HANDLE_VALUE_PAIR_T setReadHandler;
//strcpy((char *)String, "LED_State");
setReadHandler.attrHandle = CYBLE_LED_READ_LED_STATE_CHAR_HANDLE;
setReadHandler.value.val = (uint8 * )&String; // Use a pointer to the value
setReadHandler.value.len = sizeof(String); // Length of the data
CyBle_GattsWriteAttributeValue(&setReadHandler, 0, &cyBle_connHandle, CYBLE_GATT_DB_PEER_INITIATED);
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
/* Place your application code here. */
CyBle_ProcessEvents();
}
}
/* [] END OF FILE */
/*************************************************************************************************/
Show LessHello,
I'm trying to use the function powf in a design.
The target device is CY8C4245AXI-483.
Of course I've included math.h but when I build i Get the message:
"Build error: undefined reference to `powf'"
Building the same code on another target (CY8C4025AZI-403) biuld is successfull.
Can You please help?
thanks,
Alfonso
Show LessHello all,
Does exist a tool to compare TopDesign files?
Thanks in advance.
Yacob.
我们有个Cypress PSOC 应用的问题,想咨询一下。
我们目前用的CY8C3246, firmware 用到了Watchdog
从库函数的描述看,有4档 timer periods. 我们现在选择的已经是最长的间隔了。
CyWdtStart(3, 0); // enable WDT 2.048-3.072s
我们想用更长的timer periods,有什么办法吗?
Show LessBelow is PSoC 4000S TRM description about POR.
Could you please let us know the conditions under which POR becomes valid again after POR is disabled at VCCD rising edge?
Will POR remain invalid unless VCCD goes completely to 0V after POR is executed at VCCD rising edge?
Best Regards.
YuMa
Show LessHow to move the PSOC4 program to RAM and run it? Is there a routine in PSOC CREATOR, thanks.
This is the announcement of the custom component SerialRx v.0.0, implementing simple command line interface between UART Terminal and PSoC microcontroller.
SerialRx: command line UART interface
Using this component, human-readable UART Terminal messages can be easily received and processed by the microcontroller.
Figure 1. Terminal window showing command messages and PSoC4 responses. Recognized commands ('R_ON') are executed with confirmation echo sent back ('>R_ON'). Unrecognized commands ('foo') are ignored and an error status is reported ('!foo').
Show Less
I need to output on a small PSoC4 a PWM signal that is varying from 1% to 50% in 1% steps. Can this be done in hardware on a PSoC4 device. PSoC used: CY8C4025LQI-S402
I've seen examples using two PWM's and Smart IO but there duty cycle goes from 1% to 50% and then inverts. I only need 1% to 50% maximum not the inversion portion(breathing in and out LED's examples). I need to start at 1% go to 50% and stay there. Does anyone know how this can be done on small PSoC device as I listed.
My goal is in code, to adjust the step percentage value based on a voltage measurement.
Thanks
Show Less
Hello,
I made a 4-bit count component by verilog HDL, how can I set up a API like those standard components? such as the command of Counter_WriteCounter(), Counter_ReadCounter().
Chris
Show Less