1 /*
2  * Copyright (c) 2021 Laird Connectivity. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BL5340_BOARD_H__
18 #define BL5340_BOARD_H__
19 
20 #include <hal/nrf_gpio.h>
21 
22 #define TWI_INSTANCE_NUMBER                   2 /* TWI instance number, cannot be 0 or 1 due to UART usage */
23 #define TWI_FREQUENCY                         NRF_TWIM_FREQ_400K /* Speed to operate I2C (TWI) at */
24 
25 #define PORT_EXPANDER_I2C_ADDRESS             (0x70)
26 #define PORT_EXPANDER_IO_CONFIG               (0x0f) /* IOs 0-3 are input (buttons) and IOs 4-7 are output (LEDs) */
27 
28 #define PORT_EXPANDER_INTERRUPT_PIN           (38UL)
29 #define PORT_EXPANDER_INTERRUPT_ACTIVE_LEVEL  (0UL)
30 #define PORT_EXPANDER_INTERRUPT_PULL          (NRF_GPIO_PIN_NOPULL)
31 
32 #define PORT_EXPANDER_BUTTON1_IO              (0x1)
33 #define PORT_EXPANDER_BUTTON1_ACTIVE_LEVEL    (0x0) /* Corrisponding comparison of above value if button is pressed */
34 
35 #define PORT_EXPANDER_LED1_IO                 (0x10)
36 #define PORT_EXPANDER_LED1_ACTIVE_LEVEL       (0x0) /* Corrisponding comparison of above value if LED is active */
37 
38 #endif // BL5340_BOARD_H__
39