Skip to content

Commit

Permalink
Added page support
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid authored Jun 25, 2018
1 parent 900a5ec commit fdcac80
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion functions/MLX90640_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,66 @@ int MLX90640_GetCurMode(uint8_t slaveAddr)

//------------------------------------------------------------------------------

int MLX90640_SetDeviceMode(uint8_t slaveAddr, uint8_t deviceMode)
{
uint16_t controlRegister1;
int value;
int error;

value = (deviceMode & 0x01)<<4;

error = MLX90640_I2CRead(slaveAddr, 0x800D, 1, &controlRegister1);
if(error == 0)
{
value = (controlRegister1 & 0b1111111111111101) | value;
error = MLX90640_I2CWrite(slaveAddr, 0x800D, value);
}

return error;
}

//------------------------------------------------------------------------------

int MLX90640_SetSubPageRepeat(uint8_t slaveAddr, uint8_t subPageRepeat)
{
uint16_t controlRegister1;
int value;
int error;

value = (subPageRepeat & 0x01)<<3;

error = MLX90640_I2CRead(slaveAddr, 0x800D, 1, &controlRegister1);
if(error == 0)
{
value = (controlRegister1 & 0b1111111111110111) | value;
error = MLX90640_I2CWrite(slaveAddr, 0x800D, value);
}

return error;
}

//------------------------------------------------------------------------------

int MLX90640_SetSubPage(uint8_t slaveAddr, uint8_t subPage)
{
uint16_t controlRegister1;
int value;
int error;

value = (subPage & 0x01)<<4;

error = MLX90640_I2CRead(slaveAddr, 0x800D, 1, &controlRegister1);
if(error == 0)
{
value = (controlRegister1 & 0b1111111110001111) | value;
error = MLX90640_I2CWrite(slaveAddr, 0x800D, value);
}

return error;
}

//------------------------------------------------------------------------------

void MLX90640_CalculateTo(uint16_t *frameData, const paramsMLX90640 *params, float emissivity, float tr, float *result)
{
float vdd;
Expand Down Expand Up @@ -1180,4 +1240,4 @@ int ExtractDeviatingPixels(uint16_t *eeData, paramsMLX90640 *mlx90640)
}

return -7;
}
}

0 comments on commit fdcac80

Please sign in to comment.