Difference between revisions of "Oresat-notes"
Jump to navigation
Jump to search
m |
m |
||
| Line 1: | Line 1: | ||
| + | |||
| + | __TOC__ | ||
| + | |||
Revision as of 22:45, 7 February 2021
Note) Looks like a command shell is realized in code near end of file:
psas/oresat-firmware/src/f4/app_control/source/command.c
Note) ina226.c and other device type driver source files in 'psas/oresat-firmware/common' give examples of I2C calls in ChibiOS environment.
INA226_SHARED_I2C
References:
* https://www.playembedded.org/blog/stm32-i2c-chibios/
Note) Example file which calls an I2C init function among other things, in routine app_init():
oresat-firmware/src$ vi ./archive/f0/app_solardemo/main.c
/*
* I2C configuration
*/
static const I2CConfig i2cfg1 =
{
I2C_100KHZ_TIMINGR,
0,
0,
};
uint8_t data[8];
static void app_init(void) {
//=== App initialization
// Start up debug output
sdStart(&SD2, &ser_cfg);
i2cInit();
i2cStart(&I2CD1, &i2cfg1);
for (uint8_t i = 0; i < 8; ++i) {
data[i] = 0;
}
canTPDOObjectInit(CAN_PDO_1, CAN_ID_DEFAULT, 0, 0, 8, data);
}
Note) pointer *devp is of type INA226Driver, where is this defined?
185 /**
186 * @brief Sets INA226 Alert type and value
187 *
188 * @param[in] devp pointer to the @p INA226Driver object
189 * @param[in] alert_me the value to write to Mask/Enable register (0 to disable)
190 * @param[in] alert_lim the value to write to Alert Limit register
191 *
192 * @api
193 */
194 void ina226SetAlert(INA226Driver *devp, uint16_t alert_me, uint16_t alert_lim) {
195 i2cbuf_t buf;
196
197 osalDbgCheck(devp != NULL);
198 osalDbgAssert(devp->state == INA226_READY,
199 "ina226SetAlert(), invalid state");
Note) Device states for INA226 enumerated as follows:
:~/projects/psas/oresat-firmware/common/include$ grep -nr -A 2 -B 2 INA226_STOP ./*
./ina226.h-277-typedef enum {
./ina226.h-278- INA226_UNINIT = 0, /**< Not initialized. */
./ina226.h:279: INA226_STOP = 1, /**< Stopped. */
./ina226.h-280- INA226_READY = 2, /**< Ready. */
./ina226.h-281-} ina226_state_t;
^ Virtual Methods Table VMT
39 #define _base_object_methods \^M
40 /* Instance offset, used for multiple inheritance, normally zero. It^M
41 represents the offset between the current object and the container^M
42 object*/ \^M
43 size_t instance_offset;^M
44 ^M