First Commit

Dependencies:   mbed Crypto_light mbed-rtos

Spin it 2 win it

Committer:
TrebleStick
Date:
Tue Mar 20 15:10:08 2018 +0000
Revision:
19:526fd700e1b3
Parent:
18:05e5d280a082
Child:
20:a435105305fe
Torque sorted, completed it m8

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TrebleStick 0:88c3d6c8a4eb 1 #include "mbed.h"
andrebharath 3:2e32d7974962 2 #include "Crypto_light/hash/SHA256.h"
andrebharath 3:2e32d7974962 3 #include "mbed-rtos/rtos/rtos.h"
TrebleStick 0:88c3d6c8a4eb 4
TrebleStick 0:88c3d6c8a4eb 5 //Photointerrupter input pins
TrebleStick 0:88c3d6c8a4eb 6 #define I1pin D2
TrebleStick 0:88c3d6c8a4eb 7 #define I2pin D11
TrebleStick 0:88c3d6c8a4eb 8 #define I3pin D12
andrebharath 9:ecef1e8cbe3d 9
TrebleStick 0:88c3d6c8a4eb 10 //Incremental encoder input pins
TrebleStick 0:88c3d6c8a4eb 11 #define CHA D7
TrebleStick 12:1b2e2540e4e1 12 #define CHB D8
andrebharath 9:ecef1e8cbe3d 13
TrebleStick 0:88c3d6c8a4eb 14 //Motor Drive output pins //Mask in output byte
TrebleStick 0:88c3d6c8a4eb 15 #define L1Lpin D4 //0x01
TrebleStick 0:88c3d6c8a4eb 16 #define L1Hpin D5 //0x02
TrebleStick 0:88c3d6c8a4eb 17 #define L2Lpin D3 //0x04
TrebleStick 0:88c3d6c8a4eb 18 #define L2Hpin D6 //0x08
TrebleStick 0:88c3d6c8a4eb 19 #define L3Lpin D9 //0x10
TrebleStick 0:88c3d6c8a4eb 20 #define L3Hpin D10 //0x20
TrebleStick 0:88c3d6c8a4eb 21
andrebharath 9:ecef1e8cbe3d 22 #define CHAR_ARR_SIZE 18 //Max length of input codes
andrebharath 17:80159ace5ddf 23 #define MAX_PWM_PERIOD 2000
andrebharath 18:05e5d280a082 24 #define MAX_TORQUE 1000
andrebharath 3:2e32d7974962 25
TrebleStick 0:88c3d6c8a4eb 26 //Mapping from sequential drive states to motor phase outputs
TrebleStick 0:88c3d6c8a4eb 27 /*
TrebleStick 0:88c3d6c8a4eb 28 State L1 L2 L3
TrebleStick 0:88c3d6c8a4eb 29 0 H - L
TrebleStick 0:88c3d6c8a4eb 30 1 - H L
TrebleStick 0:88c3d6c8a4eb 31 2 L H -
TrebleStick 0:88c3d6c8a4eb 32 3 L - H
TrebleStick 0:88c3d6c8a4eb 33 4 - L H
TrebleStick 0:88c3d6c8a4eb 34 5 H L -
TrebleStick 0:88c3d6c8a4eb 35 6 - - -
TrebleStick 0:88c3d6c8a4eb 36 7 - - -
TrebleStick 0:88c3d6c8a4eb 37 */
TrebleStick 0:88c3d6c8a4eb 38 //Drive state to output table
TrebleStick 0:88c3d6c8a4eb 39 const int8_t driveTable[] = {0x12,0x18,0x09,0x21,0x24,0x06,0x00,0x00};
andrebharath 9:ecef1e8cbe3d 40
TrebleStick 0:88c3d6c8a4eb 41 //Mapping from interrupter inputs to sequential rotor states. 0x00 and 0x07 are not valid
TrebleStick 12:1b2e2540e4e1 42 const int8_t stateMap[] = {0x07,0x05,0x03,0x04,0x01,0x00,0x02,0x07};
TrebleStick 0:88c3d6c8a4eb 43 //const int8_t stateMap[] = {0x07,0x01,0x03,0x02,0x05,0x00,0x04,0x07}; //Alternative if phase order of input or drive is reversed
andrebharath 9:ecef1e8cbe3d 44
TrebleStick 0:88c3d6c8a4eb 45 //Phase lead to make motor spin
TrebleStick 0:88c3d6c8a4eb 46 const int8_t lead = 2; //2 for forwards, -2 for backwards
andrebharath 9:ecef1e8cbe3d 47
andrebharath 9:ecef1e8cbe3d 48 //Rotor offset at motor state 0
andrebharath 18:05e5d280a082 49 volatile int8_t orState = 0;
andrebharath 9:ecef1e8cbe3d 50
andrebharath 17:80159ace5ddf 51 //Set initial torque of 1000
andrebharath 18:05e5d280a082 52 volatile uint32_t torque = 1000;
andrebharath 17:80159ace5ddf 53
andrebharath 9:ecef1e8cbe3d 54
TrebleStick 12:1b2e2540e4e1 55 enum MSG {MSG_RESET, MSG_HASHCOUNT, MSG_NONCE_OK,
andrebharath 17:80159ace5ddf 56 MSG_OVERFLOW, MSG_ROT_PEN, MSG_MAX_SPD, MSG_NEW_KEY, MSG_INP_ERR,
andrebharath 17:80159ace5ddf 57 MSG_TEST, MSG_TORQUE};
andrebharath 9:ecef1e8cbe3d 58
andrebharath 3:2e32d7974962 59 //Instantiate the serial port
andrebharath 9:ecef1e8cbe3d 60 RawSerial pc(SERIAL_TX, SERIAL_RX);
andrebharath 9:ecef1e8cbe3d 61
andrebharath 9:ecef1e8cbe3d 62 //Status LED
andrebharath 9:ecef1e8cbe3d 63 DigitalOut led1(LED1);
andrebharath 9:ecef1e8cbe3d 64
andrebharath 9:ecef1e8cbe3d 65 //Photointerrupter inputs
andrebharath 9:ecef1e8cbe3d 66 InterruptIn I1(I1pin);
andrebharath 9:ecef1e8cbe3d 67 InterruptIn I2(I2pin);
andrebharath 9:ecef1e8cbe3d 68 InterruptIn I3(I3pin);
andrebharath 9:ecef1e8cbe3d 69
andrebharath 9:ecef1e8cbe3d 70 //Motor Drive outputs
andrebharath 17:80159ace5ddf 71 PwmOut L1L(L1Lpin);
andrebharath 9:ecef1e8cbe3d 72 DigitalOut L1H(L1Hpin);
andrebharath 17:80159ace5ddf 73 PwmOut L2L(L2Lpin);
andrebharath 9:ecef1e8cbe3d 74 DigitalOut L2H(L2Hpin);
andrebharath 17:80159ace5ddf 75 PwmOut L3L(L3Lpin);
andrebharath 9:ecef1e8cbe3d 76 DigitalOut L3H(L3Hpin);
andrebharath 9:ecef1e8cbe3d 77
TrebleStick 0:88c3d6c8a4eb 78
andrebharath 3:2e32d7974962 79
andrebharath 3:2e32d7974962 80 typedef struct {
andrebharath 3:2e32d7974962 81 uint8_t code;
TrebleStick 15:bd303ab8a21f 82 int32_t data;
andrebharath 3:2e32d7974962 83 } message_t ;
andrebharath 3:2e32d7974962 84
andrebharath 3:2e32d7974962 85 Mail<message_t,16> outMessages;
andrebharath 3:2e32d7974962 86
TrebleStick 12:1b2e2540e4e1 87
TrebleStick 15:bd303ab8a21f 88 void putMessage(uint8_t code, int32_t data) {//uint64_t
TrebleStick 12:1b2e2540e4e1 89 message_t *pMessage = outMessages.alloc();
TrebleStick 12:1b2e2540e4e1 90 pMessage->code = code;
TrebleStick 12:1b2e2540e4e1 91 pMessage->data = data;
TrebleStick 12:1b2e2540e4e1 92 outMessages.put(pMessage);
TrebleStick 12:1b2e2540e4e1 93 }
TrebleStick 12:1b2e2540e4e1 94
andrebharath 3:2e32d7974962 95 Thread commOutT;
andrebharath 3:2e32d7974962 96
TrebleStick 12:1b2e2540e4e1 97 void commOutFn() {
andrebharath 3:2e32d7974962 98 while(1) {
andrebharath 3:2e32d7974962 99 osEvent newEvent = outMessages.get();
andrebharath 3:2e32d7974962 100 message_t *pMessage = (message_t*)newEvent.value.p;
TrebleStick 15:bd303ab8a21f 101 pc.printf("Message: [%d], data: 0x%08x\r\n",
andrebharath 3:2e32d7974962 102 pMessage->code,pMessage->data);
andrebharath 3:2e32d7974962 103 outMessages.free(pMessage);
andrebharath 3:2e32d7974962 104 }
andrebharath 3:2e32d7974962 105 }
andrebharath 3:2e32d7974962 106
andrebharath 9:ecef1e8cbe3d 107
andrebharath 9:ecef1e8cbe3d 108
TrebleStick 14:66746291017c 109 //Global varible for the Bitcoin Key,maxspeed and rotations_pending
TrebleStick 12:1b2e2540e4e1 110 volatile uint64_t newKey = 0; //check initialise value? ****
TrebleStick 14:66746291017c 111 volatile float maxspeed = 0, rotations_pending = 0;
TrebleStick 14:66746291017c 112 //mutex variables
TrebleStick 14:66746291017c 113 Mutex newKey_mutex;
TrebleStick 14:66746291017c 114 Mutex maxspeed_mutex;
TrebleStick 14:66746291017c 115 Mutex rotations_pending_mutex;
andrebharath 9:ecef1e8cbe3d 116
andrebharath 9:ecef1e8cbe3d 117 //Instantiate a Queue to buffer incoming characters
andrebharath 9:ecef1e8cbe3d 118 Queue<void, 8> inCharQ;
andrebharath 9:ecef1e8cbe3d 119 //serial port ISR to receive each incoming byte and place into queue
andrebharath 9:ecef1e8cbe3d 120 void serialISR() {
andrebharath 9:ecef1e8cbe3d 121 uint8_t newChar = pc.getc();
andrebharath 9:ecef1e8cbe3d 122 inCharQ.put((void*)newChar);
andrebharath 9:ecef1e8cbe3d 123 }
andrebharath 9:ecef1e8cbe3d 124
andrebharath 9:ecef1e8cbe3d 125
TrebleStick 19:526fd700e1b3 126 void photointerrupter_isr()
TrebleStick 19:526fd700e1b3 127 {
TrebleStick 19:526fd700e1b3 128 int8_t intState = readRotorState();
TrebleStick 19:526fd700e1b3 129 motorOut((intState-orState+lead+6)%6, torque); //+6 to make sure the remainder is positive
TrebleStick 19:526fd700e1b3 130 }
andrebharath 9:ecef1e8cbe3d 131
andrebharath 9:ecef1e8cbe3d 132 Thread decodeT;
andrebharath 9:ecef1e8cbe3d 133
TrebleStick 14:66746291017c 134 void setNewCmd(char s[CHAR_ARR_SIZE])
TrebleStick 14:66746291017c 135 {
TrebleStick 14:66746291017c 136 uint64_t newKey_;
andrebharath 17:80159ace5ddf 137 uint32_t torque_;
TrebleStick 14:66746291017c 138 float maxspeed_, rotations_pending_;
TrebleStick 14:66746291017c 139 //R
TrebleStick 14:66746291017c 140 if (sscanf(s, "R%f", &rotations_pending_)) {
andrebharath 17:80159ace5ddf 141 rotations_pending_mutex.lock();
andrebharath 17:80159ace5ddf 142 rotations_pending = rotations_pending_;
andrebharath 17:80159ace5ddf 143 rotations_pending_mutex.unlock();
andrebharath 17:80159ace5ddf 144 putMessage(MSG_ROT_PEN, rotations_pending);
TrebleStick 14:66746291017c 145 //V
TrebleStick 14:66746291017c 146 } else if (sscanf(s, "V%f", &maxspeed_)) {
andrebharath 17:80159ace5ddf 147 maxspeed_mutex.lock();
andrebharath 17:80159ace5ddf 148 maxspeed = maxspeed_;
andrebharath 17:80159ace5ddf 149 maxspeed_mutex.unlock();
andrebharath 17:80159ace5ddf 150 putMessage(MSG_MAX_SPD, maxspeed);
TrebleStick 14:66746291017c 151 //K
TrebleStick 14:66746291017c 152 } else if (sscanf(s, "K%llx", &newKey_)) {
andrebharath 17:80159ace5ddf 153 newKey_mutex.lock();
andrebharath 17:80159ace5ddf 154 newKey = newKey_;
andrebharath 17:80159ace5ddf 155 newKey_mutex.unlock();
andrebharath 17:80159ace5ddf 156 putMessage(MSG_NEW_KEY, newKey);
andrebharath 17:80159ace5ddf 157 } else if (sscanf(s, "T%u", &torque_)) {
andrebharath 17:80159ace5ddf 158 torque = torque_;
TrebleStick 19:526fd700e1b3 159 photointerrupter_isr(); //Give it a kick
andrebharath 17:80159ace5ddf 160 putMessage(MSG_TORQUE, torque);
TrebleStick 14:66746291017c 161 //ERROR
TrebleStick 14:66746291017c 162 } else
TrebleStick 14:66746291017c 163 putMessage(MSG_INP_ERR, 0x404);
TrebleStick 14:66746291017c 164 }
TrebleStick 12:1b2e2540e4e1 165
andrebharath 9:ecef1e8cbe3d 166
andrebharath 9:ecef1e8cbe3d 167
andrebharath 9:ecef1e8cbe3d 168 void decodeFn() {
andrebharath 9:ecef1e8cbe3d 169 pc.attach(&serialISR);
andrebharath 9:ecef1e8cbe3d 170 char charSeq[CHAR_ARR_SIZE] = "";
andrebharath 9:ecef1e8cbe3d 171 uint8_t bufPos = 0;
andrebharath 9:ecef1e8cbe3d 172 while(1) {
TrebleStick 12:1b2e2540e4e1 173
andrebharath 9:ecef1e8cbe3d 174 if(bufPos >= CHAR_ARR_SIZE) {
andrebharath 9:ecef1e8cbe3d 175 putMessage(MSG_OVERFLOW, bufPos);
TrebleStick 12:1b2e2540e4e1 176 bufPos = 0;
andrebharath 9:ecef1e8cbe3d 177 }
TrebleStick 13:ecccfc611025 178 else{
TrebleStick 12:1b2e2540e4e1 179
TrebleStick 13:ecccfc611025 180 osEvent newEvent = inCharQ.get();
TrebleStick 13:ecccfc611025 181 uint8_t newChar = (uint8_t)newEvent.value.p;
TrebleStick 12:1b2e2540e4e1 182
TrebleStick 13:ecccfc611025 183 if(newChar == '\r' || newChar == '\n') {
TrebleStick 13:ecccfc611025 184 charSeq[bufPos] = '\0';
TrebleStick 13:ecccfc611025 185 bufPos = 0;
TrebleStick 13:ecccfc611025 186 setNewCmd(charSeq);
TrebleStick 13:ecccfc611025 187 }
TrebleStick 13:ecccfc611025 188 else {
TrebleStick 13:ecccfc611025 189 charSeq[bufPos] = newChar;
TrebleStick 13:ecccfc611025 190 bufPos++;
TrebleStick 13:ecccfc611025 191 }
TrebleStick 12:1b2e2540e4e1 192 }
andrebharath 9:ecef1e8cbe3d 193 }
andrebharath 9:ecef1e8cbe3d 194 }
andrebharath 9:ecef1e8cbe3d 195
andrebharath 9:ecef1e8cbe3d 196
andrebharath 9:ecef1e8cbe3d 197
andrebharath 9:ecef1e8cbe3d 198
andrebharath 9:ecef1e8cbe3d 199
andrebharath 3:2e32d7974962 200 volatile uint16_t hashcount = 0;
TrebleStick 0:88c3d6c8a4eb 201
andrebharath 9:ecef1e8cbe3d 202 void do_hashcount() {
TrebleStick 15:bd303ab8a21f 203 //putMessage(MSG_HASHCOUNT, hashcount);
andrebharath 3:2e32d7974962 204 hashcount = 0;
andrebharath 3:2e32d7974962 205 }
andrebharath 9:ecef1e8cbe3d 206
andrebharath 9:ecef1e8cbe3d 207
TrebleStick 0:88c3d6c8a4eb 208 //Set a given drive state
andrebharath 17:80159ace5ddf 209 void motorOut(int8_t driveState, uint32_t t){
TrebleStick 12:1b2e2540e4e1 210
TrebleStick 0:88c3d6c8a4eb 211 //Lookup the output byte from the drive state.
TrebleStick 0:88c3d6c8a4eb 212 int8_t driveOut = driveTable[driveState & 0x07];
TrebleStick 12:1b2e2540e4e1 213
TrebleStick 0:88c3d6c8a4eb 214 //Turn off first
andrebharath 17:80159ace5ddf 215 if (~driveOut & 0x01) L1L.pulsewidth_us(0);
TrebleStick 0:88c3d6c8a4eb 216 if (~driveOut & 0x02) L1H = 1;
andrebharath 17:80159ace5ddf 217 if (~driveOut & 0x04) L2L.pulsewidth_us(0);
TrebleStick 0:88c3d6c8a4eb 218 if (~driveOut & 0x08) L2H = 1;
andrebharath 17:80159ace5ddf 219 if (~driveOut & 0x10) L3L.pulsewidth_us(0);
TrebleStick 0:88c3d6c8a4eb 220 if (~driveOut & 0x20) L3H = 1;
TrebleStick 12:1b2e2540e4e1 221
TrebleStick 0:88c3d6c8a4eb 222 //Then turn on
andrebharath 17:80159ace5ddf 223 if (driveOut & 0x01) L1L.pulsewidth_us(t);
TrebleStick 0:88c3d6c8a4eb 224 if (driveOut & 0x02) L1H = 0;
andrebharath 17:80159ace5ddf 225 if (driveOut & 0x04) L2L.pulsewidth_us(t);
TrebleStick 0:88c3d6c8a4eb 226 if (driveOut & 0x08) L2H = 0;
andrebharath 17:80159ace5ddf 227 if (driveOut & 0x10) L3L.pulsewidth_us(t);
TrebleStick 0:88c3d6c8a4eb 228 if (driveOut & 0x20) L3H = 0;
andrebharath 17:80159ace5ddf 229 }
TrebleStick 12:1b2e2540e4e1 230
andrebharath 9:ecef1e8cbe3d 231 //Convert photointerrupter inputs to a rotor state
andrebharath 9:ecef1e8cbe3d 232 inline int8_t readRotorState(){
TrebleStick 0:88c3d6c8a4eb 233 return stateMap[I1 + 2*I2 + 4*I3];
andrebharath 17:80159ace5ddf 234 }
andrebharath 9:ecef1e8cbe3d 235
TrebleStick 12:1b2e2540e4e1 236 //Basic synchronisation routine
andrebharath 9:ecef1e8cbe3d 237 int8_t motorHome() {
TrebleStick 0:88c3d6c8a4eb 238 //Put the motor in drive state 0 and wait for it to stabilise
andrebharath 18:05e5d280a082 239 motorOut(0, MAX_TORQUE);
andrebharath 3:2e32d7974962 240 wait(2.0);
TrebleStick 12:1b2e2540e4e1 241
TrebleStick 0:88c3d6c8a4eb 242 //Get the rotor state
TrebleStick 0:88c3d6c8a4eb 243 return readRotorState();
TrebleStick 0:88c3d6c8a4eb 244 }
andrebharath 3:2e32d7974962 245
andrebharath 9:ecef1e8cbe3d 246
TrebleStick 12:1b2e2540e4e1 247
TrebleStick 0:88c3d6c8a4eb 248 //Main
andrebharath 9:ecef1e8cbe3d 249 int main() {
TrebleStick 12:1b2e2540e4e1 250
andrebharath 9:ecef1e8cbe3d 251 putMessage(MSG_RESET, 0);
andrebharath 9:ecef1e8cbe3d 252
TrebleStick 12:1b2e2540e4e1 253
andrebharath 9:ecef1e8cbe3d 254 commOutT.start(&commOutFn);
TrebleStick 12:1b2e2540e4e1 255
TrebleStick 12:1b2e2540e4e1 256 decodeT.start(&decodeFn);
TrebleStick 12:1b2e2540e4e1 257
andrebharath 9:ecef1e8cbe3d 258 // pc.printf("Hello\n\r");
TrebleStick 12:1b2e2540e4e1 259
andrebharath 9:ecef1e8cbe3d 260 //Run the motor synchronisation
andrebharath 9:ecef1e8cbe3d 261 orState = motorHome();
andrebharath 9:ecef1e8cbe3d 262 // pc.printf("Rotor origin: %x\n\r",orState);
andrebharath 9:ecef1e8cbe3d 263 //orState is subtracted from future rotor state inputs to align rotor and motor states
TrebleStick 12:1b2e2540e4e1 264
andrebharath 3:2e32d7974962 265 I1.rise(&photointerrupter_isr);
andrebharath 3:2e32d7974962 266 I2.rise(&photointerrupter_isr);
andrebharath 3:2e32d7974962 267 I3.rise(&photointerrupter_isr);
TrebleStick 12:1b2e2540e4e1 268
andrebharath 3:2e32d7974962 269 I1.fall(&photointerrupter_isr);
andrebharath 3:2e32d7974962 270 I2.fall(&photointerrupter_isr);
andrebharath 3:2e32d7974962 271 I3.fall(&photointerrupter_isr);
TrebleStick 12:1b2e2540e4e1 272
andrebharath 18:05e5d280a082 273
andrebharath 18:05e5d280a082 274 L1L.period_us(MAX_PWM_PERIOD);
andrebharath 18:05e5d280a082 275 L2L.period_us(MAX_PWM_PERIOD);
andrebharath 18:05e5d280a082 276 L3L.period_us(MAX_PWM_PERIOD);
andrebharath 18:05e5d280a082 277
andrebharath 9:ecef1e8cbe3d 278 //Calling the ISR once starts the motor movement
andrebharath 9:ecef1e8cbe3d 279 photointerrupter_isr();
TrebleStick 19:526fd700e1b3 280
TrebleStick 19:526fd700e1b3 281
TrebleStick 12:1b2e2540e4e1 282
andrebharath 9:ecef1e8cbe3d 283 SHA256 sha256;
TrebleStick 12:1b2e2540e4e1 284
andrebharath 3:2e32d7974962 285 uint8_t sequence[] = {0x45,0x6D,0x62,0x65,0x64,0x64,0x65,0x64,
andrebharath 3:2e32d7974962 286 0x20,0x53,0x79,0x73,0x74,0x65,0x6D,0x73,
andrebharath 3:2e32d7974962 287 0x20,0x61,0x72,0x65,0x20,0x66,0x75,0x6E,
andrebharath 3:2e32d7974962 288 0x20,0x61,0x6E,0x64,0x20,0x64,0x6F,0x20,
andrebharath 3:2e32d7974962 289 0x61,0x77,0x65,0x73,0x6F,0x6D,0x65,0x20,
andrebharath 3:2e32d7974962 290 0x74,0x68,0x69,0x6E,0x67,0x73,0x21,0x20,
andrebharath 3:2e32d7974962 291 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
andrebharath 3:2e32d7974962 292 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
andrebharath 3:2e32d7974962 293 uint64_t* key = (uint64_t*)((int)sequence + 48);
andrebharath 3:2e32d7974962 294 uint64_t* nonce = (uint64_t*)((int)sequence + 56);
andrebharath 3:2e32d7974962 295 uint8_t hash[32];
TrebleStick 12:1b2e2540e4e1 296
andrebharath 9:ecef1e8cbe3d 297 Ticker hashcounter;
andrebharath 9:ecef1e8cbe3d 298 hashcounter.attach(&do_hashcount, 1.0);
TrebleStick 12:1b2e2540e4e1 299
TrebleStick 0:88c3d6c8a4eb 300 //Poll the rotor state and set the motor outputs accordingly to spin the motor
TrebleStick 0:88c3d6c8a4eb 301 while (1) {
TrebleStick 12:1b2e2540e4e1 302
andrebharath 9:ecef1e8cbe3d 303 *key = newKey;
TrebleStick 12:1b2e2540e4e1 304
TrebleStick 14:66746291017c 305
TrebleStick 14:66746291017c 306
TrebleStick 12:1b2e2540e4e1 307
andrebharath 9:ecef1e8cbe3d 308 sha256.computeHash(hash, sequence, 64);
TrebleStick 12:1b2e2540e4e1 309
andrebharath 3:2e32d7974962 310 if (hash[0] == 0 && hash[1] == 0) {
TrebleStick 15:bd303ab8a21f 311 //putMessage(MSG_NONCE_OK, *nonce);
andrebharath 3:2e32d7974962 312 }
andrebharath 3:2e32d7974962 313
andrebharath 3:2e32d7974962 314 (*nonce)++;
andrebharath 3:2e32d7974962 315 hashcount++;
TrebleStick 0:88c3d6c8a4eb 316 }
TrebleStick 0:88c3d6c8a4eb 317 }