|
Contiki 3.x
|
Driver for the MKL25Z GPIO controller. More...
Files | |
| file | gpio.h |
| Header file with function declarations for the MKL25Z GPIO module. | |
GPIO Manipulation Functions | |
| void | gpio_init () |
| initialise the Port interrupt callback function arrays. More... | |
| void | port_register_callback (void *f, PORT_Type *port, uint8_t pin) |
| Register Port interrupt callback function. More... | |
| uint32_t | port_pin_to_mask (uint8_t pin) |
| Convert a pin number (0 to 31) to a pin mask. More... | |
| void | port_conf_pin (PORT_Type *Port, uint8_t Pin, uint32_t PCR) |
| Configure the specified Pin of the port with PORTx_BASE_PTR with PCR. More... | |
| void | port_conf_pin_int_disable (PORT_Type *Port, uint8_t Pin) |
| Disable interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| void | port_conf_pin_int_zero (PORT_Type *Port, uint8_t Pin) |
| Configure zero-level interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| void | port_conf_pin_int_rise (PORT_Type *Port, uint8_t Pin) |
| Configure rising-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| void | port_conf_pin_int_fall (PORT_Type *Port, uint8_t Pin) |
| Configure falling-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| void | port_conf_pin_int_edge (PORT_Type *Port, uint8_t Pin) |
| Configure either-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| void | port_conf_pin_int_one (PORT_Type *Port, uint8_t Pin) |
| Configure one-level interrupt on the specified Pin of the port with PORTx_BASE_PTR. More... | |
| uint32_t | port_read_isf (PORT_Type *Port) |
| Return the Interrupt Status Flags of port with PORTx_BASE_PTR. More... | |
| bool | port_read_pin_isf (PORT_Type *Port, uint8_t Pin) |
| Return the Interrupt Status Flags of Pin in port with PORTx_BASE_PTR. More... | |
| void | port_clr_isf (PORT_Type *Port, uint32_t Pin_Mask) |
| Clear the Interrupt Status Flag of port with PORTx_BASE_PTR. More... | |
| bool | port_pin_read_isf (PORT_Type *Port, uint8_t Pin) |
| Return the Interrupt Status of the Pin in port with PORTx_BASE_PTR. More... | |
| void | port_pin_clr_isf (PORT_Type *Port, uint8_t Pin) |
| Clear the Interrupt Status Flag of Pin in port with PORTx_BASE_PTR. More... | |
| void | gpio_set_input (GPIO_Type *Port, uint32_t Pin_Mask) |
| Set pins with Pin_Mask of port with GPIOn_BASE_PTR to input. More... | |
| void | gpio_set_output (GPIO_Type *Port, uint32_t Pin_Mask) |
| Set pins with Pin_Mask of port with GPIOn_BASE_PTR to output. More... | |
| void | gpio_set_pin (GPIO_Type *Port, uint32_t Pin_Mask) |
| Set pins with Pin_Mask of port with GPIOn_BASE_PTR high. More... | |
| void | gpio_clr_pin (GPIO_Type *Port, uint32_t Pin_Mask) |
| Clear pins with Pin_Mask of port with GPIOn_BASE_PTR low. More... | |
| void | gpio_tgl_pin (GPIO_Type *Port, uint32_t Pin_Mask) |
| Toggle pins with Pin_Mask of port with GPIOn_BASE_PTR low. More... | |
| uint32_t | gpio_read_pin (GPIO_Type *Port, uint32_t Pin_Mask) |
| Read pins with Pin_Mask of port with GPIOn_BASE_PTR. More... | |
Driver for the MKL25Z GPIO controller.
| void gpio_clr_pin | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Clear pins with Pin_Mask of port with GPIOn_BASE_PTR low.
| Port | - Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 147 of file gpio.c.
References GPIO_Type::PCOR.
Referenced by clock_init().
| void gpio_init | ( | ) |
initialise the Port interrupt callback function arrays.
initialise the Port interrupt callback function arrays.
Definition at line 13 of file gpio.c.
References gpio_callbacks, NVIC_CLEAR_PENDING(), NVIC_ENABLE_INT(), and NVIC_Set_Priority().
Referenced by main().
| uint32_t gpio_read_pin | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Read pins with Pin_Mask of port with GPIOn_BASE_PTR.
| Port | GPIO Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
This macro will not return 0 or 1. Instead, it will return the values of the pins specified by PIN_MASK ORd together. Thus, if you pass 0xC3 (0x80 | 0x40 | 0x02 | 0x01) as the Pin_Mask and pins 7 and 0 are high, the macro will return 0x81.
Definition at line 159 of file gpio.c.
References GPIO_Type::PDDR, GPIO_Type::PDIR, and GPIO_Type::PDOR.
| void gpio_set_input | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Set pins with Pin_Mask of port with GPIOn_BASE_PTR to input.
| Port | - Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 129 of file gpio.c.
References GPIO_Type::PDDR.
| void gpio_set_output | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Set pins with Pin_Mask of port with GPIOn_BASE_PTR to output.
| Port | - Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 135 of file gpio.c.
References GPIO_Type::PDDR.
Referenced by clock_init(), and leds_arch_init().
| void gpio_set_pin | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Set pins with Pin_Mask of port with GPIOn_BASE_PTR high.
| Port | - Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 141 of file gpio.c.
References GPIO_Type::PSOR.
| void gpio_tgl_pin | ( | GPIO_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Toggle pins with Pin_Mask of port with GPIOn_BASE_PTR low.
| Port | - Port register offset |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 153 of file gpio.c.
References GPIO_Type::PTOR.
| void port_clr_isf | ( | PORT_Type * | Port, |
| uint32_t | Pin_Mask | ||
| ) |
Clear the Interrupt Status Flag of port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin_Mask | Pin number mask. Pin 0: 0x01, Pin 1: 0x02 ... Pin 7: 0x80 |
Definition at line 104 of file gpio.c.
References PORT_Type::ISFR.
| void port_conf_pin | ( | PORT_Type * | Port, |
| uint8_t | Pin, | ||
| uint32_t | PCR | ||
| ) |
Configure the specified Pin of the port with PORTx_BASE_PTR with PCR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
| PCR | - The PCR settings to be applied to the pin |
Definition at line 40 of file gpio.c.
References PORT_Type::PCR.
Referenced by clock_init(), and leds_arch_init().
| void port_conf_pin_int_disable | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Disable interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 51 of file gpio.c.
References PORT_Type::PCR.
| void port_conf_pin_int_edge | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Configure either-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 82 of file gpio.c.
References PORT_Type::PCR.
| void port_conf_pin_int_fall | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Configure falling-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 74 of file gpio.c.
References PORT_Type::PCR.
| void port_conf_pin_int_one | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Configure one-level interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 90 of file gpio.c.
References PORT_Type::PCR.
| void port_conf_pin_int_rise | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Configure rising-edge interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 66 of file gpio.c.
References PORT_Type::PCR.
| void port_conf_pin_int_zero | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Configure zero-level interrupt on the specified Pin of the port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 58 of file gpio.c.
References PORT_Type::PCR.
| void port_pin_clr_isf | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Clear the Interrupt Status Flag of Pin in port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be read, from 0 to 31. |
Definition at line 120 of file gpio.c.
References PORT_Type::PCR.
| bool port_pin_read_isf | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Return the Interrupt Status of the Pin in port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be read, from 0 to 31. |
| uint32_t port_pin_to_mask | ( | uint8_t | pin | ) |
Convert a pin number (0 to 31) to a pin mask.
| pin | Associate f with this pin, which is specified by number from 0 to 31 |
Definition at line 46 of file gpio.c.
Referenced by clock_init(), and leds_arch_init().
| uint32_t port_read_isf | ( | PORT_Type * | Port | ) |
Return the Interrupt Status Flags of port with PORTx_BASE_PTR.
| Port | - Port base pointer |
Definition at line 98 of file gpio.c.
References PORT_Type::ISFR.
| bool port_read_pin_isf | ( | PORT_Type * | Port, |
| uint8_t | Pin | ||
| ) |
Return the Interrupt Status Flags of Pin in port with PORTx_BASE_PTR.
| Port | - Port base pointer |
| Pin | - The number of the pin to be conigured, from 0 to 31. |
Definition at line 110 of file gpio.c.
References PORT_Type::PCR.
| void port_register_callback | ( | void * | f, |
| PORT_Type * | port, | ||
| uint8_t | pin | ||
| ) |
Register Port interrupt callback function.
| f | Pointer to a function to be called when pin of port generates an interrupt |
| port | Associate f with this port. port must be specified with its PORTx_BASE_PTR. |
| pin | Associate f with this pin, which is specified by number from 0 to 31 |
1.8.6