Generic PIC helper routines. More...
#include <system.h>
#include "config.h"
Go to the source code of this file.
Defines | |
#define | change_pin(port, pin, value) |
#define | change_pin_var(port, pin, value) change_pin(port, pin, value) |
#define | clear_pin(port, pin) clear_bit(port_array[port - PORTA], pin); |
#define | clear_pin_var(port, pin) clear_pin(port, pin) |
#define | end_crit_sec() intcon.GIE = store_gie |
#define | int16 int |
#define | int32 long |
#define | int8 char |
#define | kill_interrupts() |
#define | MAGIC_BOOSTBLOADER_REQUEST 4 |
#define | make_input(port, pin) set_bit(tris_array[port - PORTA], pin) |
#define | make_output(port, pin) clear_bit(tris_array[port - PORTA], pin) |
#define | NUMBER_PORTS 1 |
#define | set_pin(port, pin) set_bit(port_array[port - PORTA], pin); |
#define | set_pin_var(port, pin) set_pin(port, pin) |
#define | start_crit_sec() |
#define | test_output_pin(port, pin) ((port_array[port - PORTA] & (1 << pin)) != 0) |
#define | test_pin(port, pin) ((port_in_array[port - PORTA] & (1 << pin)) != 0) |
#define | test_pin_var(port, pin) test_pin(port, pin) |
#define | toggle_pin(port, pin) port_array[port - PORTA] ^= (1 << (pin)); |
#define | toggle_pin_var(port, pin) toggle_pin(port, pin) |
#define | turn_global_ints_off() clear_bit(intcon, GIE) |
#define | turn_global_ints_on() set_bit(intcon, GIE) |
#define | turn_peripheral_ints_off() clear_bit(intcon, PEIE) |
#define | turn_peripheral_ints_on() set_bit(intcon, PEIE) |
#define | uns16 unsigned int |
#define | uns32 unsigned long |
#define | uns8 unsigned char |
Defines datatypes, port/pin access helpers
Definition in file pic_utils.h.
#define change_pin | ( | port, | |||
pin, | |||||
value | ) |
Definition at line 251 of file pic_utils.h.
Referenced by i2c_send_byte(), lcd_write_nibble(), ms5540_get_config(), ms5540_reset(), pcd8544_send_byte(), pic_rf_send_byte(), pic_rf_send_byte_int(), pic_rf_set_mode(), sht15_send_byte(), spi_pulse_0(), spi_pulse_1(), spi_write(), spi_write_lsb(), and spi_write_sure().
#define change_pin_var | ( | port, | |||
pin, | |||||
value | ) | change_pin(port, pin, value) |
Definition at line 265 of file pic_utils.h.
Referenced by cat4016_write_data(), ht1632_write(), and sure_2416_write().
#define clear_pin | ( | port, | |||
pin | ) | clear_bit(port_array[port - PORTA], pin); |
Definition at line 238 of file pic_utils.h.
Referenced by cat4016_enable_display(), cat4016_latch_data(), cat4016_setup_io(), cat4016_write_data(), drv_paint(), drv_refresh(), ea_ldp6416_setup_io(), ea_ldp6432_setup_io(), ea_ldp8008_setup_io(), ht1632_fill2(), ht1632_send_command(), ht1632_set_pixel(), ht1632_write(), i2c_read_eeprom(), i2c_read_eeprom_16bit(), i2c_receive_byte(), i2c_send_ack(), i2c_send_byte(), i2c_start(), i2c_stop(), lcd_setup(), lcd_toggle_e(), lcd_wait_busy(), lcd_write_command(), lcd_write_data(), lcd_write_data_str(), mrf24j40_long_addr_read(), mrf24j40_long_addr_write(), mrf24j40_short_addr_read(), mrf24j40_short_addr_write(), ms5540_get_raw_pressure(), ms5540_get_raw_temp(), ms5540_pulse_sclk(), ms5540_send_stop(), ms5540_setup_io(), pcd8544_init(), pcd8544_send_byte(), pcd8544_send_command(), pcd8544_send_data(), pcd8544_setup_io(), pic_rf_init(), pic_rf_quick_init(), pic_rf_read_register(), pic_rf_read_register_inline(), pic_rf_read_register_int(), pic_rf_receive(), pic_rf_send_byte(), pic_rf_send_byte_int(), pic_rf_send_command(), pic_rf_send_command_inline(), pic_rf_send_command_single(), pic_rf_set_channel(), pic_rf_set_mode(), pic_rf_setup(), pic_rf_transmit(), platform_leds_setup_io(), pwm_handle(), sht15_read_byte16(), sht15_send_byte(), sht15_setup_io(), sht15_start(), somo_14d_reset(), somo_14d_send_data(), somo_14d_standby(), spi_pulse_0(), spi_pulse_1(), spi_write(), spi_write_lsb(), spi_write_sure(), sure_2416_fill2(), sure_2416_send_command(), sure_2416_set_pixel(), sure_2416_write(), and sure_7seg_write_str().
#define clear_pin_var | ( | port, | |||
pin | ) | clear_pin(port, pin) |
Definition at line 260 of file pic_utils.h.
#define end_crit_sec | ( | ) | intcon.GIE = store_gie |
Definition at line 300 of file pic_utils.h.
Referenced by audio_queue_clear(), drv_paint(), pic_rf_init(), pic_rf_set_channel(), pic_rf_set_mode(), pic_rf_transmit(), pkt_process_rf_data(), serial_getc(), tick_get_count(), usb_cdc_getc(), usb_cdc_handle_tx(), and usb_cdc_putc().
#define int16 int |
Definition at line 82 of file pic_utils.h.
Referenced by ms5540_calc_temp_and_pressure(), and sht15_fix_temperature_h().
#define int32 long |
Definition at line 84 of file pic_utils.h.
Referenced by ms5540_calc_temp_and_pressure(), and sht15_fix_humidity_r().
#define int8 char |
Definition at line 79 of file pic_utils.h.
#define kill_interrupts | ( | ) |
clear_bit(intcon, GIE); \ nop(); \ nop(); \ nop(); \ nop()
Definition at line 288 of file pic_utils.h.
Referenced by pic_rf_receive(), pic_rf_set_channel(), pic_rf_set_mode(), pic_rf_transmit(), and serial_putc().
#define MAGIC_BOOSTBLOADER_REQUEST 4 |
Definition at line 375 of file pic_utils.h.
Referenced by term_process().
#define make_input | ( | port, | |||
pin | ) | set_bit(tris_array[port - PORTA], pin) |
Definition at line 279 of file pic_utils.h.
Referenced by ht1632_set_pixel(), i2c_setup_io(), mrf24j40_setup_io(), ms5540_setup_io(), pic_rf_receive(), pic_rf_setup(), somo_14d_setup_io(), spi_hw_setup_io(), and sure_2416_set_pixel().
#define make_output | ( | port, | |||
pin | ) | clear_bit(tris_array[port - PORTA], pin) |
Definition at line 278 of file pic_utils.h.
Referenced by cat4016_setup_io(), ea_ldp6416_setup_io(), ea_ldp6432_setup_io(), ea_ldp8008_setup_io(), ht1632_set_pixel(), ht1632_setup_io(), i2c_setup_io(), lcd_setup(), mrf24j40_setup_io(), ms5540_setup_io(), pcd8544_setup_io(), pic_rf_init(), pic_rf_quick_init(), pic_rf_set_mode(), pic_rf_setup(), pic_rf_transmit(), platform_leds_setup_io(), pwm_setup_io(), sht15_setup_io(), somo_14d_setup_io(), spi_hw_setup_io(), sure_2416_set_pixel(), and sure_2416_setup().
#define NUMBER_PORTS 1 |
Definition at line 51 of file pic_utils.h.
#define set_pin | ( | port, | |||
pin | ) | set_bit(port_array[port - PORTA], pin); |
Definition at line 235 of file pic_utils.h.
Referenced by cat4016_enable_display(), cat4016_latch_data(), cat4016_setup_io(), cat4016_write_data(), drv_paint(), drv_refresh(), ea_ldp6416_setup_io(), ea_ldp6432_setup_io(), ht1632_fill2(), ht1632_send_command(), ht1632_set_pixel(), ht1632_setup_io(), ht1632_write(), i2c_read_eeprom(), i2c_read_eeprom_16bit(), i2c_receive_byte(), i2c_send_ack(), i2c_send_byte(), i2c_start(), i2c_stop(), lcd_toggle_e(), lcd_wait_busy(), lcd_write_data(), lcd_write_data_str(), mrf24j40_long_addr_read(), mrf24j40_long_addr_write(), mrf24j40_setup_io(), mrf24j40_short_addr_read(), mrf24j40_short_addr_write(), ms5540_get_raw_pressure(), ms5540_get_raw_temp(), ms5540_pulse_sclk(), ms5540_send_start(), pcd8544_init(), pcd8544_send_byte(), pcd8544_send_command(), pcd8544_send_data(), pcd8544_setup_io(), pic_rf_init(), pic_rf_read_register(), pic_rf_read_register_inline(), pic_rf_read_register_int(), pic_rf_receive(), pic_rf_send_byte(), pic_rf_send_byte_int(), pic_rf_send_command(), pic_rf_send_command_inline(), pic_rf_send_command_single(), pic_rf_set_channel(), pic_rf_set_mode(), pic_rf_setup(), pic_rf_transmit(), pwm_handle(), sht15_read_byte16(), sht15_send_byte(), sht15_start(), somo_14d_reset(), somo_14d_send_data(), somo_14d_setup_io(), somo_14d_wake(), spi_pulse_0(), spi_pulse_1(), spi_write(), spi_write_lsb(), spi_write_sure(), sure_2416_fill2(), sure_2416_send_command(), sure_2416_set_pixel(), sure_2416_setup(), sure_2416_write(), and sure_7seg_write_str().
#define set_pin_var | ( | port, | |||
pin | ) | set_pin(port, pin) |
Definition at line 258 of file pic_utils.h.
#define start_crit_sec | ( | ) |
bit store_gie = intcon.GIE; \ kill_interrupts()
Definition at line 295 of file pic_utils.h.
Referenced by audio_queue_clear(), drv_paint(), pic_rf_init(), pic_rf_set_channel(), pic_rf_set_mode(), pic_rf_transmit(), pkt_process_rf_data(), serial_getc(), tick_get_count(), usb_cdc_getc(), usb_cdc_handle_tx(), and usb_cdc_putc().
#define test_output_pin | ( | port, | |||
pin | ) | ((port_array[port - PORTA] & (1 << pin)) != 0) |
Definition at line 248 of file pic_utils.h.
#define test_pin | ( | port, | |||
pin | ) | ((port_in_array[port - PORTA] & (1 << pin)) != 0) |
Definition at line 245 of file pic_utils.h.
Referenced by ht1632_set_pixel(), i2c_ack_polling(), i2c_receive_byte(), lcd_wait_busy(), ms5540_get_config(), ms5540_get_raw_pressure(), ms5540_get_raw_temp(), pic_rf_receive(), pic_rf_send_byte(), pic_rf_send_byte_int(), sht15_read_byte16(), sht15_send_byte(), somo_14d_is_busy(), and sure_2416_set_pixel().
#define test_pin_var | ( | port, | |||
pin | ) | test_pin(port, pin) |
Definition at line 264 of file pic_utils.h.
#define toggle_pin | ( | port, | |||
pin | ) | port_array[port - PORTA] ^= (1 << (pin)); |
Definition at line 241 of file pic_utils.h.
#define toggle_pin_var | ( | port, | |||
pin | ) | toggle_pin(port, pin) |
Definition at line 262 of file pic_utils.h.
#define turn_global_ints_off | ( | ) | clear_bit(intcon, GIE) |
Definition at line 285 of file pic_utils.h.
#define turn_global_ints_on | ( | ) | set_bit(intcon, GIE) |
Definition at line 284 of file pic_utils.h.
#define turn_peripheral_ints_off | ( | ) | clear_bit(intcon, PEIE) |
Definition at line 282 of file pic_utils.h.
#define turn_peripheral_ints_on | ( | ) | set_bit(intcon, PEIE) |
Definition at line 281 of file pic_utils.h.
#define uns16 unsigned int |
Definition at line 81 of file pic_utils.h.
Referenced by ar1000_seek(), ar1000_seek_more(), ar1000_set_volume(), ar1000_test(), ar1000_tune(), draw_length_str(), draw_print_buffer(), draw_print_str(), draw_rect(), draw_set_pixel(), drv_paint(), hmc6352_get_data(), ht1632_fill2(), i2c_read_eeprom_16bit(), its1_device_process(), its2_device_process(), its2_process_tx_queue(), its2_router_process(), its_transmit_to_sa(), mrf24j40_active_channel_scan(), mrf24j40_receive(), mrf24j40_scan_for_lowest_channel_ed(), ms5540_get_config(), ms5540_get_raw_pressure(), ms5540_get_raw_temp(), ms5540_init(), ms5540_reset(), pkt_init(), pkt_process_rf_data(), pkt_process_tx_queue(), platform_leds_process(), sht15_fix_humidity_l(), sht15_read(), sht15_read_byte16(), sht15_read_humidity(), sht15_read_temperature(), sure_2416_fill2(), tick_get_count(), timer_handle_1_isr(), tmp75_read_16bit(), usb_cdc_handle_tx(), usb_handle_transaction(), usb_send_data(), usb_send_data_chunk(), and wpan_data_received_callback().
#define uns32 unsigned long |
Definition at line 83 of file pic_utils.h.
#define uns8 unsigned char |
Definition at line 80 of file pic_utils.h.
Referenced by ar1000_init(), ar1000_set_volume(), ar1000_write_registers(), audio_queue_add(), audio_queue_process(), cat4016_write_data(), draw_bitmap(), draw_clear_screen(), draw_length_str(), draw_print_buffer(), draw_print_str(), draw_set_pixel(), draw_tests_run(), drv_paint(), drv_print_buffer(), drv_refresh(), hc4led_write_str(), hmc6352_read_eeprom(), hmc6352_read_ram(), hmc6352_set_mode(), ht1632_fill(), ht1632_send_command(), ht1632_set_pixel(), ht1632_write(), i2c_read_eeprom(), i2c_receive_byte(), i2c_send_byte(), its1_controller_init(), its1_device_init(), its1_device_process(), its2_find_free_queue_slot(), its2_forward_routed_packet(), its2_print_packet(), its2_print_queue(), its2_process_tx_queue(), its2_rebroadcast_net_discover_req(), its2_router_init(), its2_router_queue_packet(), its2_transmit(), its_add_local_device(), its_add_net_device(), its_get_device_handle(), its_init(), its_print_devices(), its_transmit_to_ea(), its_transmit_to_sa(), mrf24j40_active_channel_scan(), mrf24j40_flush_receive_buffer(), mrf24j40_handle_isr(), mrf24j40_init(), mrf24j40_init_coordinator(), mrf24j40_long_addr_read(), mrf24j40_receive(), mrf24j40_scan_for_lowest_channel_ed(), mrf24j40_set_extended_address(), mrf24j40_short_addr_read(), mrf24j40_transmit(), mrf24j40_transmit_to_extended_address(), mrf24j40_transmit_to_short_address(), ms5540_get_config(), ms5540_get_raw_pressure(), ms5540_get_raw_temp(), ms5540_reset(), pcd8544_send_byte(), pic_rf_init(), pic_rf_quick_init(), pic_rf_read_register(), pic_rf_read_register_inline(), pic_rf_read_register_int(), pic_rf_receive(), pic_rf_send_byte(), pic_rf_send_byte_int(), pic_rf_send_bytes(), pic_rf_send_bytes_inline(), pic_rf_send_command(), pic_rf_send_command_inline(), pic_rf_send_command_single(), pic_rf_set_mode(), pic_rf_transmit(), pkt_calc_check_byte(), pkt_check_check_byte(), pkt_init(), pkt_print_packet(), pkt_process_rf_data(), pkt_process_tx_queue(), pkt_queue_packet(), pkt_seen(), pkt_send_packet(), pkt_send_payload(), pwm_handle(), serial_getc(), serial_print_int(), serial_print_str(), serial_putc(), serial_rx_isr(), serial_tx_isr(), sht15_read_byte16(), sht15_send_byte(), somo_14d_send_data(), spi_write(), spi_write_lsb(), spi_write_sure(), sure_2416_fill(), sure_2416_send_command(), sure_2416_set_pixel(), sure_2416_write(), sure_7seg_write_str(), term_process(), tmp75_read(), usb_cdc_getc(), usb_cdc_handle_tx(), usb_cdc_print_int(), usb_cdc_print_str(), usb_cdc_putc(), usb_ep_data_out_callback(), usb_handle_class_request_callback(), usb_handle_isr(), usb_handle_standard_request(), usb_handle_transaction(), usb_send_data(), usb_send_data_chunk(), usb_send_empty_data_pkt(), usb_send_one_byte(), wpan_data_received_callback(), wpan_handle_receive(), wpan_print_address(), and wpan_print_mac_command().