Skip to content

Commit

Permalink
Merge pull request #9 from BlueAndi/release/2.0.x
Browse files Browse the repository at this point in the history
Prepare v2.0.3
  • Loading branch information
BlueAndi authored Oct 29, 2024
2 parents 70bef68 + 21ce302 commit 3254a5d
Show file tree
Hide file tree
Showing 34 changed files with 261 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.0.3

- Update to VSCP framework v2.0.3, please see the ![changelog](https://github.com/BlueAndi/vscp-framework/releases/tag/v2.0.3) there.
- Deprecated "dataNum" replaced with "dataSize". Thanks to michpro!

## 2.0.2

- Update to VSCP framework v2.0.2, please see the ![changelog](https://github.com/BlueAndi/vscp-framework/releases/tag/v2.0.2) there.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ vscp.prepareTxMessage(txMsg, VSCP_CLASS_L1_INFORMATION, VSCP_TYPE_INFORMATION_ON
### Add the class and type specific data.

```
txMsg.data[0] = 1; // Index
txMsg.data[1] = 0; // Zone
txMsg.data[2] = 0; // Sub zone
txMsg.dataNum = 3;
txMsg.data[0] = 1; // Index
txMsg.data[1] = 0; // Zone
txMsg.data[2] = 0; // Sub zone
txMsg.dataSize = 3;
```

### Send the event.
Expand Down
20 changes: 10 additions & 10 deletions examples/Generic/Generic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ bool transportRead(vscp_RxMessage * const rxMsg) {
rxMsg->vscpType = ...
rxMsg->oAddr = ...
rxMsg->hardCoded = ...
rxMsg->dataNum = ...
rxMsg->dataSize = ...
// Protect against data buffer out of bounce access
if (VSCP_L1_DATA_SIZE < rxMsg->dataNum)
if (VSCP_L1_DATA_SIZE < rxMsg->dataSize)
{
rxMsg->dataNum = VSCP_L1_DATA_SIZE;
rxMsg->dataSize = VSCP_L1_DATA_SIZE;
}
// Copy the payload
for(index = 0; index < rxMsg->dataNum; ++index)
for(index = 0; index < rxMsg->dataSize; ++index)
{
rxMsg->data[index] = ...
}
Expand All @@ -79,10 +79,10 @@ bool transportWrite(vscp_TxMessage const * const txMsg) {
... = rxMsg->vscpType;
... = rxMsg->oAddr;
... = rxMsg->hardCoded;
... = rxMsg->dataNum;
... = rxMsg->dataSize;
// Copy the payload
for(index = 0; index < rxMsg->dataNum; ++index)
for(index = 0; index < rxMsg->dataSize; ++index)
{
... = rxMsg->data[index];
}
Expand Down Expand Up @@ -163,10 +163,10 @@ void loop() {

// Send a VSCP message here ... e.g. a CLASS1.INFORMATION ON event
vscp.prepareTxMessage(txMsg, VSCP_CLASS_L1_INFORMATION, VSCP_TYPE_INFORMATION_ON, VSCP_PRIORITY_3_NORMAL);
txMsg.data[0] = 1; // Index
txMsg.data[1] = 0; // Zone
txMsg.data[2] = 0; // Sub zone
txMsg.dataNum = 3;
txMsg.data[0] = 1; // Index
txMsg.data[1] = 0; // Zone
txMsg.data[2] = 0; // Sub zone
txMsg.dataSize = 3;
vscp.write(txMsg);

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool transportRead(vscp_RxMessage * const rxMsg) {
{
unsigned long canMsgId = 0;

if (CAN_OK == canCom.readMsgBufID(&canMsgId, &rxMsg->dataNum, rxMsg->data)) {
if (CAN_OK == canCom.readMsgBufID(&canMsgId, &rxMsg->dataSize, rxMsg->data)) {

rxMsg->vscpClass = (uint16_t)((canMsgId >> 16) & 0x01ff);
rxMsg->vscpType = (uint8_t)((canMsgId >> 8) & 0x00ff);
Expand Down Expand Up @@ -88,7 +88,7 @@ bool transportWrite(vscp_TxMessage const * const txMsg) {
}

// Send CAN message
if (CAN_OK != canCom.sendMsgBuf(canMsgId, 1, 0, txMsg->dataNum, (unsigned char*)txMsg->data)) {
if (CAN_OK != canCom.sendMsgBuf(canMsgId, 1, 0, txMsg->dataSize, (unsigned char*)txMsg->data)) {

// CAN message couldn't be sent, try again.
++retryCnt;
Expand Down Expand Up @@ -225,4 +225,4 @@ void loop() {

}

}
}
12 changes: 6 additions & 6 deletions examples/Sparkfun_CAN-BUS_Shield/Sparkfun_CAN-BUS_Shield.ino
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ bool transportRead(vscp_RxMessage * const rxMsg) {
rxMsg->oAddr = (uint8_t)((canMsg.adrsValue >> 0) & 0x00ff);
rxMsg->hardCoded = (uint8_t)((canMsg.adrsValue >> 25) & 0x0001);
rxMsg->priority = (VSCP_PRIORITY)((canMsg.adrsValue >> 26) & 0x0007);
rxMsg->dataNum = canMsg.dataLength;
rxMsg->dataSize = canMsg.dataLength;

// Protect against a buffer out of bounce access
if (VSCP_L1_DATA_SIZE < rxMsg->dataNum) {
if (VSCP_L1_DATA_SIZE < rxMsg->dataSize) {

rxMsg->dataNum = VSCP_L1_DATA_SIZE;
rxMsg->dataSize = VSCP_L1_DATA_SIZE;
}

// Copy payload
for(index = 0; index < rxMsg->dataNum; ++index) {
for(index = 0; index < rxMsg->dataSize; ++index) {

rxMsg->data[index] = canMsg.data[index];
}
Expand Down Expand Up @@ -94,7 +94,7 @@ bool transportWrite(vscp_TxMessage const * const txMsg) {

canMsg.rtr = 0;

canMsg.dataLength = txMsg->dataNum;
canMsg.dataLength = txMsg->dataSize;

for(index = 0; index < canMsg.dataLength; ++index) {

Expand Down Expand Up @@ -242,4 +242,4 @@ void loop() {

}

}
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscp-arduino",
"version": "2.0.2",
"version": "2.0.3",
"keywords": "vscp, arduino-library, vscp-arduino, automation, home automation",
"description": "Very Simple Control Procotol (VSCP) Level 1 Library for the arduino IDE.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=VSCP
version=2.0.2
version=2.0.3
author=Andreas Merkle
maintainer=Andreas Merkle <[email protected]>
sentence=Very Simple Control Protocol L1 framework for all Arduino boards.
Expand Down
2 changes: 1 addition & 1 deletion src/framework/core/vscp_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern "C"
#define VSCP_CORE_VERSION_STR "v1.13.1"

/** VSCP framework version string */
#define VSCP_CORE_FRAMEWORK_VERSION "v2.0.2"
#define VSCP_CORE_FRAMEWORK_VERSION "v2.0.3"

/*******************************************************************************
MACROS
Expand Down
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_alarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -225,4 +230,8 @@ extern BOOL vscp_evt_alarm_sendWatchdog(uint8_t index, uint8_t zone, uint8_t sub
*/
extern BOOL vscp_evt_alarm_sendAlarmReset(uint8_t alarmRegister, uint8_t zone, uint8_t subZone);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_ALARM_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_aol.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -256,4 +261,8 @@ extern BOOL vscp_evt_aol_sendUpdateBiosImage(uint8_t index, uint8_t zone, uint8_
*/
extern BOOL vscp_evt_aol_sendUpdatePerformOtherDiagnosticProcedures(uint8_t index, uint8_t zone, uint8_t subZone);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_AOL_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -279,4 +284,8 @@ extern BOOL vscp_evt_configuration_sendSetParameterAcknowledge(uint16_t paramete
*/
extern BOOL vscp_evt_configuration_sendSetParamterNegativeAcknowledge(uint16_t parameterid, uint16_t parametervalue);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_CONFIGURATION_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -685,4 +690,8 @@ extern BOOL vscp_evt_control_sendIncrement(uint8_t userSpecific, uint8_t zone, u
*/
extern BOOL vscp_evt_control_sendDecrement(uint8_t userSpecific, uint8_t zone, uint8_t subzone, uint8_t const * const decrementValue, uint8_t decrementValueSize);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_CONTROL_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -152,4 +157,8 @@ extern BOOL vscp_evt_data_sendSignalLevel(uint8_t index, uint8_t unit, int32_t d
*/
extern BOOL vscp_evt_data_sendSignalQuality(uint8_t index, uint8_t unit, int32_t data, int8_t exp);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_DATA_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -1213,4 +1218,8 @@ extern BOOL vscp_evt_diagnostic_sendChargingOn(uint8_t index, uint8_t zone, uint
*/
extern BOOL vscp_evt_diagnostic_sendChargingOff(uint8_t index, uint8_t zone, uint8_t subZone, uint8_t const * const user, uint8_t userSize);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_DIAGNOSTIC_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -193,4 +198,8 @@ extern BOOL vscp_evt_display_sendSetLed(uint8_t index, uint8_t zone, uint8_t sub
*/
extern BOOL vscp_evt_display_sendSetRgbColor(uint8_t index, uint8_t zone, uint8_t subZone, uint8_t red, uint8_t green, uint8_t blue);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_DISPLAY_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ This file is automatically generated. Don't change it manually.
#include <stdint.h>
#include "..\user\vscp_platform.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -604,4 +609,8 @@ extern BOOL vscp_evt_error_sendOperationStoppedOrAborted(uint8_t index, uint8_t
*/
extern BOOL vscp_evt_error_sendPointerWithInvalidValue(uint8_t index, uint8_t zone, uint8_t subZone, uint8_t const * const user, uint8_t userSize);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_ERROR_H__ */
9 changes: 9 additions & 0 deletions src/framework/events/vscp_evt_gnss.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ This file is automatically generated. Don't change it manually.
#include "..\user\vscp_platform.h"
#include <math.h>

#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
Expand Down Expand Up @@ -100,4 +105,8 @@ extern BOOL vscp_evt_gnss_sendPosition(float_t latitude, float_t longitude);
*/
extern BOOL vscp_evt_gnss_sendSatellites(uint8_t count);

#ifdef __cplusplus
}
#endif

#endif /* __VSCP_EVT_GNSS_H__ */
20 changes: 10 additions & 10 deletions src/framework/events/vscp_evt_information.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ This file is automatically generated. Don't change it manually.
INCLUDES
*******************************************************************************/
#include "vscp_evt_information.h"
#include "..\core\vscp_core.h"
#include "..\core\vscp_class_l1.h"
#include "..\core\vscp_type_information.h"
#include "vscp_core.h"
#include "vscp_class_l1.h"
#include "vscp_type_information.h"

/*******************************************************************************
COMPILER SWITCHES
Expand Down Expand Up @@ -1332,12 +1332,12 @@ extern BOOL vscp_evt_information_sendStreamDataWithZone(uint8_t zone, uint8_t su
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
* @param[in] subZone Sub-Zone for which event applies to (0-255). 255 is all sub-zones.
* @param[in] sequenceNumber Sequence number.
* @param[in] class Class.
* @param[in] type Type.
* @param[in] vscpClass VSCP class.
* @param[in] vscpType VSCP type.
*
* @return If event is sent, it will return TRUE otherwise FALSE.
*/
extern BOOL vscp_evt_information_sendConfirm(uint8_t zone, uint8_t subZone, uint8_t sequenceNumber, uint16_t class, uint16_t type)
extern BOOL vscp_evt_information_sendConfirm(uint8_t zone, uint8_t subZone, uint8_t sequenceNumber, uint16_t vscpClass, uint16_t vscpType)
{
vscp_TxMessage txMsg;
uint8_t size = 0;
Expand All @@ -1353,12 +1353,12 @@ extern BOOL vscp_evt_information_sendConfirm(uint8_t zone, uint8_t subZone, uint
txMsg.data[2] = sequenceNumber;
size += 1;

txMsg.data[3] = (uint8_t)((class >> 8) & 0xff);
txMsg.data[4] = (uint8_t)((class >> 0) & 0xff);
txMsg.data[3] = (uint8_t)((vscpClass >> 8) & 0xff);
txMsg.data[4] = (uint8_t)((vscpClass >> 0) & 0xff);
size += 2;

txMsg.data[5] = (uint8_t)((type >> 8) & 0xff);
txMsg.data[6] = (uint8_t)((type >> 0) & 0xff);
txMsg.data[5] = (uint8_t)((vscpType >> 8) & 0xff);
txMsg.data[6] = (uint8_t)((vscpType >> 0) & 0xff);
size += 2;

txMsg.dataSize = size;
Expand Down
Loading

0 comments on commit 3254a5d

Please sign in to comment.