C++ Library for the PsiSwarm Robot - Version 0.7
Fork of PsiSwarmV7 by
eprom.h@6:b340a527add9, 2016-10-15 (annotated)
- Committer:
- jah128
- Date:
- Sat Oct 15 13:51:39 2016 +0000
- Revision:
- 6:b340a527add9
- Parent:
- 5:3cdd1a37cdd7
Added Apache license to files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 0:d6269d17c8cf | 1 | /** University of York Robotics Laboratory PsiSwarm Library: Eprom Functions Header File |
jah128 | 0:d6269d17c8cf | 2 | * |
jah128 | 6:b340a527add9 | 3 | * Copyright 2016 University of York |
jah128 | 6:b340a527add9 | 4 | * |
jah128 | 6:b340a527add9 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |
jah128 | 6:b340a527add9 | 6 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
jah128 | 6:b340a527add9 | 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS |
jah128 | 6:b340a527add9 | 8 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jah128 | 6:b340a527add9 | 9 | * See the License for the specific language governing permissions and limitations under the License. |
jah128 | 6:b340a527add9 | 10 | * |
jah128 | 0:d6269d17c8cf | 11 | * File: eprom.h |
jah128 | 0:d6269d17c8cf | 12 | * |
jah128 | 0:d6269d17c8cf | 13 | * (C) Dept. Electronics & Computer Science, University of York |
jah128 | 0:d6269d17c8cf | 14 | * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis |
jah128 | 0:d6269d17c8cf | 15 | * |
jah128 | 5:3cdd1a37cdd7 | 16 | * PsiSwarm Library Version: 0.7 |
jah128 | 0:d6269d17c8cf | 17 | * |
jah128 | 5:3cdd1a37cdd7 | 18 | * October 2016 |
jah128 | 0:d6269d17c8cf | 19 | * |
jah128 | 0:d6269d17c8cf | 20 | * Functions for accessing the 64Kb EPROM chip and reading the reserved firmware block |
jah128 | 0:d6269d17c8cf | 21 | * |
jah128 | 0:d6269d17c8cf | 22 | * Example: |
jah128 | 0:d6269d17c8cf | 23 | * @code |
jah128 | 0:d6269d17c8cf | 24 | * #include "psiswarm.h" |
jah128 | 0:d6269d17c8cf | 25 | * |
jah128 | 0:d6269d17c8cf | 26 | * int main() { |
jah128 | 0:d6269d17c8cf | 27 | * init(); |
jah128 | 0:d6269d17c8cf | 28 | * write_eeprom_byte(0,0xDD); //Writes byte 0xDD in EPROM address 0 |
jah128 | 0:d6269d17c8cf | 29 | * char c = read_eeprom_byte(0); //c will hold 0xDD |
jah128 | 0:d6269d17c8cf | 30 | * //Valid address range is from 0 to 65279 |
jah128 | 0:d6269d17c8cf | 31 | * } |
jah128 | 0:d6269d17c8cf | 32 | * @endcode |
jah128 | 0:d6269d17c8cf | 33 | */ |
jah128 | 0:d6269d17c8cf | 34 | |
jah128 | 0:d6269d17c8cf | 35 | #ifndef EPROM_H |
jah128 | 0:d6269d17c8cf | 36 | #define EPROM_H |
jah128 | 0:d6269d17c8cf | 37 | |
jah128 | 0:d6269d17c8cf | 38 | /** Write a single byte to the EPROM |
jah128 | 0:d6269d17c8cf | 39 | * |
jah128 | 0:d6269d17c8cf | 40 | * @param address The address to store the data, range 0-65279 |
jah128 | 0:d6269d17c8cf | 41 | * @param data The character to store |
jah128 | 0:d6269d17c8cf | 42 | */ |
jah128 | 0:d6269d17c8cf | 43 | void write_eeprom_byte ( int address, char data ); |
jah128 | 0:d6269d17c8cf | 44 | |
jah128 | 0:d6269d17c8cf | 45 | /** Read a single byte from the EPROM |
jah128 | 0:d6269d17c8cf | 46 | * |
jah128 | 0:d6269d17c8cf | 47 | * @param address The address to read from, range 0-65279 |
jah128 | 0:d6269d17c8cf | 48 | * @return The character stored at address |
jah128 | 0:d6269d17c8cf | 49 | */ |
jah128 | 0:d6269d17c8cf | 50 | char read_eeprom_byte ( int address ); |
jah128 | 0:d6269d17c8cf | 51 | |
jah128 | 0:d6269d17c8cf | 52 | /** Read the next byte from the EPROM, to be called after read_eeprom_byte |
jah128 | 0:d6269d17c8cf | 53 | * |
jah128 | 0:d6269d17c8cf | 54 | * @return The character stored at address after the previous one read from |
jah128 | 0:d6269d17c8cf | 55 | */ |
jah128 | 0:d6269d17c8cf | 56 | char read_next_eeprom_byte ( void ); |
jah128 | 0:d6269d17c8cf | 57 | |
jah128 | 0:d6269d17c8cf | 58 | /** Read the data stored in the reserved firmware area of the EPROM |
jah128 | 0:d6269d17c8cf | 59 | * |
jah128 | 0:d6269d17c8cf | 60 | * @return 1 if a valid firmware is read, 0 otherwise |
jah128 | 0:d6269d17c8cf | 61 | */ |
jah128 | 0:d6269d17c8cf | 62 | char read_firmware ( void ); |
jah128 | 0:d6269d17c8cf | 63 | |
jah128 | 0:d6269d17c8cf | 64 | #endif |