Skip to content

Commit

Permalink
fixces
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Oct 26, 2024
1 parent 77ee5c4 commit e6bb728
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/driver/drv_max31855.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ static int stage = 0;
int MAX31855_ReadRaw(void) {
int i;
int d = 0;

stage = !stage;

if (stage) {
HAL_PIN_SetOutputValue(port_cs, 0);
usleep(10);
HAL_PIN_SetOutputValue(port_cs, 1);
return;
}
// delay_ms(100);
HAL_PIN_SetOutputValue(port_cs, 0);
usleep(10);
Expand All @@ -52,9 +44,20 @@ int MAX31855_ReadRaw(void) {
void MAX31855_ReadTemperature() {
int raw;

stage = !stage;

// request data
if (stage) {
HAL_PIN_SetOutputValue(port_cs, 0);
usleep(10);
HAL_PIN_SetOutputValue(port_cs, 1);
return;
}
// read data
raw = MAX31855_ReadRaw();

// print it like 0xFFAABBCC
addLogAdv(LOG_INFO, LOG_FEATURE_MAIN, "0x%08X", raw);
//addLogAdv(LOG_INFO, LOG_FEATURE_MAIN, "0x%08X", raw);

if (raw == 0) {
addLogAdv(LOG_INFO, LOG_FEATURE_MAIN, "MAX31855 read fail");
Expand Down

0 comments on commit e6bb728

Please sign in to comment.