diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-09 17:01:58 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-09 17:01:58 +0200 |
commit | 4bdabb2dbf8d523e71f22f994070e99f349c2113 (patch) | |
tree | 10b81b3c440e18d3862e78dc2df0d25c4156459d /main | |
parent | 07106fe9b11d09fcdd1525425634739a3e3c4375 (diff) |
rp2040 driver send still working (kinda)
Diffstat (limited to 'main')
-rw-r--r-- | main/i2c.c | 42 | ||||
-rw-r--r-- | main/init.c | 3 |
2 files changed, 21 insertions, 24 deletions
@@ -9,26 +9,26 @@ #include "i2c.h" #include "pb-mod.h" -uint8_t* scan_bus(uint8_t *array) { - int ret; - int i = 0; - uint8_t rxdata; - - for(int addr = 0; addr < (1<<7); addr++) { - // ignore reserved addresses - // These are any addresses of the form 000 0xxx or 111 1xxx - // ret = i2c_read_blocking(I2C_PORT, addr, &rxdata, 1, false); - - // if acknowledged -> ret == number of bytes sent - if(ret > 0){ - printf("found i2c slave on addr: %d\n", addr); - array[i] = addr; - i++; - } - } - - return array; -} +// uint8_t* scan_bus(uint8_t *array) { +// int ret; +// int i = 0; +// uint8_t rxdata; +// +// for(int addr = 0; addr < (1<<7); addr++) { +// // ignore reserved addresses +// // These are any addresses of the form 000 0xxx or 111 1xxx +// // ret = i2c_read_blocking(I2C_PORT, addr, &rxdata, 1, false); +// +// // if acknowledged -> ret == number of bytes sent +// if(ret > 0){ +// printf("found i2c slave on addr: %d\n", addr); +// array[i] = addr; +// i++; +// } +// } +// +// return array; +// } void bus_task() { // scan bus for slaves @@ -40,7 +40,7 @@ void bus_task() { // init_addr_array(found, MAX_SLAVES); while (true) { - vTaskDelay(9 / portTICK_PERIOD_MS); + vTaskDelay(10 / portTICK_PERIOD_MS); pbdrv_i2c_send(0x69, (uint8_t *) "bbbbbbbb", 9); // i2c_write_blocking(i2c0, 0x69, (uint8_t *) "bbbbbbbb", 9, false); diff --git a/main/init.c b/main/init.c index 1cfec9a..bd00c04 100644 --- a/main/init.c +++ b/main/init.c @@ -25,8 +25,6 @@ static void init_wifi() { if (cyw43_arch_wifi_connect_timeout_ms(CFG_NET_SSID, CFG_NET_PASS, CFG_NET_AUTH, CFG_NET_CONN_TIMEOUT)) panic("cyw43_arch_wifi_connect failed\n"); - printf("connected to Wi-Fi\n"); - // TODO: announce hostname(?) } @@ -35,7 +33,6 @@ static void init_i2c() { gpio_set_function(CFG_SCL_PIN, GPIO_FUNC_I2C); pbdrv_setup(); - //printf("i2c setup\n"); } static void async_init() { |