firmware: octsimtest: mcp23017 initializaiton

* driver should not have hard-coded understanding about I/O directions
* board code should pass the I/O direction to driver
* board code should use the correct I/O directions (A0..7, B0: output)

Change-Id: Id4a8e012a33cee01bb489e612e17920760b9be59
This commit is contained in:
Harald Welte
2021-06-03 13:19:46 +02:00
parent d46f6bae2c
commit dd5794c975
3 changed files with 20 additions and 10 deletions

View File

@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*/
#include <stdbool.h>
#include "board.h"
#include "simtrace.h"
#include "utils.h"
@@ -27,6 +28,8 @@
#include "mcp23017.h"
#include "mux.h"
static bool mcp2317_present = false;
void board_exec_dbg_cmd(int ch)
{
switch (ch) {
@@ -69,8 +72,9 @@ void board_main_top(void)
mux_init();
i2c_pin_init();
if (!mcp23017_init(MCP23017_ADDRESS))
printf("mcp23017 not found!\n\r");
/* PORT A: all outputs, Port B0 output, B1..B7 unused */
if (mcp23017_init(MCP23017_ADDRESS, 0x00, 0xfe) == 0)
mcp2317_present = true;
/* Initialize checking for card insert/remove events */
//card_present_init();
#endif