Bluetooth communication for flocking.
Fork of BeautifulMemeProject by
PsiSwarm/eprom.h@6:ff3c66f7372b, 2015-10-22 (annotated)
- Committer:
- jah128
- Date:
- Thu Oct 22 00:46:14 2015 +0000
- Revision:
- 6:ff3c66f7372b
- Parent:
- 0:8a5497a2e366
Initial version: beacon detection and sync. code, bearing estimation.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 0:8a5497a2e366 | 1 | /** University of York Robotics Laboratory PsiSwarm Library: Eprom Functions Header File |
jah128 | 0:8a5497a2e366 | 2 | * |
jah128 | 0:8a5497a2e366 | 3 | * File: eprom.h |
jah128 | 0:8a5497a2e366 | 4 | * |
jah128 | 6:ff3c66f7372b | 5 | * (C) Dept. Electronics & Computer Science, University of York |
jah128 | 6:ff3c66f7372b | 6 | * James Hilder, Alan Millard, Homero Elizondo, Jon Timmis |
jah128 | 0:8a5497a2e366 | 7 | * |
jah128 | 6:ff3c66f7372b | 8 | * PsiSwarm Library Version: 0.3, October 2015 |
jah128 | 0:8a5497a2e366 | 9 | * |
jah128 | 0:8a5497a2e366 | 10 | * Functions for accessing the 64Kb EPROM chip and reading the reserved firmware block |
jah128 | 0:8a5497a2e366 | 11 | * |
jah128 | 0:8a5497a2e366 | 12 | * Example: |
jah128 | 0:8a5497a2e366 | 13 | * @code |
jah128 | 0:8a5497a2e366 | 14 | * #include "psiswarm.h" |
jah128 | 0:8a5497a2e366 | 15 | * |
jah128 | 0:8a5497a2e366 | 16 | * int main() { |
jah128 | 0:8a5497a2e366 | 17 | * init(); |
jah128 | 0:8a5497a2e366 | 18 | * write_eeprom_byte(0,0xDD); //Writes byte 0xDD in EPROM address 0 |
jah128 | 0:8a5497a2e366 | 19 | * char c = read_eeprom_byte(0); //c will hold 0xDD |
jah128 | 0:8a5497a2e366 | 20 | * //Valid address range is from 0 to 65279 |
jah128 | 0:8a5497a2e366 | 21 | * } |
jah128 | 0:8a5497a2e366 | 22 | * @endcode |
jah128 | 0:8a5497a2e366 | 23 | */ |
jah128 | 0:8a5497a2e366 | 24 | |
jah128 | 0:8a5497a2e366 | 25 | #ifndef EPROM_H |
jah128 | 0:8a5497a2e366 | 26 | #define EPROM_H |
jah128 | 0:8a5497a2e366 | 27 | |
jah128 | 0:8a5497a2e366 | 28 | /** Write a single byte to the EPROM |
jah128 | 0:8a5497a2e366 | 29 | * |
jah128 | 0:8a5497a2e366 | 30 | * @param address The address to store the data, range 0-65279 |
jah128 | 0:8a5497a2e366 | 31 | * @param data The character to store |
jah128 | 0:8a5497a2e366 | 32 | */ |
jah128 | 0:8a5497a2e366 | 33 | void write_eeprom_byte ( int address, char data ); |
jah128 | 0:8a5497a2e366 | 34 | |
jah128 | 0:8a5497a2e366 | 35 | /** Read a single byte from the EPROM |
jah128 | 0:8a5497a2e366 | 36 | * |
jah128 | 0:8a5497a2e366 | 37 | * @param address The address to read from, range 0-65279 |
jah128 | 0:8a5497a2e366 | 38 | * @return The character stored at address |
jah128 | 0:8a5497a2e366 | 39 | */ |
jah128 | 0:8a5497a2e366 | 40 | char read_eeprom_byte ( int address ); |
jah128 | 0:8a5497a2e366 | 41 | |
jah128 | 0:8a5497a2e366 | 42 | /** Read the next byte from the EPROM, to be called after read_eeprom_byte |
jah128 | 0:8a5497a2e366 | 43 | * |
jah128 | 0:8a5497a2e366 | 44 | * @return The character stored at address after the previous one read from |
jah128 | 0:8a5497a2e366 | 45 | */ |
jah128 | 0:8a5497a2e366 | 46 | char read_next_eeprom_byte ( void ); |
jah128 | 0:8a5497a2e366 | 47 | |
jah128 | 0:8a5497a2e366 | 48 | /** Read the data stored in the reserved firmware area of the EPROM |
jah128 | 0:8a5497a2e366 | 49 | * |
jah128 | 0:8a5497a2e366 | 50 | * @return 1 if a valid firmware is read, 0 otherwise |
jah128 | 0:8a5497a2e366 | 51 | */ |
jah128 | 0:8a5497a2e366 | 52 | char read_firmware ( void ); |
jah128 | 0:8a5497a2e366 | 53 | |
jah128 | 0:8a5497a2e366 | 54 | #endif |