I'm trying to wrap up some hardware libraries for use with Node.js and have run into a casting issue. I did some searching around, but Google and the cheat sheets failed me. Can anyone answer how I should properly convert an argument to a unsigned int?
Local<Integer> pin = Uint32::New(args[0]->NumberValue());
Local<Integer> value = Uint32::New(args[1]->NumberValue());
if(set_pin(pin, value) < 0){
ThrowException(Exception::TypeError(String::New("Could not set value on port")));
return scope.Close(Undefined());
}
Results in:
CXX(target) Release/obj.target/gpio/src/gpio.o
../src/gpio.cc: In function ‘v8::Handle<v8::Value> Method(const v8::Arguments&)’:
../src/gpio.cc:51:37: error: cannot convert ‘v8::Local<v8::Integer>’ to ‘unsigned int’ for argument ‘1’ to ‘int set_pin(unsigned int, unsigned int)’
I'm no C expert, so any advice greatly appreciated.
- Jeremy