Skip to content

Commit

Permalink
spi: Fix adcs main
Browse files Browse the repository at this point in the history
  • Loading branch information
sasataku committed Nov 6, 2023
1 parent e93e777 commit 8d0d2c8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions adcs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ int main(void)
struct spi_config config;
struct spi_buf tx_buf[1];
struct spi_buf rx_buf[1];
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(spi1));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(spi3));

/* Request Status Register 1 Instruction */
struct spi_buf_set tx_set = { .buffers = tx_buf, .count = 1 };
struct spi_buf_set rx_set = { .buffers = rx_buf, .count = 1 };

/* Enable IMU */
printk("Enable IMU power\n");
//sc_adcs_power_enable(IMU_PWR);
sc_adcs_power_enable(IMU_PWR);

/* Reset */
sys_write32(0x01, 0x50000000 + 0x0004);
Expand All @@ -40,12 +40,11 @@ int main(void)

config.operation = SPI_OP_MODE_MASTER | SPI_LINES_SINGLE | SPI_WORD_SET(8);

//txbuf[0] = 0x81;
txbuf[0] = 0x06;
txbuf[0] = 0x82;
tx_buf[0].buf = txbuf;
tx_buf[0].len = 1;
rx_buf[0].buf = rxbuf;
rx_buf[0].len = 2;
rx_buf[0].len = 1;

ret = spi_transceive(dev, &config, &tx_set, &rx_set);
if (ret < 0) {
Expand Down

0 comments on commit 8d0d2c8

Please sign in to comment.