Sony's LANC camera control protocol project.
Dependencies: aconno_LANC aconno_bsp aconno_SEGGER_RTT
Revision 11:e5f11b96088e, committed 2018-07-12
- Comitter:
- jurica238814
- Date:
- Thu Jul 12 16:51:44 2018 +0000
- Parent:
- 9:978106d4b181
- Child:
- 12:69dbd9ef58e8
- Commit message:
- Segger RTT added. Charac. extended on 2B.
Changed in this revision
--- a/aconno_LANC.lib Wed Jul 11 13:53:47 2018 +0000 +++ b/aconno_LANC.lib Thu Jul 12 16:51:44 2018 +0000 @@ -1,1 +1,1 @@ -aconno_LANC#8c14d4021035 +https://os.mbed.com/users/jurica238814/code/aconno_LANC/#8c14d4021035
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aconno_SEGGER_RTT.lib Thu Jul 12 16:51:44 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/jurica238814/code/aconno_SEGGER_RTT/#abdc4190029b
--- a/main.cpp Wed Jul 11 13:53:47 2018 +0000
+++ b/main.cpp Thu Jul 12 16:51:44 2018 +0000
@@ -15,10 +15,22 @@
#include "GapAdvertisingData.h"
#include "AckService.h"
-#define MY_BUF_SIZE 13*8
-#define LANC_H 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /* 13 B */
-#define LANC_H_L 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF /* 13 B */
-#define LANC_L 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 13 B */
+#define PRINT_ON_RTT (1)
+
+#ifdef PRINT_ON_RTT
+ #include "SEGGER_RTT.h"
+ #define printf(...) SEGGER_RTT_printf(0, __VA_ARGS__)
+#else
+ #define printf(...)
+#endif
+
+#define MY_BUF_SIZE (13*8)
+#define LANC_H 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /* 13 B */
+#define LANC_H_L 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,\
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF /* 13 B */
+#define LANC_L 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 13 B */
/*
* Bitovi na I2S bus idu od MSBa do LSBa
@@ -32,7 +44,7 @@
uint8_t MSD[MSD_SIZE] = {0x59, 0x00, 0xDD, 0x4E, 0xCD, 0xC5, 0x5E, 0xA3, 0x43, 0x67, 0x8B, 0x84, 0x94, 0xFF, 0xBA, 0xD9, 0x29, 0xC6};
uint8_t myMacAddress[6] = {};
-ACKService<1> *ackServicePtr;
+ACKService<2> *ackServicePtr;
BLE &ble = BLE::Instance();
void sendCommand(uint32_t *commandType, uint32_t *command);
@@ -66,7 +78,7 @@
}
void onDataWrittenCallback(const GattWriteCallbackParams *params) {
- //newImage[cnt] = params->data[i];
+ /*
switch(params->data[0]){
case 0x00:{
sendCommand(normalCmdAddr, startStopAddr);
@@ -87,6 +99,28 @@
}
default: break;
}
+ */
+ uint32_t commandType[MY_BUF_SIZE];
+ uint32_t command[MY_BUF_SIZE];
+ uint8_t counter;
+
+ printf("Data[0]: %d\n", params->data[0]);
+ printf("Data[1]: %d\n", params->data[1]);
+
+ for(counter = 0; counter < 8; counter++)
+ {
+ (params->data[0] & (1 << counter)) ? commandType[counter] = LANC_H :
+ commandType[counter] = LANC_L;
+ }
+
+ for(counter = 0; counter < 8; counter++)
+ {
+ (params->data[0] & (1 << counter)) ? command[counter] = LANC_H :
+ command[counter] = LANC_L;
+ }
+
+ //sendCommand(commandType, command);
+
return;
}
@@ -114,13 +148,13 @@
*/
void bleInitComplete(BLE::InitializationCompleteCallbackContext *params){
BLE& ble = params->ble;
- uint8_t init_values[1];
+ uint8_t init_values[2];
/* Get my MAC address */
BLEProtocol::AddressType_t temp_address_type;
ble.gap().getAddress(&temp_address_type, myMacAddress);
- ackServicePtr = new ACKService<1>(ble, init_values);
+ ackServicePtr = new ACKService<2>(ble, init_values);
ble.gap().onDisconnection(disconnectionCallback);
ble.gap().onConnection(onConnectionCallback);