Oresat-code-snippets
From Wiki at Neela Nurseries
2021-02-11
Looking at solar_dev__temperature-work-002 code, driver declarations in solar.c:
69 70 //---------------------------------------------------------------------- 71 // ORESAT_TASK_001 - add temperature sensor driver: 72 73 static const TMP101Config tmp101anconfig = 74 { 75 &I2CD2, 76 &i2cconfig, 77 I2C_ADDR_SENSOR_01 78 }; 79 80 static TMP101Driver tmp101andev; 81 82 // 83 //---------------------------------------------------------------------- 84 85 221 222 /* Main solar management thread */ 223 THD_WORKING_AREA(solar_wa, 0x400); 224 THD_FUNCTION(solar, arg) 225 { 226 (void)arg; 227 uint32_t voltage, power; 228 int32_t current; 229 uint32_t iadj_uv = 1500000; 230 uint32_t i_in=0; 231 int i, j; 232 233 /* Start up drivers */ 234 ina226ObjectInit(&ina226dev); 235 dacStart(&DACD1, &dac1cfg); 236 ina226Start(&ina226dev, &ina226config); 237 238 tmp101ObjectInit(&tmp101andev); 239 tmp101Start(&tmp101andev, &tmp101anconfig); 240
Comparing with read_temperature.c in _003 branch: