8#ifndef ARDUINO_GPIO_NXP_ARD_H
9#define ARDUINO_GPIO_NXP_ARD_H
14#include <I2C_device.h>
21enum access_word : uint8_t
65 GPIO_base( uint8_t i2c_address,
const int nbits,
const uint8_t* arp, uint8_t ai );
75 GPIO_base( TwoWire& wire, uint8_t i2c_address,
const int nbits,
const uint8_t* arp, uint8_t ai );
84 void begin( board env = NONE );
94 void output(
int port, uint8_t value, uint8_t mask = 0 );
102 void output( uint8_t *vp );
111 uint8_t
input(
int port );
120 uint8_t*
input( uint8_t *vp );
130 void config(
int port, uint8_t
config, uint8_t mask = 0 );
138 void config( uint8_t* vp );
147 void write_port( access_word w, uint8_t* vp );
166 uint8_t*
read_port( access_word w, uint8_t* vp );
176 uint16_t*
read_port16( access_word w, uint16_t* vp );
186 void write_port( access_word w, uint8_t value,
int port_num = 0 );
196 void write_port16( access_word w, uint16_t value,
int port_num = 0 );
206 uint8_t
read_port( access_word w,
int port_num = 0 );
216 uint16_t
read_port16( access_word w,
int port_num = 0 );
218 static void print_bin( uint8_t v );
222 const uint8_t auto_increment;
225 static constexpr int RESET_PIN = 8;
226 static constexpr int ADDR_PIN = 9;
246 PCA9554( uint8_t i2c_address = (0x40 >> 1) + 0 );
247 PCA9554( TwoWire& wire, uint8_t i2c_address = (0x40 >> 1) + 0 );
250 static constexpr uint8_t access_ref[ NUM_access_word ] = {
274 Input_Port_0, Input_Port_1,
275 Output_Port_0, Output_Port_1,
276 Polarity_Inversion_Port_0, Polarity_Inversion_Port_1,
277 Configuration_Port_0, Configuration_Port_1,
280 PCA9555( uint8_t i2c_address = (0x40 >> 1) + 0 );
281 PCA9555( TwoWire& wire, uint8_t i2c_address = (0x40 >> 1) + 0 );
284 static constexpr uint8_t access_ref[ NUM_access_word ] = {
287 Polarity_Inversion_Port_0,
288 Configuration_Port_0,
309 PCAL6xxx_base( uint8_t i2c_address,
const int nbits,
const uint8_t arp[], uint8_t ai );
310 PCAL6xxx_base( TwoWire& wire, uint8_t i2c_address,
const int nbits,
const uint8_t arp[], uint8_t ai );
328 Output_drive_strength_0 = 0x40,
329 Output_drive_strength_1,
331 Pull_up_pull_down_enable,
332 Pull_up_pull_down_selection,
335 Output_port_configuration,
338 PCAL6408A( uint8_t i2c_address = (0x40 >> 1) + 0 );
339 PCAL6408A( TwoWire& wire, uint8_t i2c_address = (0x40 >> 1) + 0 );
342 static constexpr uint8_t access_ref[ NUM_access_word ] = {
347 Output_drive_strength_0,
349 Pull_up_pull_down_enable,
350 Pull_up_pull_down_selection,
353 Output_port_configuration,
366 Input_Port_0, Input_Port_1,
367 Output_Port_0, Output_Port_1,
368 Polarity_Inversion_port_0, Polarity_Inversion_port_1,
369 Configuration_port_0, Configuration_port_1,
370 Output_drive_strength_register_0=0x40, Output_drive_strength_register_0B,
371 Output_drive_strength_register_1, Output_drive_strength_register_1B,
372 Input_latch_register_0, Input_latch_register_1,
373 Pull_up_pull_down_enable_register_0, Pull_up_pull_down_enable_register_1,
374 Pull_up_pull_down_selection_register_0, Pull_up_pull_down_selection_register_1,
375 Interrupt_mask_register_0, Interrupt_mask_register_1,
376 Interrupt_status_register_0, Interrupt_status_register_1,
377 Output_port_configuration_register,
380 PCAL6416A( uint8_t i2c_address = (0x40 >> 1) + 0 );
381 PCAL6416A( TwoWire& wire, uint8_t i2c_address = (0x40 >> 1) + 0 );
384 static constexpr uint8_t access_ref[ NUM_access_word ] = {
387 Polarity_Inversion_port_0,
388 Configuration_port_0,
389 Output_drive_strength_register_0,
390 Input_latch_register_0,
391 Pull_up_pull_down_enable_register_0,
392 Pull_up_pull_down_selection_register_0,
393 Interrupt_mask_register_0,
394 Interrupt_status_register_0,
395 Output_port_configuration_register,
408 Input_Port_0, Input_Port_1, Input_Port_2, reserved0,
409 Output_Port_0, Output_Port_1, Output_Port_2, reserved1,
410 Polarity_Inversion_port_0, Polarity_Inversion_port_1, Polarity_Inversion_port_2, reserved2,
411 Configuration_port_0, Configuration_port_1, Configuration_port_2,
412 Output_drive_strength_register_port_0A=0x40, Output_drive_strength_register_port_0B,
413 Output_drive_strength_register_port_1A, Output_drive_strength_register_port_1B,
414 Output_drive_strength_register_port_2A, Output_drive_strength_register_port_2B,
415 reserved3, reserved4,
416 Input_latch_register_port_0, Input_latch_register_port_1, Input_latch_register_port_2, reserved5,
417 Pull_up_pull_down_enable_register_port_0, Pull_up_pull_down_enable_register_port_1, Pull_up_pull_down_enable_register_port_2, reserved6,
418 Pull_up_pull_down_selection_register_port_0, Pull_up_pull_down_selection_register_port_1, Pull_up_pull_down_selection_register_port_2, reserved7,
419 Interrupt_mask_register_port_0, Interrupt_mask_register_port_1, Interrupt_mask_register_port_2, reserved8,
420 Interrupt_status_register_port_0, Interrupt_status_register_port_1, Interrupt_status_register_port_2, reserved9,
421 Output_port_configuration_register, reserved10, reserved11, reserved12,
422 Interrupt_edge_register_port_0A, Interrupt_edge_register_port_0B,
423 Interrupt_edge_register_port_1A, Interrupt_edge_register_port_1B,
424 Interrupt_edge_register_port_2A, Interrupt_edge_register_port_2B,
425 reserved13, reserved14,
426 Interrupt_clear_register_port_0, Interrupt_clear_register_port_1, Interrupt_clear_register_port_2, reserved15,
427 Input_status_port_0, Input_status_port_1, Input_status_port_2, reserved16,
428 Individual_pin_output_port_0_configuration_register, Individual_pin_output_port_1_configuration_register, Individual_pin_output_port_2_configuration_register, reserved17,
429 Switch_debounce_enable_0, Switch_debounce_enable_1, Switch_debounce_count,
432 PCAL6524( uint8_t i2c_address = (0x44 >> 1) + 0 );
433 PCAL6524( TwoWire& wire, uint8_t i2c_address = (0x44 >> 1) + 0 );
436 static constexpr uint8_t access_ref[ NUM_access_word ] = {
439 Polarity_Inversion_port_0,
440 Configuration_port_0,
441 Output_drive_strength_register_port_0A,
442 Input_latch_register_port_0,
443 Pull_up_pull_down_enable_register_port_0,
444 Pull_up_pull_down_selection_register_port_0,
445 Interrupt_mask_register_port_0,
446 Interrupt_status_register_port_0,
447 Output_port_configuration_register,
460 Input_Port_0, Input_Port_1, Input_Port_2, Input_Port_3, Input_Port_4,
461 Output_Port_0, Output_Port_1, Output_Port_2, Output_Port_3, Output_Port_4,
462 Polarity_Inversion_port_0, Polarity_Inversion_port_1, Polarity_Inversion_port_2, Polarity_Inversion_port_3, Polarity_Inversion_port_4,
463 Configuration_port_0, Configuration_port_1, Configuration_port_2, Configuration_port_3, Configuration_port_4,
464 Output_drive_strength_register_port_0A = 0x30, Output_drive_strength_register_port_0B,
465 Output_drive_strength_register_port_1A, Output_drive_strength_register_port_1B,
466 Output_drive_strength_register_port_2A, Output_drive_strength_register_port_2B,
467 Output_drive_strength_register_port_3A, Output_drive_strength_register_port_3B,
468 Output_drive_strength_register_port_4A, reserved0,
469 Input_latch_register_port_0, Input_latch_register_port_1, Input_latch_register_port_2, Input_latch_register_port_3, Input_latch_register_port_4,
470 Pull_up_pull_down_enable_register_port_0, Pull_up_pull_down_enable_register_port_1, Pull_up_pull_down_enable_register_port_2, Pull_up_pull_down_enable_register_port_3, Pull_up_pull_down_enable_register_port_4,
471 Pull_up_pull_down_selection_register_port_0, Pull_up_pull_down_selection_register_port_1, Pull_up_pull_down_selection_register_port_2, Pull_up_pull_down_selection_register_port_3, Pull_up_pull_down_selection_register_port_4,
472 Interrupt_mask_register_port_0, Interrupt_mask_register_port_1, Interrupt_mask_register_port_2, Interrupt_mask_register_port_3, Interrupt_mask_register_port_4,
473 Interrupt_status_register_port_0, Interrupt_status_register_port_1, Interrupt_status_register_port_2, Interrupt_status_register_port_3, Interrupt_status_register_port_4,
474 Output_port_configuration_register,
475 Interrupt_edge_register_port_0A, Interrupt_edge_register_port_0B,
476 Interrupt_edge_register_port_1A, Interrupt_edge_register_port_1B,
477 Interrupt_edge_register_port_2A, Interrupt_edge_register_port_2B,
478 Interrupt_edge_register_port_3A, Interrupt_edge_register_port_3B,
479 Interrupt_edge_register_port_4A, reserved1,
480 Interrupt_clear_register_port_0, Interrupt_clear_register_port_1, Interrupt_clear_register_port_2, Interrupt_clear_register_port_3, Interrupt_clear_register_port_4,
481 Input_status_port_0, Input_status_port_1, Input_status_port_2, Input_status_port_3, Input_status_port_4,
482 Individual_pin_output_port_0_configuration_register, Individual_pin_output_port_1_configuration_register, Individual_pin_output_port_2_configuration_register, Individual_pin_output_port_3_configuration_register, Individual_pin_output_port_4_configuration_register,
483 Switch_debounce_enable_0, Switch_debounce_enable_1,
484 Switch_debounce_count,
487 PCAL6534( uint8_t i2c_address = (0x44 >> 1) + 0 );
488 PCAL6534( TwoWire& wire, uint8_t i2c_address = (0x44 >> 1) + 0 );
491 static constexpr uint8_t access_ref[ NUM_access_word ] = {
494 Polarity_Inversion_port_0,
495 Configuration_port_0,
496 Output_drive_strength_register_port_0A,
497 Input_latch_register_port_0,
498 Pull_up_pull_down_enable_register_port_0,
499 Pull_up_pull_down_selection_register_port_0,
500 Interrupt_mask_register_port_0,
501 Interrupt_status_register_port_0,
502 Output_port_configuration_register,
uint16_t * read_port16(access_word w, uint16_t *vp)
void config(int port, uint8_t config, uint8_t mask=0)
void write_port16(access_word w, uint16_t *vp)
void output(int port, uint8_t value, uint8_t mask=0)
void write_port(access_word w, uint8_t *vp)
void begin(board env=NONE)
uint8_t * read_port(access_word w, uint8_t *vp)