Skip to content

Commit

Permalink
Add configurable SPI frequency in mos.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gyavolo committed Feb 10, 2021
1 parent 207bdb1 commit cf39df6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ conds:
- src/mgos_ade7953_spi.c
libs:
- location: https://github.com/mongoose-os-libs/spi
cdefs:
MGOS_ADE7953_SPI_FREQ: 1000000

- when: cdefs.MGOS_ADE7953_ENABLE_I2C == "1"
apply:
Expand Down
4 changes: 2 additions & 2 deletions src/mgos_ade7953_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bool mgos_ade7953_write_reg_spi(struct mgos_ade7953 *dev, uint16_t reg, int size
struct mgos_spi_txn txn = {
.cs = dev->spi_cs,
.mode = 3,
.freq = 1e6,
.freq = MGOS_ADE7953_SPI_FREQ,
.hd =
{
.tx_data = data_out,
Expand Down Expand Up @@ -61,7 +61,7 @@ bool mgos_ade7953_read_reg_spi(struct mgos_ade7953 *dev, uint16_t reg, int size,
struct mgos_spi_txn txn = {
.cs = dev->spi_cs,
.mode = 3,
.freq = 1e6,
.freq = MGOS_ADE7953_SPI_FREQ,
.hd =
{
.tx_data = data_out,
Expand Down

0 comments on commit cf39df6

Please sign in to comment.