Commit 360ed539 authored by Adam Wujek's avatar Adam Wujek

common/src/i2c_slave: Calculate status_b on read request

Calculate status_b when the content of this register is requested.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 23a5b715
......@@ -10,7 +10,7 @@ __DEFAULT_NO_xMR
//! PMBus commmands structure
extern cmd_space_t cmds;
uint8_t status_b;
uint8_t status_cml;
int main(void)
{
......
......@@ -35,8 +35,7 @@ static uint16_t added_tx_pec __xMR = 0;
static uint16_t sent_checksum __xMR = 0;
static uint8_t tx_tmp;
extern uint8_t status_b;
uint8_t status_cml;
extern uint8_t status_cml;
/*! This function checks the command array for a specific command. Returns its
* index if it finds it, and -1 if it doesn't. */
......@@ -155,7 +154,6 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des
if (cmds->cmds[cmd_index].w_callback)
notmr_call_helper(cmds->cmds[cmd_index].w_callback);
} else {
status_b |= STATUS_CML;
status_cml = CML_PEC; // PEC error
send_nack(descr);
}
......@@ -220,7 +218,6 @@ static void __xMR I2C_tx_complete(const struct i2c_s_async_descriptor *const des
/*! we get here when something bad has happened */
static void __xMR I2C_error(const struct i2c_s_async_descriptor *const descr)
{
status_b |= STATUS_CML;
status_cml = CML_COMM_ERR; // Other comm fault
hri_sercomi2cs_clear_INTFLAG_ERROR_bit(descr->device.hw);
set_cmd(descr, 2);
......
......@@ -45,7 +45,7 @@ void set_pec();
void read_status_b(void);
void get_status_cml(void);
void write_status_cml(void);
extern uint8_t status_b;
static uint8_t status_b;
extern uint8_t status_cml;
static uint8_t status_cml_tmp;
......
......@@ -133,7 +133,7 @@ float temps[3];
float volts[4];
float currs[3];
uint8_t status_b;
uint8_t status_cml;
uint16_t trig_adc_next_second __xMR = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment