Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cerb changes to build proper #224

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
29 changes: 28 additions & 1 deletion Core/Src/pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@

static osMutexAttr_t pdu_mutex_attributes;

//hi2c2 variable to pass to the function wrappers
extern I2C_HandleTypeDef hi2c2;

//Function wrapper for the STM specific HAL write function
//Serves as function pointer for PCA PAL
static inline int pca_i2c_write(uint16_t dev_addr, uint16_t address,
uint16_t mem_add_size, uint8_t *data,
uint16_t size, int delay)

{
return HAL_I2C_Mem_Write(&hi2c2, dev_addr, address, mem_add_size, data,
size, delay);
}

//Function wrapper for the STM specific HAL read function
//Serves as function pointer for PCA PAL
static inline int pca_i2c_read(uint16_t dev_addr, uint16_t address,
uint16_t mem_add_size, uint8_t *data,
uint16_t size, int delay)
{
return HAL_I2C_Mem_Write(&hi2c2, dev_addr, address, mem_add_size, data,
size, delay);
}

static uint8_t sound_rtds(pdu_t *pdu)
{
if (!pdu)
Expand Down Expand Up @@ -129,7 +153,10 @@ pdu_t *init_pdu(I2C_HandleTypeDef *hi2c)
/* Initialize Control GPIO Expander */
pdu->ctrl_expander = malloc(sizeof(pca9539_t));
assert(pdu->ctrl_expander);
pca9539_init(pdu->ctrl_expander, pdu->hi2c, CTRL_ADDR);

//NEED
pca9539_init(pdu->ctrl_expander, pca_i2c_write, pca_i2c_read,
CTRL_ADDR);

// write everything OFF, FAULT 1 is off
uint8_t buf = 0b00000010;
Expand Down
Loading